import of openscad file fails
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
Re: import of openscad file fails
utils/teardrops.scad
in there i saw:
in there i saw:
Code: Select all
module teardrop_plus(h, r, center, truncate = true)
teardrop(h, r + layer_height / 4, center, truncate);
-
- Veteran
- Posts: 2756
- Joined: Mon Feb 27, 2012 5:31 pm
Re: import of openscad file fails
Okay, I have a simple test case that fails.
The following CSG file produces a teardrop shape in OpenSCAD
Given the circle as $fn = 0 it should create a circle, but in FreeCAD it is creating an n sided ( in this case eight)polygon.
I will try and find some time to look at the code
The following CSG file produces a teardrop shape in OpenSCAD
Code: Select all
hull() {
circle($fn = 0, $fa = 5, $fs = 0.5, r = 2.3);
group() {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 1.15], [0, 0, 1, 0], [0, 0, 0, 1]]) {
square(size = [1.90538, 2.3], center = true);
}
I will try and find some time to look at the code
-
- Veteran
- Posts: 2756
- Joined: Mon Feb 27, 2012 5:31 pm
Re: import of openscad file fails
The problem seems to be that when the FreeCAD importer (importCSG.py) encounters a 2D hull request where one of the objects is a circle it exports a DXF file that is an 8 sided polygon, rather than say a 50 sided polygon or a DXF circle.
The hull request is then passed to OpenSCAD with import dxf file requests for it to produce a DXF file
that is read in.
So the problem seems to be in the DXF library as invoked by the export function in .../Mod/Draft/ImportDXF.py
Unfortunately, the code is not easy to follow or debug. I think the dxf functions were written by @yorik so maybe he can shed some light.
The hull request is then passed to OpenSCAD with import dxf file requests for it to produce a DXF file
that is read in.
So the problem seems to be in the DXF library as invoked by the export function in .../Mod/Draft/ImportDXF.py
Unfortunately, the code is not easy to follow or debug. I think the dxf functions were written by @yorik so maybe he can shed some light.
-
- Veteran
- Posts: 2756
- Joined: Mon Feb 27, 2012 5:31 pm
Re: import of openscad file fails
Okay after some more debugging.
I saved the dxf files that importCSG.py output before combing with the hull request.
They are circle which produced dxf file which looks like a circle in LibreCAD
square which produced dxf file which looks like a single line rather than a square in LibreCAD.
Which seems like a bug
Under the covers importCSG.py would make the following request
test3.cgm which looks like and this renders as an 8 sided polygon with OpenSCAD.
If in OpenSCAD I do a straight import(file="file1.dxf"); I get an 8 sided polygon rather than a circle. I think this calls for a query in the OpenSCAD forum see http://forum.openscad.org/Import-of-dxf ... 23852.html
Got a horrible suspicion that this is going to turn out to be a limitation with OpenSCAD
I saved the dxf files that importCSG.py output before combing with the hull request.
They are circle which produced dxf file which looks like a circle in LibreCAD
square which produced dxf file which looks like a single line rather than a square in LibreCAD.
Which seems like a bug
Under the covers importCSG.py would make the following request
test3.cgm which looks like
Code: Select all
hull(){import(file = "file1.dxf"); import(file = "file2.dxf");}
If in OpenSCAD I do a straight import(file="file1.dxf"); I get an 8 sided polygon rather than a circle. I think this calls for a query in the OpenSCAD forum see http://forum.openscad.org/Import-of-dxf ... 23852.html
Got a horrible suspicion that this is going to turn out to be a limitation with OpenSCAD
Last edited by keithsloan52 on Mon Apr 16, 2018 1:54 pm, edited 1 time in total.
Re: import of openscad file fails
oki, but i have aksed them about the direct export to step and they just pointed at freecad
i assume that they will do similar with anything they are asked
i will try and ask them at some point, but just in the middle of a website upgrade task that is more important
i assume that they will do similar with anything they are asked
i will try and ask them at some point, but just in the middle of a website upgrade task that is more important
-
- Veteran
- Posts: 2756
- Joined: Mon Feb 27, 2012 5:31 pm
Re: import of openscad file fails
OpenSCAD is built on the wrong sort of architecture CGAL to support STEP which needs BREP as used by FreeCAD. Think you will wait a very long time as I don't think it is possible. Certainly is not easy.
- wandererfan
- Veteran
- Posts: 6268
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: import of openscad file fails
This should be fixed by git commit 9975c75888.
A user preference now controls how many segments are used when approximating a circle from Dxf -
"User parameter:BaseApp/Preferences/Mod/OpenSCAD/fnForImport". The default is 32 segments.
A user preference now controls how many segments are used when approximating a circle from Dxf -
"User parameter:BaseApp/Preferences/Mod/OpenSCAD/fnForImport". The default is 32 segments.
- wandererfan
- Veteran
- Posts: 6268
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact: