Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks
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: Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks
OK, I just added a custom function to handle union(); (the original parser sees that line as illegal syntax). I don't know if it's the most elegant solution, but now I am getting the correct shape (git commit 88ee6bb47f).
Re: Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks
Snap 'edge' testers will be able to test this functionality in ~1 hour once the builds complete.
Edit:
@chennes will this change merit adding documentation to the OpenSCAD_Workbench ?
Edit2:
The docs say that python3-ply is a necessary dependency (for v0.19). Is this still true for v0.20+ ?
Edit:
@chennes will this change merit adding documentation to the OpenSCAD_Workbench ?
Edit2:
The docs say that python3-ply is a necessary dependency (for v0.19). Is this still true for v0.20+ ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks
I don't think so -- this is really a bug fix. I am hopeful that it resolves quite a few nagging OpenSCAD problems, though -- I've seen this construct in several recent bugs.Kunda1 wrote: ↑Sun Sep 11, 2022 10:23 pm @chennes will this change merit adding documentation to the OpenSCAD_Workbench ?
Re: Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks
Thanks, Keith - sorry for the delayed response. I've incorporated a few of your recent changes into mainline, and can reproduce the errors above. It does seem like we need to add support for negative offsets, since they are legal in OpenSCAD.keithsloan52 wrote: ↑Wed Aug 17, 2022 9:36 pm Thanks for reporting
@chennes I have created the following test files from details in the this thread
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks
The attached SCAD file which is just a large polyhedron request just seem to loop the OpenSCAD importers.
Re: Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks
@keithsloan52 I am working on the last bit of issue #7305 -- there are some commented out lines near the end of importDXFface that, if uncommented, will mostly clean up the issue. Do you know why they are commented out? I think that the end of that function should be something like:
If I do that, both the extra lines and the extra Layers container are removed from the example file in the ticket.
Code: Select all
container = None
for layer in layers: #remove everything that has been imported
if container is None:
container = layer.getParentGroup()
removeOp = getattr(layer, "removeObjectsFromDocument", None)
if callable(removeOp):
layer.removeObjectsFromDocument()
for obj in layer.Group:
obj.Document.removeObject(obj.Name)
layer.Document.removeObject(layer.Name)
container.Document.removeObject(container.Name)
Re: Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks
It looks like we're locked up on this call in AppPartPy.cpp, line 963keithsloan52 wrote: ↑Sun Nov 20, 2022 10:41 am The attached SCAD file which is just a large polyhedron request just seem to loop the OpenSCAD importers.
Code: Select all
shape = sewShell.ApplySewing(shell);
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks
I did the original importer using Lex to parse, Sebastian came up with the idea of dealing with hull, minkowski requests by invoking openscadchennes wrote: ↑Fri Dec 02, 2022 1:29 am @keithsloan52 I am working on the last bit of issue #7305 -- there are some commented out lines near the end of importDXFface that, if uncommented, will mostly clean up the issue. Do you know why they are commented out? I think that the end of that function should be something like:If I do that, both the extra lines and the extra Layers container are removed from the example file in the ticket.Code: Select all
container = None for layer in layers: #remove everything that has been imported if container is None: container = layer.getParentGroup() removeOp = getattr(layer, "removeObjectsFromDocument", None) if callable(removeOp): layer.removeObjectsFromDocument() for obj in layer.Group: obj.Document.removeObject(obj.Name) layer.Document.removeObject(layer.Name) container.Document.removeObject(container.Name)
and hence the importDXFface.
No idea why those lines got commented but I would leave them as comments and copy the code just after the comments
adding a comment that they were added back on 02/12/2022.
Rational I have had situations where code goes back and forth. So if somebody looks in the future and thinks they should be commented out for
some reason, they should be aware that we have been round this loop before.
It would be a lot simpler if the DXF importer that FC now uses supported import to a face as well as import to a doc.
I once did some fixes for the old FC importer lib, it was HORRIBLE code in my opinion.
Re: Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks
Code: Select all
union() {
rotate_extrude()
polygon([
[10,0],
[10,20],
[10,20],
[0,0]
]);
linear_extrude(5)
circle(d=10);
}
changing the order does result in the correct union:
Code: Select all
union() {
linear_extrude(5)
circle(d=10);
rotate_extrude()
polygon([
[10,0],
[10,20],
[10,20],
[0,0]
]);
}
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks
Note the sections of code above are scad code, they don't work if you just put them in a file with the extension csg,csg_p01 wrote: ↑Tue Dec 06, 2022 8:48 pmseems to produce a angle argument of 90° for union in freecad 0.20, even though it is not supposed to.Code: Select all
union() { rotate_extrude() polygon([ [10,0], [10,20], [10,20], [0,0] ]); linear_extrude(5) circle(d=10); }
changing the order does result in the correct union:
This is true for csg as well as scad files and happens with wrong values for the translation property of union in a similar way (in freecad 0.18 union worked fine).Code: Select all
union() { linear_extrude(5) circle(d=10); rotate_extrude() polygon([ [10,0], [10,20], [10,20], [0,0] ]); }
they could be exported from native OpenSCAD as csg files.
I can confirm the described behaviour for
Code: Select all
OS: macOS 10.16
Word size of FreeCAD: 64-bit
Version: 0.20.29177 (Git)
Build type: Release
Branch: (HEAD detached at 0.20)
Hash: 68e337670e227889217652ddac593c93b5e8dc94
Python 3.9.13, Qt 5.12.9, Coin 4.0.0, Vtk 9.1.0, OCC 7.5.3
Locale: C/Default (C)
Installed mods:
* ImportNURBS 1.1.0
* ImportExport_3DM 0.1.0
* Pyramids-and-Polyhedrons
* GDML 2.0.0
* Alternate_OpenSCAD 1.0.0
* toSketch 1.0.1
* Curves 0.6.4