How to get model height?

42 views
Skip to first unread message

John James

unread,
Feb 12, 2018, 4:24:47 AM2/12/18
to IceSL
I want to print this heart pendant. Since it is pointy at the top I decided to add a cooling tower. But since the stl needs to be rotated I need to move it up to base plane. For which I need to know its height. But there is no docunentation about these functions.   Tried to use bbox.extent(2) with no luck. 
Could you please provide more indepth documentation and examples about those functions?
GetHeight.jpg

Gaël Pouger

unread,
Feb 12, 2018, 5:50:13 AM2/12/18
to IceSL
Hi, I played with bbox myself recently, try something like: bbox(shape):extent().z

Re-try WhenDown

unread,
Feb 12, 2018, 6:13:01 AM2/12/18
to IceSL
Hi John.

There's two ways of doing this. One is completely user interfaced. Open IceSL-Slicer, load the stl, scale it and rotate as you wish and click the Model Information drop-down text and there you'll see it:

The other way is as Gael suggested (i.e. programmatically). I must admit the documentation is not very specific about this so I added the object types in the bbox structure there.

size = bbox(shape):extent()
print('Shape size x:'..size.x..', y:'..size.y..', z:'..size.z)

Hope this helps.

Salim

--
You received this message because you are subscribed to the Google Groups "IceSL" group.
To unsubscribe from this group and stop receiving emails from it, send an email to icesl+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John James

unread,
Feb 12, 2018, 6:20:18 AM2/12/18
to IceSL
Thank you both. 

size=bbox(m0):extent()
print("ss"..size.z)
h=size.z

This worked. But better docs are still needed :)

Colin Hudson

unread,
Feb 14, 2018, 2:11:06 AM2/14/18
to IceSL
Hi John,
 if you look in the icesl-models folder there is a bbox.lua with example code.

There are many more examples for other functions. Looking in the examples can sometimes help out when the documentation is lacking.

Colin..

Re-try WhenDown

unread,
Feb 14, 2018, 5:50:04 AM2/14/18
to IceSL
Thank you Colin for this valuable information.

Notwithstanding I'd like to remark that our language documentation is oriented towards disambiguation and terseness (otherwise it becomes a formatting and maintenance nightmare for our already small developing team). Examples therein are provided for convenience only. When in doubt about usage, like Colin kindly remarked, go to the examples folder or you can come to this forum and we'll promptly answer your questions. However, if the official documentation is ambiguous, we do kindly ask that you let us know so we can correct it.

Now that James raised this problem with the bbox documentation, I've also noticed the svg_ex documentation was also ambiguous regarding the output structure members type. It is now corrected ;)

Salim.

--

John James

unread,
Feb 14, 2018, 7:48:06 AM2/14/18
to IceSL
I checked the scripting wiki page just now and bbox docs give extent as vector but at the begining in "Syntax" vectors are defined as arrays (1,0,0) and there is no menitioning od X,Y,Z notation. 
So in my working script it should be size(2) (which does not work) and not size.z
Probably my understanding of Lua is not enough but this does not seem right.

Thanks for your efforts in mantaining and advancing IceSl :)
To unsubscribe from this group and stop receiving emails from it, send an email to icesl+un...@googlegroups.com.

Re-try WhenDown

unread,
Feb 14, 2018, 9:00:39 AM2/14/18
to IceSL
You're right John. The documentation does not specify how to access the members from the vector class (shame on me!). It's corrected now. Thanks for pointing this out!

In the spirit of fellow programmers, here's a couple of clarifications:

There are four basic IceSL types (apart from the local lua types), those are; vectors, matrices, shapes and voxels. Each type is a class with its own operations, members and functionality. In lua, the concept of arrays is conflated with that of tables (i.e. think of a table as a derived class from the class array). Additionally, tables in lua are indexed with brackets starting with 1, not 0 (e.g. my_table[1]). Thus if a vector were indeed a table, reaching the z coordinate (i.e. the third member) would be written as my_vector[3]. Finally, a vector is a class on its own and not a table, therefore there is no indexing of vectors but rather, there is member access (e.g. my_vector.z).

Hope this helps!

Salim.

To unsubscribe from this group and stop receiving emails from it, send an email to icesl+unsubscribe@googlegroups.com.

John James

unread,
Feb 15, 2018, 2:47:44 AM2/15/18
to IceSL
Thanks for the explanation and the Lua tutorial :)
Reply all
Reply to author
Forward
0 new messages