[Bug] #7304 - SCAD import broken with OpenSCAD version 2022.02.25.ai11146

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
gneiss
Posts: 75
Joined: Tue Mar 05, 2019 4:13 pm

[Bug] #7304 - SCAD import broken with OpenSCAD version 2022.02.25.ai11146

Post by gneiss »

I had some issues when using the AppImage Version of OpenSCAD from FreeCad (see https://github.com/FreeCAD/FreeCAD-Bundle/issues/127). After finding a workaround I found, that the never Version of OpenSCAD will produce the following errors when opening my scad file.
In general I found some more bugs. Here is a list:

Using a locally installed OpenSCAD (version 2021.01)
Errors:
1. whole object is rotated 90° around X-Axis
2. extra "lines" of Text (in Model)
3. extra "Layers (in Model)

Workaround:
1 Rotate Object after importing
2-3 can be eliminated by deleting these parts from Model-View

Using an AppImage of OpenScad (version 2022.02.25.ai11146 (git fb10c5dbf))
Errors:
1-3 as above
4 When used "linear_extrude( ... center = false ... )" or without parameter "center" inside the scad file:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/.mount_FreeCADfpAec/usr/Mod/OpenSCAD/importCSG.py", line 130, in open
processcsg(tmpfile)
File "/tmp/.mount_FreeCADfpAec/usr/Mod/OpenSCAD/importCSG.py", line 192, in processcsg
result = parser.parse(f.read())
File "/tmp/.mount_FreeCADfpAec/usr/lib/python3.10/site-packages/ply/yacc.py", line 333, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "/tmp/.mount_FreeCADfpAec/usr/lib/python3.10/site-packages/ply/yacc.py", line 1120, in parseopt_notrack
p.callable(pslice)
File "/tmp/.mount_FreeCADfpAec/usr/Mod/OpenSCAD/importCSG.py", line 835, in p_linear_extrude_with_transform
if p[3]['center']=='true' :
<class 'KeyError'>: 'center'
Workaround:
1-3 as above
4 Use only "linear_extrude( ... center = true ... )" in SCAD-file

Bugfix:
1-3 I have no idea where so search inside the source code to fix this
4 in Generell it should be sufficient to use
p[3].get('center','false')
instead of
p[3]['center']
For this I already had created a pull request (see https://github.com/FreeCAD/FreeCAD/pull/7301)

For reference I attached the scad-file that produces the Error(s) the line that produces the error 4 is marked.
Attachments
CR2032.scad
(918 Bytes) Downloaded 15 times
Last edited by Kunda1 on Mon Sep 12, 2022 9:54 pm, edited 1 time in total.
Reason: Added GH ticket number to thread title
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: [Bug] SCAD import brocken with OpenSCAD version 2022.02.25.ai11146

Post by adrianinsaval »

@chennes I think you usually deal with openscad stuff? sorry for the noise if that is not the case
User avatar
chennes
Veteran
Posts: 3878
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: [Bug] SCAD import brocken with OpenSCAD version 2022.02.25.ai11146

Post by chennes »

Yep -- I've been babysitting the OpenSCAD Workbench for the last year or two, so I'll add these to my radar. @gneiss when you have a moment please file (separate) bug reports on GitHub for each of these, and link back to this discussion. Thanks!

(I'll merge that PR once you've updated the commit title).
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
gneiss
Posts: 75
Joined: Tue Mar 05, 2019 4:13 pm

Re: [Bug] SCAD import brocken with OpenSCAD version 2022.02.25.ai11146

Post by gneiss »

@chennes:
please file (separate) bug reports
That was my first idea, but there is a hint that requests to first start a discussion here. So I think You mean that this request is already fullfilled.

But now I am not sure, what You mean with "separate".
Should I make one for each of the errors 1-3 ?
gneiss
Posts: 75
Joined: Tue Mar 05, 2019 4:13 pm

Re: [Bug] SCAD import brocken with OpenSCAD version 2022.02.25.ai11146

Post by gneiss »

OK, I had filed one report for error 1 and another one for 2&3.
My PR for bug 4 was already commited.
User avatar
chennes
Veteran
Posts: 3878
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: [Bug] SCAD import brocken with OpenSCAD version 2022.02.25.ai11146

Post by chennes »

It's fine to have a single forum discussion for several related bugs, but in GitHub issues it's best to have only one issue per bug report because that way we can get GitHub to automatically close the bug when an appropriate commit is added.
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: [Bug] #7304 - SCAD import broken with OpenSCAD version 2022.02.25.ai11146

Post by Kunda1 »

Added issue #7304 to title
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