Have an Openscad to Freecad conundrum to solve [solved]

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: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Have an Openscad to Freecad conundrum to solve

Post by keithsloan52 »

Just when you thought things could not get worse. I think there maybe issues with the use of dxf files.

If I load insert.dxf into FreeCAD I get
F1643DF3-9D5E-4AD6-95E8-CEF75740617F.jpeg
F1643DF3-9D5E-4AD6-95E8-CEF75740617F.jpeg (41.27 KiB) Viewed 1183 times
If I load it into LibreCAD I get
3455469B-8F15-4F5E-8751-5EC8283B10C4.jpeg
3455469B-8F15-4F5E-8751-5EC8283B10C4.jpeg (56.81 KiB) Viewed 1183 times
Wondering if all the dotted lines are construction lines, but suspect FreeCAD would just import them and treat as normal lines.

Await other dxf and scad file and the hole gets deeper.
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Have an Openscad to Freecad conundrum to solve

Post by keithsloan52 »

This is what OpenSCAD makes of the DXF file with straight import and linear extrude, wait to see what the OP is trying to do when the missing scad and dxf file are supplied. Maybe he is specifying a layer which would probably help.
E3C9B592-DCBC-4C0F-921B-1B158F8EE807.jpeg
E3C9B592-DCBC-4C0F-921B-1B158F8EE807.jpeg (181.28 KiB) Viewed 1179 times
Yuri
Posts: 34
Joined: Sun May 09, 2021 1:14 am

Re: Have an Openscad to Freecad conundrum to solve

Post by Yuri »

Thank you all for your responses.
I installed freecad 0.19 at first but trying to install the dependencies of the openscad workbench became a tragedy. A failure. Fought hard to solve the issues that were indicated in the window below each failed attempt. I'm not sure if the openscad workbench wasn't working because the dependencies are not there or because there was something else at play. The case is that when I installed 0.184 the openscad workbench was at least doing some of the work and I was able to process a few simpler parts.

I had a day out in the field today and it is just now that I get to read your responses. I use FC 0.184 in Windows 10 64 bit. I can install freecad 0.19 but I can see myself cornered in the same pit.

The files are attached below.

https://drive.google.com/file/d/1gNlnov ... sp=sharing
https://drive.google.com/file/d/1D-OQ3Q ... sp=sharing
Yuri
Posts: 34
Joined: Sun May 09, 2021 1:14 am

Re: Have an Openscad to Freecad conundrum to solve

Post by Yuri »

Thank you all for your responses.
I installed freecad 0.19 at first but trying to install the dependencies of the openscad workbench became a tragedy. A failure. Fought hard to solve the issues that were indicated in the window below each failed attempt. I'm not sure if the openscad workbench wasn't working because the dependencies are not there or because there was something else at play. The case is that when I installed 0.184 the openscad workbench was at least doing some of the work and I was able to process a few simpler parts.

I had a day out in the field today and it is just now that I get to read your responses. I use FC 0.184 in Windows 10 64 bit. I can install freecad 0.19 but I can see myself cornered in the same pit.

The files are attached below.

https://drive.google.com/file/d/1gNlnov ... sp=sharing
https://drive.google.com/file/d/1D-OQ3Q ... sp=sharing
Yuri
Posts: 34
Joined: Sun May 09, 2021 1:14 am

Re: Have an Openscad to Freecad conundrum to solve

Post by Yuri »

Thank you. You should know that there is no point in running simple extrudes or things like that in the dxf with openscad if you don't have the code.

I wouldn't have expected you all to try that. The openscad is in my previous post.

Wish to add that the open scad just uses items in 4 of the layers of the dxf. The other layers are for other parts. Openscad ignores the rest of all those things in the dxf that are not explicitly invoked by the code. I believe freecad do something similar with the parts that are working. The geometries in all of those layers may be loaded into freecad under the hood but as far I could see, it seemed to me that that was not an issue because the simpler parts were processed successfully even when all of that geometry was involved in the dxf.

You'll see that this part is not crazy complicated.
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

!!

Post by keithsloan52 »

I installed freecad 0.19 at first but trying to install the dependencies of the openscad workbench became a tragedy.
Please can you explain openscad dependencies THERE ARE NO !!!! I Repeat NO dependencies for the OpenSCAD Workshop.
You have OpenSCAD installed ? You just have set the OpenSCAD preference that tells FreeCAD where to find it.
FF05D358-06B1-4CEE-AB45-7E0DDE11C76F.jpeg
FF05D358-06B1-4CEE-AB45-7E0DDE11C76F.jpeg (85.38 KiB) Viewed 1085 times
If you export a CSG from OpenSCAD and import that, unless you have Hull & Minkowski requests. YOU DON'T EVEN need to tell FreeCAD where OpenSCAD is. SO WHAT ARE THESE DEPENDENCIES Are you living in a parallel universe?
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Have an Openscad to Freecad conundrum to solve

Post by keithsloan52 »

When I import your scad I file I get the following

Code: Select all

07:23:08  ImportCSG Version 0.6a
07:23:08  Start Lex
07:23:08  End Lex
07:23:08  Load Parser
07:23:08  WARNING: Token 'DOT' defined, but not used
07:23:08  WARNING: Token 'WORD' defined, but not used
07:23:08  WARNING: There are 2 unused tokens
07:23:08  Parser Loaded
07:23:08  Start Parser
07:23:08  Vector
07:23:08  Vector
07:23:08  Vector
07:23:08  Vector
07:23:08  Matrix
07:23:08  ('angle', '-100.744')
07:23:08  ('convexity', '6')
07:23:08  ('$fn', '0')
07:23:08  ('$fa', '12')
07:23:08  ('$fs', '2')
07:23:08  ('file', 'Insert.dxf')
07:23:08  ('layer', 'Insert Walls')
07:23:08  2d Point
07:23:08  ('origin', [0.0, 0.0])
07:23:08  ('scale', '1')
07:23:08  ('convexity', '6')
07:23:08  ('$fn', '0')
07:23:08  ('$fa', '12')
07:23:08  ('$fs', '2')
07:23:08  ('timestamp', '1620713944')
07:23:08  Import File
07:23:08  Importing : Insert.dxf Layer : Insert Walls
07:23:08  Process DXF file
07:23:08  File Name : Insert
07:23:08  Layer : Insert Walls
07:23:08  PathName : /Users/keithsloan/Downloads
07:23:08  DXF Full path : /Users/keithsloan/Downloads/Insert.dxf
07:23:08  Loading Mesh module... done
07:23:08  opening /Users/keithsloan/Downloads/Insert.dxf...
07:23:08  Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Applications/FreeCAD 0.19.1.app/Contents/Resources/Mod/OpenSCAD/importCSG.py", line 119, in open
    processcsg(tmpfile)
  File "/Applications/FreeCAD 0.19.1.app/Contents/Resources/Mod/OpenSCAD/importCSG.py", line 177, in processcsg
    result = parser.parse(f.read())
  File "/Applications/FreeCAD 0.19.1.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 0.19.1.app/Contents/Resources/lib/python3.8/site-packages/ply/yacc.py", line 1120, in parseopt_notrack
    p.callable(pslice)
  File "/Applications/FreeCAD 0.19.1.app/Contents/Resources/Mod/OpenSCAD/importCSG.py", line 752, in p_import_file1
    p[0] = [process_import_file(filen,ext,p[3]['layer'])]
  File "/Applications/FreeCAD 0.19.1.app/Contents/Resources/Mod/OpenSCAD/importCSG.py", line 770, in process_import_file
    obj=processDXF(fname,layer)
  File "/Applications/FreeCAD 0.19.1.app/Contents/Resources/Mod/OpenSCAD/importCSG.py", line 834, in processDXF
    face = importDXFface(filename,layer,doc)
  File "/Users/keithsloan/Library/Preferences/FreeCAD/Mod/OpenSCAD_Alt_Import/OpenSCAD2Dgeom.py", line 485, in importDXFface
    layers = importDXF.processdxf(doc,filename,False,False) or importDXF.layers
  File "/Applications/FreeCAD 0.19.1.app/Contents/Resources/Mod/Draft/importDXF.py", line 2212, in processdxf
    color = tuple(dxfColorMap.color_map[layer.color])
<class 'KeyError'>: -96
You are hitting a bug related to use of colours in the Draft workbench's DXF import routine ...Mod/Draft/importDXF.py
This importer is pretty much depreciated now as it has been replaced
Last edited by keithsloan52 on Tue May 11, 2021 8:04 am, edited 2 times in total.
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Have an Openscad to Freecad conundrum to solve

Post by keithsloan52 »

What software are you using to create the DXF file?

For the 'Insert Walls Cutter' layer the importer is accessing the layer.color and getting the value -96, which is causing the issue with Draft importDXF routine.

What colour is this layer set to in the DXF file?
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Have an Openscad to Freecad conundrum to solve

Post by keithsloan52 »

I installed freecad 0.19 at first but trying to install the dependencies of the openscad workbench became a tragedy. A failure. Fought hard to solve the issues that were indicated in the window below each failed attempt.
I REPEAT - THERE ARE NO DEPENDENCIES to install and your post does not show any window.
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Have an Openscad to Freecad conundrum to solve

Post by keithsloan52 »

I loaded you files into OpenSCAD and exported as a CSG which I attach here
InsertFRForFreecad.csg
(4.85 KiB) Downloaded 38 times
If you try and import this file you Don't even need to tell the Workbench where to find the OpenSCAD executable.
You will hit the bug that the Draft Workbench importDXF code that gets used and finds for the Walls layer a colour value of -96
which it does not know how to handle
Post Reply