-
If I have a geom2 object, how can I convert it to geom3? From reading the docs and the code, I can think of two ways:
Since there is a bug in 2b, and since 1 uses 2 internally, both the approaches are not usable for me. Is there any other alternative that I have missed? FWIW, I tried converting geom2 to outlines and then constructing geom3 from it, but that doesn't give the correct result: // This doesn't work
const g2 = subtract(rectangle({size: [5, 5]}), rectangle({size: [3, 3]}))
const o = geom2.toOutlines(g2);
// convert 2d points to 3d points
const o3 = o.map( (poly) => {
return poly.map((p) => {
return [...p, 0]
})
})
const g3 = geom3.fromPoints(o3)
return g3 With the above, the small rectangle is shown, but not the bigger one. I suspect this is not the right technique. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
@t1u1 Welcome! That’s pretty much correct. 2D geometry are extruded to create special 3D geometry. https://openjscad.xyz/dokuwiki/doku.php?id=en:design_guide_conversions If that isn’t enough then you can extruder using custom logic to create layers between slices. Or, you can piece together a polyhedron from points and faces. Of course, the 3D geometry can be flat but it won’t be very useful when 3D printing, which is the focus of JSCAD. |
Beta Was this translation helpful? Give feedback.
@t1u1 Welcome!
That’s pretty much correct. 2D geometry are extruded to create special 3D geometry.
https://openjscad.xyz/dokuwiki/doku.php?id=en:design_guide_conversions
If that isn’t enough then you can extruder using custom logic to create layers between slices.
Or, you can piece together a polyhedron from points and faces.
Of course, the 3D geometry can be flat but it won’t be very useful when 3D printing, which is the focus of JSCAD.