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

Have an Openscad to Freecad conundrum to solve [solved]

Postby Yuri » Sun May 09, 2021 1:35 am

Hi. There isn't much more than the subject to this post.
At the moment I have 3 parts in Openscad that I want to convert into a csg solid in freecad so that I can produce step files.
I have been unable to do it myself and I'm not into becoming proficient in 3d modelling. I just developed an assembly of parts and may develop some more in the near future. The parts are relatively simple, yet difficult for my level of skill to import them into Freecad and do any processing from there. I have been able to produce stls to export them into step files but the files become too large hindering some precision and practical exchange of information.
Last edited by Yuri on Mon May 24, 2021 2:12 am, edited 1 time in total.
jmaustpc
Posts: 11040
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Have an Openscad to Freecad conundrum to solve

Postby jmaustpc » Sun May 09, 2021 2:27 am

Moved to Help forum.
Yuri wrote: Sun May 09, 2021 1:35 am I have 3 parts in Openscad that I want to convert into a csg solid in freecad so that I can produce step files.
So just do it, FreeCAD supports Opencascade native format BREP, hardly surprising since FreeCAD is based on Opencascade.

Stl is a ridiculous format to use unless you need it for a specific reason. It is a lossy output format not an exchange format, since it is a mesh not a solid, you loose all curves data, forget STL.

Open FreeCAD, if you go file menu OPEN then each file will be opened in a different FreeCAD file, however if you already have a FreeCAD file and go File menu Import, then it will be imported into the same FreeCAD file.

Once in the same file, go to Part Workbench select what you want and do the Boolean, if you need to first move the objects by adjusting their Placement properties.

To get a STEP file, just first select just the one thing in treeview, in this case the result of the Boolean, the go File menu Export

It is that simple.
adrianinsaval
Posts: 443
Joined: Thu Apr 05, 2018 5:15 pm

Re: Have an Openscad to Freecad conundrum to solve

Postby adrianinsaval » Sun May 09, 2021 2:05 pm

Note that he's talking about openscad not opencascade,try the openscad workbench in freecad you can get the shapes from your openscad script in freecad with that. If you really want your model redone in freecad as a paid job hit me with a pm.
keithsloan52
Posts: 1915
Joined: Mon Feb 27, 2012 5:31 pm

Re: Have an Openscad to Freecad conundrum to solve

Postby keithsloan52 » Sun May 09, 2021 4:08 pm

Yuri wrote: Sun May 09, 2021 1:35 am Hi. There isn't much more than the subject to this post.
At the moment I have 3 parts in Openscad that I want to convert into a csg solid in freecad so that I can produce step files.
I have been unable to do it myself and I'm not into becoming proficient in 3d modelling. I just developed an assembly of parts and may develop some more in the near future. The parts are relatively simple, yet difficult for my level of skill to import them into Freecad and do any processing from there. I have been able to produce stls to export them into step files but the files become too large hindering some precision and practical exchange of information.
You should be able to open your scad files with FreeCAD. It will invoke the OpenSCAD importer.
You should then be able to export to STEP.

Note: There are options to control the STEP export in the FreeCAD preferences

If you have problems loading your OpenSCAD scad file, try posting copies of them here.
The parts are relatively simple, yet difficult for my level of skill to import them into Freecad and do any processing from there
Are you not sure you are having problems with Assembly - What Assembly workbench are you using?

One option if you are confused with how to deal with multiple imported scad files is to
For each of your three scad files
  • Open in FreeCAD
  • Export as Step
Then use assembly to combine the three step files and export as a single STEP file.
It may help at this stage to set the FreeCAD preference to import a STEP file as a single object (Combine)
You would then just have three shapes to deal with when assembling.

Do your OpenSCAD files use Hull and or Minkowski operations? I would try and avoid these as they end up creating Meshes, which you want to try and avoid.
keithsloan52
Posts: 1915
Joined: Mon Feb 27, 2012 5:31 pm

Re: Have an Openscad to Freecad conundrum to solve

Postby keithsloan52 » Sun May 09, 2021 8:29 pm

Note: There appears to be a problem with STEP export with the development version 0.20
https://forum.freecadweb.org/viewtopic.php?f=3&t=58403
Yuri
Posts: 34
Joined: Sun May 09, 2021 1:14 am

Re: Have an Openscad to Freecad conundrum to solve

Postby Yuri » Mon May 10, 2021 12:25 am

I spent some 45 minutes writing all the background to this post. The system timed me out and I lost everything.

It seems that my post was to some extent unclear. My assembly is the final outcome in the physical world but I'm not trying to build an assembly in the freecad environment.

My workflow was supposed to be openscad csg -> freecad csg - >step. The openscad part went just fine. There is a long story about the next steps but it is not that I didn't try very very hard. the freecad workflow was supposed to be freecad openscad workbench -> process as demonstrated in videos csg -> step. After lots of work including trying to groom opens cad files to make them readable to freecad I managed to process 2 very simple files. The grooming resolved some issues. A side outgrow of all of that work and don't underestimate this "a lot" is that I've been forced to working in FC 0.184 because I could not install the dependencies of the openscad workbench. It wasn't a stint that I did to this end goal. Anyhow, the last thing is that I tried to overcome the issue that the parsed rotate extrude of openscad is not understood by freecad. Modified the importCSG.py as indicated by FC skilled developers and couldn't get it to work. It just doesn't do it because it doesn't want to do it. You may be tempted to offer instructions on how to enable the dependencies of the openscad workbench or additional instructions on how to enable the parsed rotate extrude, however, the instructions are out there, I'm just not capable.

So, I'm not blaming anybody, I just want to get accomplished and I'm grateful that freecad is there for the assist. I could have used an expensive 3d modeller and would be having a myriad of other issues. I even want to help.

So, I came to this site to pay someone to do it for me.

I'm a self employed engineer who has above average mathematical skill and a bit of an understanding of the mathematical challenges of 3d modeling of curved surfaces. I was for a very short period of time a pen draftsman but have no intention to learn computer 3d cad modeling. I'm too old for that. 56...

Attached are 2 files, a dxf and a parametric openscad model which depends on the dxf. It was successfully groomed to deal with some issues that occurred upon freecad retrieval. The openscad has a simple algorithm that depends on the rotate_extrude(angle = xx, etc ) of openscad.

My goal is to have the openscad csg -> freecad csg - >step process so that I can change my parameters and have the thing manufactured. We can start by just having the one in the files attached done. My code, you'll probably find naive, but hell, it is doing what I want.

https://drive.google.com/file/d/1D-OQ3Q ... sp=sharing
https://drive.google.com/file/d/1D-OQ3Q ... sp=sharing
adrianinsaval
Posts: 443
Joined: Thu Apr 05, 2018 5:15 pm

Re: Have an Openscad to Freecad conundrum to solve

Postby adrianinsaval » Mon May 10, 2021 12:36 am

Hi, you posted the same link twice, the openscad file is missing
jmaustpc
Posts: 11040
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Have an Openscad to Freecad conundrum to solve

Postby jmaustpc » Mon May 10, 2021 1:33 am

Sorry, I miss read your first post as OpenCasCade rather than OpenSCAD. :oops:

As Keith said above, there seems to be an issue with STEP import/export in any FreeCAD compiled against OCC 7.5.1 which means on Windows (and presumably Mac) an older FreeCAD may work if it was compiled against an old Windows Lib pack with an older OCC. Here on Kubuntu Linux all my FreeCAD versions are compiled against my system wide version of OpenCAsCade. Which would seem to indicate that the regression bug may be in OpenCascade which FreeCAD uses rather than FreeCAD itself, not that the distinction would help you exactly, except to say that you may be able to find a newer version of FreeCAD compiled against an older lib pack if you are on Windows.

Regarding the Jobs forum, we have had a lot of problems with it attracting scammers/spam/very doubtful responses etc., so be careful and be aware that we do not have any mechanism to asses the legitimacy of any advertisers or response.
keithsloan52
Posts: 1915
Joined: Mon Feb 27, 2012 5:31 pm

Re: Have an Openscad to Freecad conundrum to solve

Postby keithsloan52 » Mon May 10, 2021 5:13 am

Yuri wrote: Mon May 10, 2021 12:25 am I spent some 45 minutes writing all the background to this post. The system timed me out and I lost everything.

It seems that my post was to some extent unclear. My assembly is the final outcome in the physical world but I'm not trying to build an assembly in the freecad environment.

My workflow was supposed to be openscad csg -> freecad csg - >step. The openscad part went just fine. There is a long story about the next steps but it is not that I didn't try very very hard. the freecad workflow was supposed to be freecad openscad workbench -> process as demonstrated in videos csg -> step. After lots of work including trying to groom opens cad files to make them readable to freecad I managed to process 2 very simple files. The grooming resolved some issues. A side outgrow of all of that work and don't underestimate this "a lot" is that I've been forced to working in FC 0.184 because I could not install the dependencies of the openscad workbench. It wasn't a stint that I did to this end goal. Anyhow, the last thing is that I tried to overcome the issue that the parsed rotate extrude of openscad is not understood by freecad. Modified the importCSG.py as indicated by FC skilled developers and couldn't get it to work. It just doesn't do it because it doesn't want to do it. You may be tempted to offer instructions on how to enable the dependencies of the openscad workbench or additional instructions on how to enable the parsed rotate extrude, however, the instructions are out there, I'm just not capable.

So, I'm not blaming anybody, I just want to get accomplished and I'm grateful that freecad is there for the assist. I could have used an expensive 3d modeller and would be having a myriad of other issues. I even want to help.

So, I came to this site to pay someone to do it for me.

I'm a self employed engineer who has above average mathematical skill and a bit of an understanding of the mathematical challenges of 3d modeling of curved surfaces. I was for a very short period of time a pen draftsman but have no intention to learn computer 3d cad modeling. I'm too old for that. 56...

Attached are 2 files, a dxf and a parametric openscad model which depends on the dxf. It was successfully groomed to deal with some issues that occurred upon freecad retrieval. The openscad has a simple algorithm that depends on the rotate_extrude(angle = xx, etc ) of openscad.

My goal is to have the openscad csg -> freecad csg - >step process so that I can change my parameters and have the thing manufactured. We can start by just having the one in the files attached done. My code, you'll probably find naive, but hell, it is doing what I want.

https://drive.google.com/file/d/1D-OQ3Q ... sp=sharing
https://drive.google.com/file/d/1D-OQ3Q ... sp=sharing
Have to say I am nearly totally lost on this and don't understand what or why you are having problems.

Your two google drive links are the same and just point to one dxf file insert.dxf,
Insert.dxf
(134.28 KiB) Downloaded 27 times
Perhaps when you make the other dxf file and the scad file available we can work out what you are trying to do and why you are having problems.

@chennes Has been fixing some problems with OpenSCAD and rotate_extrude so your problems may relate to using an old version of the OpenSCAD workbench, so I strongly recommend that you post details of your FreeCAD version, see forum details for how to do this.
keithsloan52
Posts: 1915
Joined: Mon Feb 27, 2012 5:31 pm

Re: Have an Openscad to Freecad conundrum to solve

Postby keithsloan52 » Mon May 10, 2021 5:23 am

Yuri wrote: Mon May 10, 2021 12:25 am A side outgrow of all of that work and don't underestimate this "a lot" is that I've been forced to working in FC 0.184 because I could not install the dependencies of the openscad workbench. It wasn't a stint that I did to this end goal.
There are no dependencies in the openscad workbench other than install OpenSCAD and point an OpenSCAD workbench preference to its location. This is the same for all FreeCAD versions since FC 0.13 when the workbench was introduced and has not changed.