(2017-02-04, 21:42)Milan Vančura Wrote: Thanks for starting your work on this, Roland! I think it would be better to release 1.7_Alpha1 with this feature (as soon as possible) so we all can test the new interface, send you a feedback and you can decide freely what/how to change or improve.I've completed these basic functions and will keep them for 1.6 but like you say the rest is best kept for the next version (ether 2.0 or 1.7) as it really needs more gui access and extended snap info.
(2017-02-04, 21:42)Milan Vančura Wrote: * those test functions (isCYL etc.) are four only, where is, for example, isAxle?These objects are mappings to the internal data which results from the shadow meta info (SNAP_CYL, SNAP_FGR, SNAP_CLP, SNAP_GEN). LDCad doesn't know what an 'axle' is it only matches the shape info. You can however in the meta assign group and id names to metas which will be preserved into the flattened data. The generic meta for axles (p/axle.dat) does this through its id=axle property. I've made those id and group properties available in the lua interface.
(2017-02-04, 21:42)Milan Vančura Wrote: * I do not see any functions to get a part this snap object is a part of and vice versa - a list of part's snap objectsYou access them through a subfile object, like so:
Code:
function runTest()
local sf=ldc.partBin():getWorkPart()
local cnt=sf:getSnapInfoCount()
print(sf:getSnapInfoCount())
for i=1,cnt do
local snap=sf:getSnapInfo(i)
print('id='..snap:getID()..' gen='..snap:getGender()..' kind='..snap:getKind()..' len=', snap:getLength(), ' r=', snap:getRadius(), ' posOri=', snap:getPosOri())
end
end
which for "32016.dat" would output:
Code:
3
id=connhole gen=F kind=CYL len=20.0 r=8.0 posOri=0 0 0 0 -1 0 1 0 0 0 0 1
id= gen=F kind=CYL len=20.0 r=6.0 posOri=0 0 -30 1 0 0 0 0 1 0 -1 0
id= gen=F kind=CYL len=20.0 r=6.0 posOri=0 -11.481 27.716 1 0 0 0 -0.383 -0.924 0 0.924 -0.383
(2017-02-04, 21:42)Milan Vančura Wrote: * for future, it would be nice to have a function connected_snaps() returning a list of snap objects "snapped" to this oneThat would be very nice indeed Currently no 'connected' information is used at all, this is something I very much would like for 2.0 though.
(2017-02-04, 21:42)Milan Vančura Wrote: About your question: I'm not sure what do you mean about those 16 snap objects of a brick 2x4. Too many of them? Or how to use them? I believe it is really usable to have a way how to display them and be able to select one (or more). For example, imagine a brick 1x6: with this feature, it would be - finally! - possible to put it in the non-right angle, like using Pythagorian triangle 3,4,5. It's a common technique in a real LEGO building (i.e. putting a house on a terrain in another angle than 90 deg) but hard to do in LDCad without calculating the angle manually. And many other examples.The problem I'm thinking of here; there is currently no simple way of determining which of those 16 snap info points you want to use in your scripts for things like triangle placements etc. It will need a GUI component to be really useful.
But then again once I make snap info selection available in the main GUI you might not need these things through script anymore.
Which is way I'm considering going the blender way and make all high level editing stuff script based while keeping the LDCad (2.0) binary limited to low level operations and rendering only. That's just something I'm considering though, nothing is set in stone