discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Axis Range for any object?

JA
Jess Askey
Tue, Jul 3, 2018 3:50 AM

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

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
M
MichaelAtOz
Tue, Jul 3, 2018 5:48 AM

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/

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/
JA
Jess Askey
Tue, Jul 3, 2018 1:06 PM

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:discuss-bounces@lists.openscad.org] On Behalf Of MichaelAtOz
Sent: Monday, July 2, 2018 11:49 PM
To: discuss@lists.openscad.org
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
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

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:discuss-bounces@lists.openscad.org] On Behalf Of MichaelAtOz Sent: Monday, July 2, 2018 11:49 PM To: discuss@lists.openscad.org 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 Discuss@lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
R
runsun
Tue, Jul 3, 2018 9:31 PM

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/

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/
JB
Jamie Bainbridge
Wed, Jul 4, 2018 7:33 AM

On 3 July 2018 at 13:50, Jess Askey jess@askey.org 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

On 3 July 2018 at 13:50, Jess Askey <jess@askey.org> 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