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: Tue Feb 08, 2022 10:42 pm 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?
I think I added one to def p_linear_extrude_with_transform(p):

Code: Select all

def p_linear_extrude_with_transform(p):
    'linear_extrude_with_transform : linear_extrude LPAREN keywordargument_list RPAREN OBRACE block_list EBRACE'
    if printverbose: print("Linear Extrude With Transform")
    h = float(p[3]['height'])
    s = 1.0
    t = 0.0
    if printverbose: print("Twist : ",p[3])
    if 'scale' in p[3]:
       s = [float(p[3]['scale'][0]), float(p[3]['scale'][1])]
       #print('Scale: '+str(s))
    if 'twist' in p[3]:
        t = float(p[3]['twist'])
    # Test if null object like from null text
    if (len(p[6]) == 0) :
        p[0] = []
        return
    if (len(p[6]) > 1) :
        obj = fuse(p[6],"Linear Extrude Union")
    else :
        obj = p[6][0]
    checkObjShape(obj)
    if t != 0.0 or s != 1.0:
        newobj = process_linear_extrude_with_transform(obj,h,t,s)
    else:
        newobj = process_linear_extrude(obj,h)
    if p[3]['center']=='true' :
       center(newobj,0,0,h)
    p[0] = [newobj]
    if gui:
       obj.ViewObject.hide()
    if printverbose: print("End Linear Extrude with twist")


User avatar
chennes
Veteran
Posts: 3877
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 »

Got it, added in git commit 71130d31b.
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 »

Sorry, it's off topic but relevant. Didn't know where to post.
Can we refine these 2 strings (they're duplicate) a little more. They feel a little janky and translators have complained they're too convoluted.

Error all shapes must be either 2D or both must be 3D


https://github.com/FreeCAD/FreeCAD/blob ... ls.py#L710
https://github.com/FreeCAD/FreeCAD/blob ... ls.py#L722

Ref: https://crowdin.com/translate/freecad/2 ... =5#6498175
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
numanair
Posts: 4
Joined: Sun Feb 20, 2022 5:03 am

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

Post by numanair »

Hello!
I am working on my first real openscad project and I want to make sure it can be used within FreeCAD as well. I am trying to use a nested array to create different configurations of holes in a plate. It seems something about line 41 in my file causes a problem. I have tried both the built-in importer and the new alternate importer. Neither work correctly for this file, though they do produce different errors.

File in question: https://github.com/numanair/keeby-cat/b ... e.scad#L41

If I should create a new thread for help with it let me know.
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 »

numanair wrote: Sun Feb 20, 2022 5:12 am Hello!
I am working on my first real openscad project and I want to make sure it can be used within FreeCAD as well. I am trying to use a nested array to create different configurations of holes in a plate. It seems something about line 41 in my file causes a problem. I have tried both the built-in importer and the new alternate importer. Neither work correctly for this file, though they do produce different errors.

File in question: https://github.com/numanair/keeby-cat/b ... e.scad#L41

If I should create a new thread for help with it let me know.
Have partially fixed the alternate importer.

The scad file has produced a csg with a large number of group statements
plate.csg
(11.54 KiB) Downloaded 42 times
For some reason the lex parser was parsing the last group as having a value of None and the code was not handling this.

There is still something strange about the group as the FreeCAD file produced has three groups with no valid shape

Code: Select all

16:24:26  <Part> ViewProviderExt.cpp(1340): Cannot compute Inventor representation for the shape of plate#group
16:24:26  <Part> ViewProviderExt.cpp(1340): Cannot compute Inventor representation for the shape of plate#group001
16:24:26  <Part> ViewProviderExt.cpp(1340): Cannot compute Inventor representation for the shape of plate#group002
FreeCAD file
plate.FCStd
(267.1 KiB) Downloaded 40 times
Will be interested in. Chris's @chennes comments when he fixes the main importer.
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 »

keithsloan52 wrote: Sun Feb 20, 2022 4:35 pm
Have partially fixed the alternate importer.

The scad file has produced a csg with a large number of group statements plate.csg
For some reason the lex parser was parsing the last group as having a value of None and the code was not handling this.

There is still something strange about the group as the FreeCAD file produced has three groups with no valid shape

Code: Select all

16:24:26  <Part> ViewProviderExt.cpp(1340): Cannot compute Inventor representation for the shape of plate#group
16:24:26  <Part> ViewProviderExt.cpp(1340): Cannot compute Inventor representation for the shape of plate#group001
16:24:26  <Part> ViewProviderExt.cpp(1340): Cannot compute Inventor representation for the shape of plate#group002
FreeCAD file plate.FCStd

Will be interested in. Chris's @chennes comments when he fixes the main importer.
Attaching the same file with the Group objects [ group, group001, group002] deleted.
plate_delGroup.FCStd
(264.32 KiB) Downloaded 40 times
I note that there are booleans with the same name, so wondering if there are conditions where a group ends up as a boolean so does
not need the creation of a group object just a boolean

I am away till Friday so will look at on my return.
numanair
Posts: 4
Joined: Sun Feb 20, 2022 5:03 am

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

Post by numanair »

Thank you Keith! Works great.
User avatar
chennes
Veteran
Posts: 3877
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 »

numanair wrote: Wed Feb 23, 2022 6:21 am Thank you Keith! Works great.
I've borked my installation of OpenSCAD somehow (Win11 issues, maybe?) -- is this what that plate is supposed to look like?
plate.png
plate.png (46.4 KiB) Viewed 3299 times
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
chennes
Veteran
Posts: 3877
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 »

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."

??
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
numanair
Posts: 4
Joined: Sun Feb 20, 2022 5:03 am

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

Post by numanair »

chennes wrote: Thu Feb 24, 2022 3:17 am
numanair wrote: Wed Feb 23, 2022 6:21 am Thank you Keith! Works great.
I've borked my installation of OpenSCAD somehow (Win11 issues, maybe?) -- is this what that plate is supposed to look like?

plate.png
Yep. I did build it using several 2D shapes with linear extrudes.
Post Reply