Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
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!
keithsloan52
Veteran
Posts: 2756
Joined: Mon Feb 27, 2012 5:31 pm

Re: Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks

Post by keithsloan52 »

chennes wrote: Thu Feb 24, 2022 3:29 am
Kunda1 wrote: Sat Feb 19, 2022 10:41 pm Error all shapes must be either 2D or both must be 3D
"OpenSCAD file contains both 2D and 3D shapes. That is not supported in this importer, all shapes must have the same dimensionality."

??
I think @Kunda1 was asking for a better wording as written some language translators were having problems.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks

Post by Kunda1 »

keithsloan52 wrote: Thu Feb 24, 2022 12:42 pm
chennes wrote: Thu Feb 24, 2022 3:29 am
Kunda1 wrote: Sat Feb 19, 2022 10:41 pm Error all shapes must be either 2D or both must be 3D
"OpenSCAD file contains both 2D and 3D shapes. That is not supported in this importer, all shapes must have the same dimensionality."
I think @Kunda1 was asking for a better wording as written some language translators were having problems.
Indeed. Should I make the PR for this or will y'all add it in an upcoming OpenSCAD related commit ?
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
User avatar
chennes
Veteran
Posts: 3881
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks

Post by chennes »

Right, I was proposing what I thought was better wording. I'll just add it, I'm tweaking OpenSCAD WB this morning anyway.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks

Post by Kunda1 »

chennes wrote: Thu Feb 24, 2022 2:22 pm Right, I was proposing what I thought was better wording. I'll just add it, I'm tweaking OpenSCAD WB this morning anyway.
Nice. I would be happy to but I thought to myself that it would be possible that OpenSCAD would get some love soon and this could be appended to that. Thanks!
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
User avatar
chennes
Veteran
Posts: 3881
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks

Post by chennes »

Just some minor tweaks: I want to make sure people are aware of the new pipe transfer mechanism (I myself had forgotten about it!) for use with sandboxed copies of FreeCAD and/or OpenSCAD. So I added a short message that tries to detect those installations and write to the console. It won't catch everyone (especially those who don't have messages showing in the console at all), but it's a "soft" test of that detection.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
keithsloan52
Veteran
Posts: 2756
Joined: Mon Feb 27, 2012 5:31 pm

Re: Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks

Post by keithsloan52 »

This csg file fails both with the standard importer and the alternate importer
extrude_hull_Sq_Circle.csg
(2.8 KiB) Downloaded 29 times
Should look like
Image 25-02-2022 at 08.40.jpeg
Image 25-02-2022 at 08.40.jpeg (24.83 KiB) Viewed 3564 times
There are obviously easier ways of creating the end result, like with hull etc, but as it works with OpenSCAD it should be possible to import.
torriem
Posts: 1
Joined: Sun Nov 04, 2018 1:26 am

Re: Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks

Post by torriem »

Here's another SCAD file that fails to import on 0.20, Fedora 35:

https://www.thingiverse.com/download:9777448

The traceback is:
21:28:50 Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib64/freecad/Mod/OpenSCAD/importCSG.py", line 131, in open
processcsg(tmpfile)
File "/usr/lib64/freecad/Mod/OpenSCAD/importCSG.py", line 193, in processcsg
result = parser.parse(f.read())
File "/usr/lib/python3.10/site-packages/ply/yacc.py", line 333, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "/usr/lib/python3.10/site-packages/ply/yacc.py", line 1120, in parseopt_notrack
p.callable(pslice)
File "/usr/lib64/freecad/Mod/OpenSCAD/importCSG.py", line 658, in p_difference_action
checkObjShape(mybase.Base)
<class 'NameError'>: name 'mybase' is not defined

This is a curious one. When I look at the source indeed there is no place where mybase is defined. Looks like a type, but I'm not sure what mybase should be exactly. I tried changing lines 658 and 659 to mycut.Base and mycut.Tool, but if I do that, then I get a different exception:
21:41:09 Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib64/freecad/Mod/OpenSCAD/importCSG.py", line 131, in open
processcsg(tmpfile)
File "/usr/lib64/freecad/Mod/OpenSCAD/importCSG.py", line 193, in processcsg
result = parser.parse(f.read())
File "/usr/lib/python3.10/site-packages/ply/yacc.py", line 333, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "/usr/lib/python3.10/site-packages/ply/yacc.py", line 1120, in parseopt_notrack
p.callable(pslice)
File "/usr/lib64/freecad/Mod/OpenSCAD/importCSG.py", line 662, in p_difference_action
mycut.Tool.Shape = mycut.Tool.cut(o.Shape)
<class 'AttributeError'>: 'Part.Feature' object has no attribute 'cut'
User avatar
chennes
Veteran
Posts: 3881
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks

Post by chennes »

torriem wrote: Sun Apr 03, 2022 3:42 am Here's another SCAD file that fails to import on 0.20, Fedora 35:

https://www.thingiverse.com/download:9777448
Thanks for the report -- probably a copy-and-paste error on my part. I've resynchronized that function with @keithsloan52's alt importer, the bug is fixed in git commit 2c6af06fe960600bdfb04c4c9331fe1815e1358f.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks

Post by Kunda1 »

x-posting https://forum.freecadweb.org/viewtopic.php?f=10&t=67836
"[CSG import] Structures get doubled when importing certain groups with offset2D"
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
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Problem OpenSCAD scad & csg files - PLEASE Add them to this thread - Thanks

Post by Kunda1 »

In the tracker: issue #6271 CSG file from OpenScad does not render correctly
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
Post Reply