From freecad I exported a sketch to FreecadSketch.dxf and from OpenSCAD I can use it such as:
linear_extrude() import("FreecadSketch.dxf");
In BOSL2 one needs to use linear_sweep(region) to produce an equivalent attachable. I do not see how to go from a freecad sketch to a region. Apologies if I am missing something obvious as I am just getting started with both OpenSCAD and the BOSL2 libary.
On Oct 5, 2023, at 4:09 PM, speedebikes@gmail.com wrote:
From freecad I exported a sketch to FreecadSketch.dxf and from OpenSCAD I can use it such as:
linear_extrude() import("FreecadSketch.dxf");
In BOSL2 one needs to use linear_sweep(region) to produce an equivalent attachable. I do not see how to go from a freecad sketch to a region. Apologies if I am missing something obvious as I am just getting started with both OpenSCAD and the BOSL2 libary.
Unfortunately, there is no current direct way to go from a sketch in DXF to a Region as used by BOSL2.
A somewhat manual option may be to convert the DXF to an SVG, then copy the <path d="...">
data into strings in a .scad file, then convert those strings to 2D paths using the Pathbuilder OpenSCAD library. At that point you can combine the paths into a Region by putting them in a list.
In the somewhat murky distant future it may become possible to directly get the geometry imported from the DXF file, via geometry introspection, but don't hold your breath for it.
Thanks! Just the response I was hoping for, a possible work around without forking OpenSCAD and without the chagrin of it being completely obvious.
A quick test suggests this approach will work. I exported a sketch from freecad directly to an .svg and nearly successfully got a polygon using Pathbuilder/svgShape(). The only issue was coordinates of form such as -8.323e-12 in the .svg ignore the exponent interpreting as -8.323 but replacing them with approximations not using exponents gives the expected result.