On Mar 5, 2025, at 8:53 AM, Jordan Brown via Discuss discuss@lists.openscad.org wrote:
There is no way in current OpenSCAD to extract the vertexes of a generated shape.
No, you cannot yet.
However, using BOSL2, you can get 2D perimeter paths of the basic 2D shapes like square()
and circle()
by calling them as functions. Ie:
path=square([30,40], center=true);
path2=circle(r=10);
You can put non-intersecting paths together in a list, with the first item being the perimeter, and the rest being holes inside that perimeter. That makes a “Region”:
rgn=[path, path2];
You can rotate, translate, etc paths and regions by calling the function forms of transformations, with the input path/region passed in the p=
argument:
rgn2=move([10,5], p=rgn);
rgn3=rot(30,p=rgn2);
You can do 2D boolean geometry by passing a list of regions to the function forms of union()
, difference()
and intersect ()
:
rgn4=difference([rgn, rgn3]);
You can even use the function form of offset()
on a region:
rgn5=offset(rgn4,r=1);
You can then instantiate the final resultant region into 2D geometry with the module region()
.
region(rgn5);
-Revar
I thought the op was generating the shape by combining primitives -
squares, circles, and so on. I do not know of a method, within openscad, of
exposing the vertices of such generated shapes, but exporting as svg gives
the list of vertices (albeit in a different format). Maybe, if you set an
xy problem, you get a to z answers.
No. I needed the vertices so that I could cache them.
The question is what the OP wanted to do, that required the actual list
of points.
Right. My early attempt at setting up some hashtable based parameter
caching for part profiles cached the contour and then manipulated it
afterward.
I have completely refactored the code to remove the requirement for the
vertices. In retrospect, it was not a wise train of thought.
EBo --
On Wed, Mar 5, 2025 at 11:53 AM Jordan Brown via Discuss <
discuss@lists.openscad.org> wrote:
On Mar 5, 2025, at 2:13 AM, Raymond West via Discuss <
discuss@lists.openscad.org> wrote:
I thought the perimeter was the distance around the outside edge of a
2d shape, so basically the sum of the distances between the vertices.
Yes, more or less. The dictionary definition is that “perimeter” is the
outside edge of the shape, or the length of that outside edge.
I thought the op was generating the shape by combining primitives -
squares, circles, and so on. I do not know of a method, within openscad, of
exposing the vertices of such generated shapes, but exporting as svg gives
the list of vertices (albeit in a different format). Maybe, if you set an
xy problem, you get a to z answers.
There is no way in current OpenSCAD to extract the vertexes of a generated
shape.
The question is what the OP wanted to do, that required the actual list of
points.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
When using python mode of OpenSCAD there is a mesh() function
vertices, triangles = my_object.mesh(triangulate=False)
It's quite easy to process this data to calculate the required cut-line.
On Thu, Mar 6, 2025 at 7:47 AM John David via Discuss <
discuss@lists.openscad.org> wrote:
I thought the op was generating the shape by combining primitives -
squares, circles, and so on. I do not know of a method, within openscad, of
exposing the vertices of such generated shapes, but exporting as svg gives
the list of vertices (albeit in a different format). Maybe, if you set an
xy problem, you get a to z answers.
No. I needed the vertices so that I could cache them.
The question is what the OP wanted to do, that required the actual list
of points.
Right. My early attempt at setting up some hashtable based parameter
caching for part profiles cached the contour and then manipulated it
afterward.
I have completely refactored the code to remove the requirement for the
vertices. In retrospect, it was not a wise train of thought.
EBo --
On Wed, Mar 5, 2025 at 11:53 AM Jordan Brown via Discuss <
discuss@lists.openscad.org> wrote:
On Mar 5, 2025, at 2:13 AM, Raymond West via Discuss <
discuss@lists.openscad.org> wrote:
I thought the perimeter was the distance around the outside edge of a
2d shape, so basically the sum of the distances between the vertices.
Yes, more or less. The dictionary definition is that “perimeter” is the
outside edge of the shape, or the length of that outside edge.
I thought the op was generating the shape by combining primitives -
squares, circles, and so on. I do not know of a method, within openscad, of
exposing the vertices of such generated shapes, but exporting as svg gives
the list of vertices (albeit in a different format). Maybe, if you set an
xy problem, you get a to z answers.
There is no way in current OpenSCAD to extract the vertexes of a
generated shape.
The question is what the OP wanted to do, that required the actual list
of points.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org