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!
Post Reply
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 »

bvwj wrote: Mon Feb 07, 2022 9:01 pm This is the error trace when I import with importCSG.py.
14:00:00 WARNING: Token 'DOT' defined, but not used
14:00:00 WARNING: Token 'WORD' defined, but not used
14:00:00 WARNING: There are 2 unused tokens
14:00:00 Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Applications/FreeCAD.app/Contents/Resources/Mod/OpenSCAD/importCSG.py", line 130, in open
processcsg(tmpfile)
File "/Applications/FreeCAD.app/Contents/Resources/Mod/OpenSCAD/importCSG.py", line 191, in processcsg
result = parser.parse(f.read())
File "/Applications/FreeCAD.app/Contents/Resources/lib/python3.8/site-packages/ply/yacc.py", line 333, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "/Applications/FreeCAD.app/Contents/Resources/lib/python3.8/site-packages/ply/yacc.py", line 1120, in parseopt_notrack
p.callable(pslice)
File "/Applications/FreeCAD.app/Contents/Resources/Mod/OpenSCAD/importCSG.py", line 659, in p_difference_action
mycut.Shape = mycut.Base.Shape.cut(mycut.Tool.Shape)
<class 'Part.OCCError'>: Tool shape is null
The recomputes of the twist_extrudes are failing for some reason

Code: Select all

21:44:19  Processing : /Users/keithsloan/MEGA/MEGAsync/CAD_Files/OpenSCAD/testFiles/bvwj.scad
21:44:19  Calling OpenSCAD
21:44:19  Using Alternate OpenSCAD Importer
21:44:19  Object cube Check Object Shape
21:44:19  Object twist_extrude Check Object Shape
21:44:19  19Standard_NullObject Traceback (most recent call last):
  File "/Users/keithsloan/Library/Preferences/FreeCAD/Mod/OpenSCAD_Alt_Import/OpenSCADFeatures.py", line 404, in execute
    self.createGeometry(fp)
  File "/Users/keithsloan/Library/Preferences/FreeCAD/Mod/OpenSCAD_Alt_Import/OpenSCADFeatures.py", line 412, in createGeometry
    if fp.Base and fp.Height and fp.Base.Shape.isValid():
<class 'Part.OCCError'>: 19Standard_NullObject 
21:44:19  Recompute failed
21:44:19  Object twist_extrude Check Object Shape
21:44:19  19Standard_NullObject Traceback (most recent call last):
  File "/Users/keithsloan/Library/Preferences/FreeCAD/Mod/OpenSCAD_Alt_Import/OpenSCADFeatures.py", line 404, in execute
    self.createGeometry(fp)
  File "/Users/keithsloan/Library/Preferences/FreeCAD/Mod/OpenSCAD_Alt_Import/OpenSCADFeatures.py", line 412, in createGeometry
    if fp.Base and fp.Height and fp.Base.Shape.isValid():
<class 'Part.OCCError'>: 19Standard_NullObject 
21:44:19  Recompute failed
21:44:19  Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/keithsloan/Library/Preferences/FreeCAD/Mod/OpenSCAD_Alt_Import/freecad/OpenSCAD_Alt_Import/importCSG.py", line 96, in open
    processcsg(tmpfile)
  File "/Users/keithsloan/Library/Preferences/FreeCAD/Mod/OpenSCAD_Alt_Import/freecad/OpenSCAD_Alt_Import/importCSG.py", line 157, in processcsg
    result = parser.parse(f.read())
  File "/Applications/FreeCAD_19.2.app/Contents/Resources/lib/python3.8/site-packages/ply/yacc.py", line 333, in parse
    return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
  File "/Applications/FreeCAD_19.2.app/Contents/Resources/lib/python3.8/site-packages/ply/yacc.py", line 1120, in parseopt_notrack
    p.callable(pslice)
  File "/Users/keithsloan/Library/Preferences/FreeCAD/Mod/OpenSCAD_Alt_Import/freecad/OpenSCAD_Alt_Import/importCSG.py", line 699, in p_difference_action
    mycut.Shape = mycut.Base.Shape.cut(mycut.Tool.Shape)
<class 'Part.OCCError'>: Tool shape is null
@chennes Chris I think you did some work on extrudes perhaps you could look at.

I have pushed the updates outputting details on recompute to https://github.com/KeithSloan/OpenSCAD_Alt_Import
User avatar
chennes
Veteran
Posts: 3876
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 »

That last example loads fine for me with the last changes you made, Keith:
OpenSCAD_Test.png
OpenSCAD_Test.png (8.53 KiB) Viewed 3385 times
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 »

chennes wrote: Mon Feb 07, 2022 10:06 pm That last example loads fine for me with the last changes you made, Keith:
OpenSCAD_Test.png
Thanks Chris, I think the OpenSCAD_Alt_importer probably does not have the fixes you did for extrude a while back so that would explain why it is failing for me.
bvwj
Posts: 13
Joined: Wed Jan 19, 2022 10:20 pm

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

Post by bvwj »

I added the new importCSG.py to this:

OS: macOS 10.16
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24291 (Git)
Build type: Release
Branch: (HEAD detached at 0.19.2)
Hash: 7b5e18a0759de778b74d3a5c17eba9cb815035ac
Python version: 3.8.8
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)
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 »

bvwj wrote: Mon Feb 07, 2022 10:53 pm I added the new importCSG.py to this:

OS: macOS 10.16
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24291 (Git)
Build type: Release
Branch: (HEAD detached at 0.19.2)
Hash: 7b5e18a0759de778b74d3a5c17eba9cb815035ac
Python version: 3.8.8
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)
So it is now working for you? Not clear to me from your post.
bvwj
Posts: 13
Joined: Wed Jan 19, 2022 10:20 pm

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

Post by bvwj »

I was just trying to answer your previous question. No it is still not working.

I just downloaded the new importCSG.py. I still get these errors trying to import the example of the connector hole in the plate.

Are there other FreeCAD upgrades that I need?
09:02:48 Processing : /Users/barry/Projects/OpenSCAD/PCB/test4.scad
09:02:48 Using Alternate OpenSCAD Importer
09:02:48 19Standard_NullObject Traceback (most recent call last):
File "/Users/barry/Library/Preferences/FreeCAD/Mod/OpenSCAD_Alt_Import/OpenSCADFeatures.py", line 404, in execute
self.createGeometry(fp)
File "/Users/barry/Library/Preferences/FreeCAD/Mod/OpenSCAD_Alt_Import/OpenSCADFeatures.py", line 412, in createGeometry
if fp.Base and fp.Height and fp.Base.Shape.isValid():
<class 'Part.OCCError'>: 19Standard_NullObject
09:02:48 Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/barry/Library/Preferences/FreeCAD/Mod/OpenSCAD_Alt_Import/freecad/OpenSCAD_Alt_Import/importCSG.py", line 125, in insert
processcsg(tmpfile)
File "/Users/barry/Library/Preferences/FreeCAD/Mod/OpenSCAD_Alt_Import/freecad/OpenSCAD_Alt_Import/importCSG.py", line 157, in processcsg
result = parser.parse(f.read())
File "/Applications/FreeCAD.app/Contents/Resources/lib/python3.8/site-packages/ply/yacc.py", line 333, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "/Applications/FreeCAD.app/Contents/Resources/lib/python3.8/site-packages/ply/yacc.py", line 1120, in parseopt_notrack
p.callable(pslice)
File "/Users/barry/Library/Preferences/FreeCAD/Mod/OpenSCAD_Alt_Import/freecad/OpenSCAD_Alt_Import/importCSG.py", line 696, in p_difference_action
mycut.Shape = mycut.Base.Shape.cut(mycut.Tool.Shape)
<class 'Part.OCCError'>: Tool shape is null
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 »

bvwj wrote: Tue Feb 08, 2022 4:05 pm I was just trying to answer your previous question. No it is still not working.

I just downloaded the new importCSG.py. I still get these errors trying to import the example of the connector hole in the plate.

Are there other FreeCAD upgrades that I need?
09:02:48 Processing : /Users/barry/Projects/OpenSCAD/PCB/test4.scad
09:02:48 Using Alternate OpenSCAD Importer
09:02:48 19Standard_NullObject Traceback (most recent call last):
File "/Users/barry/Library/Preferences/FreeCAD/Mod/OpenSCAD_Alt_Import/OpenSCADFeatures.py", line 404, in execute
self.createGeometry(fp)
File "/Users/barry/Library/Preferences/FreeCAD/Mod/OpenSCAD_Alt_Import/OpenSCADFeatures.py", line 412, in createGeometry
if fp.Base and fp.Height and fp.Base.Shape.isValid():
<class 'Part.OCCError'>: 19Standard_NullObject
09:02:48 Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/barry/Library/Preferences/FreeCAD/Mod/OpenSCAD_Alt_Import/freecad/OpenSCAD_Alt_Import/importCSG.py", line 125, in insert
processcsg(tmpfile)
File "/Users/barry/Library/Preferences/FreeCAD/Mod/OpenSCAD_Alt_Import/freecad/OpenSCAD_Alt_Import/importCSG.py", line 157, in processcsg
result = parser.parse(f.read())
File "/Applications/FreeCAD.app/Contents/Resources/lib/python3.8/site-packages/ply/yacc.py", line 333, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "/Applications/FreeCAD.app/Contents/Resources/lib/python3.8/site-packages/ply/yacc.py", line 1120, in parseopt_notrack
p.callable(pslice)
File "/Users/barry/Library/Preferences/FreeCAD/Mod/OpenSCAD_Alt_Import/freecad/OpenSCAD_Alt_Import/importCSG.py", line 696, in p_difference_action
mycut.Shape = mycut.Base.Shape.cut(mycut.Tool.Shape)
<class 'Part.OCCError'>: Tool shape is null
Are you using the Alternate Importer or vanilla?

I made an error updating OpenSCAD_Alt_Import/OpenSCADFeatures sorry about that, should now be fixed.

If you are using the main FreeCAD OpenSCAD importer you need to get the latest importCSG.py and OpenSCADFeatures.py from the main github repository
bvwj
Posts: 13
Joined: Wed Jan 19, 2022 10:20 pm

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

Post by bvwj »

Thanks for the fix. The Alternate Importer now works fine on my most complicated design!

I updated both importCSG.py and OpenSCADFeatures.py and still get the same errors when trying to use the regular importer.
Screen Shot 2022-02-08 at 10.15.24 AM.png
Screen Shot 2022-02-08 at 10.15.24 AM.png (211.21 KiB) Viewed 3192 times
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 »

bvwj wrote: Tue Feb 08, 2022 5:16 pm Thanks for the fix. The Alternate Importer now works fine on my most complicated design!

I updated both importCSG.py and OpenSCADFeatures.py and still get the same errors when trying to use the regular importer.

Screen Shot 2022-02-08 at 10.15.24 AM.png
@chennes Hi Chris I think there is in the main repro still one CheckObjShape missing from importCSG.py
but maybe not if it works for you
User avatar
chennes
Veteran
Posts: 3876
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 »

Entirely possible one is missing, I did the merge purely by hand, by reading your diffs. Do you happen to know which one it is that I missed?
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
Post Reply