discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Access vertices in an object?

F
frankv
Tue, Nov 8, 2016 1:00 AM

Hi all,
I'm playing around with the Bell X1 3D model from the Smithsonian
(http://3d.si.edu/explorer?modelid=1341). I've downloaded the STL and
imported it into OpenSCAD, and want to cut it in half and produce a shell,
for 3D printing.

The following does what I want:

    intersection() {
        minkowski() {
            difference() {
                translate([-5000, -1000, -10000 + 200])
                    cube([5000, 4000, 10000]);
                aircraft();
            }
            sphere(50);
        }
        aircraft();
    }

module aircraft() {
import("bellX1-300kPrintReady.stl");
}

NB before trying the above yourself: it takes 2 hours to compile due to
the minkowski()!

But it would be nice if OpenSCAD could be told to automatically calculate
the bounding box for an object. I'm aware of the bounding box code at
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Commented_Example_Projects,
but that still needs the user to specify the value for the "height". And I
could use the hull() command, but that gives me a hull over the whole
aircraft, and I want to split it in half, so I'd still need to specify a
box.

So what I think I'm after is a function to return an array of [X,Y,Z]
coordinates, which could then be processed with a for() loop, something like
this:

for (i = [/vertices/(aircraft())] { ... }

and in the body of the loop find the max() and min() of each coordinate.

Is there something like this already? Or planned? Or am I going in the wrong
direction entirely?

Frank

--
View this message in context: http://forum.openscad.org/Access-vertices-in-an-object-tp18995.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Hi all, I'm playing around with the Bell X1 3D model from the Smithsonian (http://3d.si.edu/explorer?modelid=1341). I've downloaded the STL and imported it into OpenSCAD, and want to cut it in half and produce a shell, for 3D printing. The following does what I want: intersection() { minkowski() { difference() { translate([-5000, -1000, -10000 + 200]) cube([5000, 4000, 10000]); aircraft(); } sphere(50); } aircraft(); } module aircraft() { import("bellX1-300kPrintReady.stl"); } NB before trying the above yourself: it takes 2 *hours* to compile due to the minkowski()! But it would be nice if OpenSCAD could be told to automatically calculate the bounding box for an object. I'm aware of the bounding box code at https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Commented_Example_Projects, but that still needs the user to specify the value for the "height". And I could use the hull() command, but that gives me a hull over the whole aircraft, and I want to split it in half, so I'd still need to specify a box. So what I think I'm after is a function to return an array of [X,Y,Z] coordinates, which could then be processed with a for() loop, something like this: for (i = [/*vertices*/(aircraft())] { ... } and in the body of the loop find the max() and min() of each coordinate. Is there something like this already? Or planned? Or am I going in the wrong direction entirely? Frank -- View this message in context: http://forum.openscad.org/Access-vertices-in-an-object-tp18995.html Sent from the OpenSCAD mailing list archive at Nabble.com.
MK
Marius Kintel
Tue, Nov 8, 2016 2:08 AM

If you just want the shell, I believe most slicers will allow you to print only the shell of an object.

We don’t have a good plan for how to support what you ask for in OpenSCAD. For imported STL files, it’s likely that querying the bounding box would be supported before querying then vertices themselves.

-Marius

If you just want the shell, I believe most slicers will allow you to print only the shell of an object. We don’t have a good plan for how to support what you ask for in OpenSCAD. For imported STL files, it’s likely that querying the bounding box would be supported before querying then vertices themselves. -Marius
R
Ronaldo
Tue, Nov 8, 2016 9:38 AM

One approach to have access to a model vertex coordinates is to export it in
AMF format, to process it with Neon22's python code and to load the
polyhedron in OpenSCAD format back in your code. See: Wrapping text around a
complex geometry
http://forum.openscad.org/Wrapping-text-around-a-complex-geometry-tc18145.html

--
View this message in context: http://forum.openscad.org/Access-vertices-in-an-object-tp18995p18999.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

One approach to have access to a model vertex coordinates is to export it in AMF format, to process it with Neon22's python code and to load the polyhedron in OpenSCAD format back in your code. See: Wrapping text around a complex geometry <http://forum.openscad.org/Wrapping-text-around-a-complex-geometry-tc18145.html> -- View this message in context: http://forum.openscad.org/Access-vertices-in-an-object-tp18995p18999.html Sent from the OpenSCAD mailing list archive at Nabble.com.