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!
Yuri
Posts: 34
Joined: Sun May 09, 2021 1:14 am

Re: Have an Openscad to Freecad conundrum to solve

Post by Yuri »

I went back to 3 openscad files that were working to show you that it works correctly having as many layers as the one we are trying to decifer and now, they are not working.

I will cry a little and then work to get them back alive. When I do it if ever, I'll come back to show you guys.

It is hard for me to stump my intuition doing something that I see that is working. After doing this Doing 4 files or five with one layer each to run the openscad and get the part that I want to then import the part into freecad is just painfully, not difficult, just painful. Almost more than I can take.

Thank you all.
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Have an Openscad to Freecad conundrum to solve

Post by keithsloan52 »

Yuri wrote: Wed May 12, 2021 2:36 am I went back to 3 openscad files that were working to show you that it works correctly having as many layers as the one we are trying to decifer and now, they are not working.

I will cry a little and then work to get them back alive. When I do it if ever, I'll come back to show you guys.

It is hard for me to stump my intuition doing something that I see that is working. After doing this Doing 4 files or five with one layer each to run the openscad and get the part that I want to then import the part into freecad is just painfully, not difficult, just painful. Almost more than I can take.

Thank you all.
Just try extracting one layer 'Insert Walls', export with options set to R14.

Then let's test with a file that just imports what was the one layer.
Once we get something relatively simple working THEN is the time to add more layers, same file etc
It is VERY difficult to debug when a number of layers are being used.
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Have an Openscad to Freecad conundrum to solve

Post by keithsloan52 »

One thought. I don't know how much effort it would take, but wondering if one could make a quick test with the parts in each layer separated in the drawing. Rational: It look like when extracting a layer it first brings in the whole dxf file and then extracts the required layer, wondering if when it brings in the whole file and things are overlapping it causes problems. Just a thought.
Yuri
Posts: 34
Joined: Sun May 09, 2021 1:14 am

Re: Have an Openscad to Freecad conundrum to solve

Post by Yuri »

To test on whether QCad is producing dxf files correctly so that layer colors or other things are not involved in triggering errors I:
Created a dxf with no layers (and no specification of color) and an openscad with a parsed rotate extrude which is dependent in this dxf with a single object.

In 0.184. the file is processed completely with no consideration of the parsed rotate extrude (it shows the entire 360 degrees), however the report window says with everything in brackets below in red color:

import importCSG
>>> importCSG.open(u"C:/Users/Owner/Documents/FreeSpin/DrawingsFabrication/OpenScad3Dmodel/STLs/BaseWithFin/SandBoxTestSeparateDWFforLayers/TestOneLayerBase.scad")
>>> App.setActiveDocument("TestOneLayerBase")
>>> App.ActiveDocument=App.getDocument("TestOneLayerBase")
>>> Gui.ActiveDocument=Gui.getDocument("TestOneLayerBase")
>>> Gui.SendMsgToActiveView("ViewFit")

The (u is not in red as the exception.

In 0.192 the file is processed without errors shown with no consideration of the parsed rotate extrude (it shows the entire 360 degrees).

I did the same with a dxf having 1 layer and a different color in 0.184 and 0.192 and obtained the same result as above.

In addition, I implemented the changes in the importCSG.py suggested to rid of the problem with the parsed rotate extrude in 0.184 and it doesn't do anything. The part is not processed at all.

I need to further advance in these tests adding other layers and objects however, the issue of the parsed rotate extrude for my case is major so that someone could send to me an importCSG.py that accomplish the parsed rotate extrude if that is the only thing that is wrong. If there are additional .py file modifications that are needed, please send them as well.

I'll keep you posted about further tests.
Bance
Veteran
Posts: 4255
Joined: Wed Feb 11, 2015 3:00 pm
Location: London

Re: Have an Openscad to Freecad conundrum to solve

Post by Bance »

I admire the perseverance of you both, good luck in solving this. :D
Yuri
Posts: 34
Joined: Sun May 09, 2021 1:14 am

Re: Have an Openscad to Freecad conundrum to solve

Post by Yuri »

Things I did with one of my openscad model (at a point this one worked in 0.18 but never worked in 0.19) to overcome the issue of the unsuccessful retrieval by freecad:

I created one dxf 2d object in one layer-> created solid object in openscad with parsed rotate extrude->open the file from freecad 0.18 and 0.19. ->
succeeded as per previous post.

Added a layer with custom color in dxf. ->Succeeded as per previous post. (0.18 and 0.19)

Completed boolean. ->Succeeded as per previous post. (0.18 and 0.19)

Added layer with 2d object that intersects object in another object. ->Succeeded as per previous post. (0.18 and 0.19)

Added 2 more layers to the dxf and repeated the process above with each layer. ->Succeeded as per previous post. (0.18 and 0.19).

In the end, the file that I ended up with was identical to the one I started with. The new file works and the original doesn't in 0.184 and 0.192. I dug deep to see what the difference between both files is: I FOUND NOTHING DIFFERENT.

The good news is that I ended up with a file that works, the bad one is that I DO NOT KNOW WHAT IS WRONG and have to figure out the problem for some 6 parts more.

Please help me with an importCSG.py that accomplishes the parsed extrude and I will continue to try to solve this conundrum.
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Have an Openscad to Freecad conundrum to solve

Post by keithsloan52 »

Yuri wrote: Thu May 13, 2021 7:29 pm
In 0.184. the file is processed completely with no consideration of the parsed rotate extrude (it shows the entire 360 degrees), however the report window says with everything in brackets below in red color:

In 0.192 the file is processed without errors shown with no consideration of the parsed rotate extrude (it shows the entire 360 degrees).
Not sure but I think @chennes fixes went into 0.20 as 0.19 has been in feature freeze for quite a while. He did make the python modules available, we need to pm him to get him to point you at the latest.

I have tried to update my Alternate OpenSCAD importer with his updates, you could try that https://github.com/KeithSloan/OpenSCAD_Alt_Import
Install instructions are in the README. Just remember you have to do a File | Load which will cause a prompt of which importer to load.
If you share your scad and dxf files I can always test

Will pm Chris now
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Have an Openscad to Freecad conundrum to solve

Post by keithsloan52 »

Yuri wrote: Thu May 13, 2021 7:29 pm
In addition, I implemented the changes in the importCSG.py suggested to rid of the problem with the parsed rotate extrude in 0.184 and it doesn't do anything. The part is not processed at all.
Sounds like something is going wrong with your changes, try installer the Alternate Importer
User avatar
chennes
Veteran
Posts: 3910
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Have an Openscad to Freecad conundrum to solve

Post by chennes »

That's right -- all of the work I've done on the OpenSCAD WB is in the 0.20 dev cycle. However, since it's just a Python module, you can actually copy two files from the current development sources into the older 0.19 sources and get those changes now. The two files are these:

https://github.com/FreeCAD/FreeCAD/blob ... eatures.py
https://github.com/FreeCAD/FreeCAD/blob ... portCSG.py

(If you are not familiar with GitHub: click the "Raw" button at the top of the source code listing to get the bare python file without the HTML wrapper around it, then save that to the path shown at the top of the page I linked t, relative to your FreeCAD installation)
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
Yuri
Posts: 34
Joined: Sun May 09, 2021 1:14 am

Re: Have an Openscad to Freecad conundrum to solve

Post by Yuri »

A step forward at this time is that I found that when the visibility of any layer is toggled off in the dxf that is referred to by the openscad, in 0.192, the retrieval fails. It succeeds when on.

The link to the alternate openscad import is already there in the 0.192 version and is being updated when I load freecad, however. the parsed rotate extrude fails. It always shows 360 degrees.

My 3 simpler files, which were working before in 0.18 are now working in 0.192, even when I have a lot of lines in layers not being used by toggling visibility on.

It is of note that the warnings below still occur:

12:48:14 Load Parser
12:48:14 WARNING: Token 'DOT' defined, but not used
12:48:14 WARNING: Token 'WORD' defined, but not used
12:48:14 WARNING: There are 2 unused tokens
12:48:14 WARNING: Couldn't create 'parsetab'. [Errno 13] Permission denied: 'C:\\Program Files\\FreeCAD 0.19\\Mod\\OpenSCAD\\parsetab.py'
12:48:14 Parser Loaded

The remainder parts, which are more complicated are not working and this includes that I originally sent to you all.
So... No parsed rotate extrude in working form and I will see what I can do with the rest of the parts. I still need to be pointed to the latest or do something else to enable rotate extrude with an angle.
Post Reply