Axis Range for any object?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Axis Range for any object?

jessaskey

Hi All…

 

I have looked through the docs and sorta quickly skimmed the libraries but I must be missing something simple…

 

Given any object, how to find the max or min value on any specific axis? Seems like I need something like max([rangeofXValuesInComplexObject]) but how do I find all the X values of a complex object… do I have to interate them somehow?

 

Thank you… Jess

 

 


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Axis Range for any object?

MichaelAtOz
Administrator
You can't get access to the geometry being built.
Particularly in preview as there is not geometry yet.
Preview uses GPU type tricks to make the image, just using the front faces.
However as it is built by you (apart from import) you can calculate what you
build.



-----
Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/   time is running out!
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|

Re: Axis Range for any object?

jessaskey
Okay, that makes sense and was the way I was going to do it... just wanted to make sure I wasn't missing something. Thank you for the explanation as well.

Jess

-----Original Message-----
From: Discuss [mailto:[hidden email]] On Behalf Of MichaelAtOz
Sent: Monday, July 2, 2018 11:49 PM
To: [hidden email]
Subject: Re: [OpenSCAD] Axis Range for any object?

You can't get access to the geometry being built.
Particularly in preview as there is not geometry yet.
Preview uses GPU type tricks to make the image, just using the front faces.
However as it is built by you (apart from import) you can calculate what you build.



-----
Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/   time is running out!
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Axis Range for any object?

runsun
If you build obj with polyhedron, you already have the coordinates from which
you can locate the max/min.



-----

$  Runsun Pan, PhD $ libs: scadx , doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), editor of choice: CudaText  ( OpenSCAD lexer ); $ Tips ; $ Snippets

--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
$ Runsun Pan, PhD
$ libs: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets
Reply | Threaded
Open this post in threaded view
|

Re: Axis Range for any object?

Jamie Bainbridge
In reply to this post by jessaskey
On 3 July 2018 at 13:50, Jess Askey <[hidden email]> wrote:
> Given any object, how to find the max or min value on any specific axis?
> Seems like I need something like max([rangeofXValuesInComplexObject]) but
> how do I find all the X values of a complex object… do I have to interate
> them somehow?

One way is to export the object as an STL, then open the file in
MeshLab, and choose Render, Show Box Corners. That will give you a
min/max on each axis.

I also wrote a Python script which will find the largest *dimension*
on each axis of an STL which you could easily modify to just print the
min/max values for XYZ:
https://www.reddit.com/r/3Dprinting/comments/7ehlfc/python_script_to_find_stl_dimensions/

I'm sure there's some programmatic way to take a SCAD file and parse
it through a CSG library to find the coords of all the vertices, but I
do not know it and the tooling/libs to work with STLs is more popular
and widespread, so I found it easier to use STL as an intermediate
format.

Jamie

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org