discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Fwd: Re: SolidWorks & OpenSCAD interoperability

KS
Keith Sloan
Wed, Nov 16, 2022 8:56 AM

[OpenSCAD] Re: SolidWorks & OpenSCAD interoperability

The FreeCAD OpenSCAD workbench and the Alternate importer
https://github.com/KeithSloan/OpenSCAD_Alt_Import

Work by either importing a CSG file or creating a CSG from a SCAD file
under the covers, for the later the workbench needs to be
told where to find the OpenSCAD executable.

As the CSG file is a minimum scripting language to create CSG objects
the FreeCAD import parses the file with a python
library for Lex/Yacc, FreeCAD objects are then created for the language
statements, so for Cube a FreeCAD box is create etc.
i.e. Brep representation.

You can then export as STEP which can then be imported into SolidWorks,
use FreeCAD Path Workbench etc.

The two OpenSCAD statements that cannot be handled directly in this
manner are Hull and Minkowski as there
is no direct Brep equivalent. When the parser finds such statements on
the stack it converts the relevant objects on the stack
to a Mesh form and calls the OpenSCAD executable to perform the Hull or
Minkowski request and output a Mesh/STL file
that the importer then deals with as a Mesh. So if you are wanting to
design models in OpenSCAD  for use in Solidworks
try and avoid Hull and Minkowski.

The Alternate importer tries to handle certain Hull and Minkowski
requests, so two parallel cylinders. Minkowski requests
where one object is a sphere as used to create a fillet but otherwise
drops back to handling them the same way as the
standard importer.

I have suggested that more could be done if the OpenSCAD language could
be expanded to add user information to a CSG file.
i.e. So that an OpenSCAD macro/library could add extra info to the CSG
file that the importer could deal with but Paul Torsen
did not warm to the idea. For example if such an enhancement was
implemented by OpenSCAD a library that implemented
a thread in OpenSCAD could also output to the CSG file, info about the
thread before executing its OpenSCAD statements
and again after, to indicate it had ended. The FreeCAD importer could
detect the request to create a thread, use the FreeCAD
thread making facility and ignore any subseqent CSG statement till it
got to the one indicating the end of thread request,

It is also possible to load and edit OpenSCAD scripts directly in the
FreeCAD workbench (probably only workable with
smallish scripts). A Google GSOC project was suggested to improve it see
https://github.com/opencax/GSoC/issues/62
but nobody took up the idea.

--
========== Art & Ceramics ===========
https://www.instagram.com/ksloan1952/

[OpenSCAD] Re: SolidWorks & OpenSCAD interoperability The FreeCAD OpenSCAD workbench and the Alternate importer https://github.com/KeithSloan/OpenSCAD_Alt_Import Work by either importing a CSG file or creating a CSG from a SCAD file under the covers, for the later the workbench needs to be told where to find the OpenSCAD executable. As the CSG file is a minimum scripting language to create CSG objects the FreeCAD import parses the file with a python library for Lex/Yacc, FreeCAD objects are then created for the language statements, so for Cube a FreeCAD box is create etc. i.e. Brep representation. You can then export as STEP which can then be imported into SolidWorks, use FreeCAD Path Workbench etc. The two OpenSCAD statements that cannot be handled directly in this manner are Hull and Minkowski as there is no direct Brep equivalent. When the parser finds such statements on the stack it converts the relevant objects on the stack to a Mesh form and calls the OpenSCAD executable to perform the Hull or Minkowski request and output a Mesh/STL file that the importer then deals with as a Mesh. So if you are wanting to design models in OpenSCAD  for use in Solidworks try and avoid Hull and Minkowski. The Alternate importer tries to handle certain Hull and Minkowski requests, so two parallel cylinders. Minkowski requests where one object is a sphere as used to create a fillet but otherwise drops back to handling them the same way as the standard importer. I have suggested that more could be done if the OpenSCAD language could be expanded to add user information to a CSG file. i.e. So that an OpenSCAD macro/library could add extra info to the CSG file that the importer could deal with but Paul Torsen did not warm to the idea. For example if such an enhancement was implemented by OpenSCAD a library that implemented a thread in OpenSCAD could also output to the CSG file, info about the thread before executing its OpenSCAD statements and again after, to indicate it had ended. The FreeCAD importer could detect the request to create a thread, use the FreeCAD thread making facility and ignore any subseqent CSG statement till it got to the one indicating the end of thread request, It is also possible to load and edit OpenSCAD scripts directly in the FreeCAD workbench (probably only workable with smallish scripts). A Google GSOC project was suggested to improve it see https://github.com/opencax/GSoC/issues/62 but nobody took up the idea. -- ========== Art & Ceramics =========== https://www.instagram.com/ksloan1952/
N
neri-engineering
Wed, Nov 16, 2022 7:21 PM

Bingo.

I used the OpenSCAD Workbench in FreeCAD, loaded my SCAD file, and generated a STEP file.  The guys at job shop loved it, and now they think I'm a wizard.  They can do everything as usual within SolidWorks.

There are two problems that I will encounter, as you alluded to.

First problem is with threads.  I generate my own polyhedron().

Second problem is bevel gear teeth.  I also generate by own polyhedron().

To get around this, they have requested that for the thread I include the major diameter for screws, and minor diameter for threaded hole.  They then "cut it" using their tool.

For teeth, they requested that I include the shape that is pre-tooth-cuts.  This also makes sense.  So for example my bevel gears have spherical-shaped stumps, so I need to just give them the spherical shell before the teeth are cut.  Maybe I can add some markings or indents that show more clearly where the teeth start.

Results of using FreeCAD in combination with OpenSCAD look very promising.  I won't abandon OpenSCAD.  Absolutely wonderful tool it is.

Sent with Proton Mail secure email.

------- Original Message -------
On Wednesday, November 16th, 2022 at 2:56 AM, Keith Sloan keith@sloan-home.co.uk wrote:

[OpenSCAD] Re: SolidWorks & OpenSCAD interoperability

The FreeCAD OpenSCAD workbench and the Alternate importer
https://github.com/KeithSloan/OpenSCAD_Alt_Import

Work by either importing a CSG file or creating a CSG from a SCAD file
under the covers, for the later the workbench needs to be
told where to find the OpenSCAD executable.

As the CSG file is a minimum scripting language to create CSG objects
the FreeCAD import parses the file with a python
library for Lex/Yacc, FreeCAD objects are then created for the language
statements, so for Cube a FreeCAD box is create etc.
i.e. Brep representation.

You can then export as STEP which can then be imported into SolidWorks,
use FreeCAD Path Workbench etc.

The two OpenSCAD statements that cannot be handled directly in this
manner are Hull and Minkowski as there
is no direct Brep equivalent. When the parser finds such statements on
the stack it converts the relevant objects on the stack
to a Mesh form and calls the OpenSCAD executable to perform the Hull or
Minkowski request and output a Mesh/STL file
that the importer then deals with as a Mesh. So if you are wanting to
design models in OpenSCAD for use in Solidworks
try and avoid Hull and Minkowski.

The Alternate importer tries to handle certain Hull and Minkowski
requests, so two parallel cylinders. Minkowski requests
where one object is a sphere as used to create a fillet but otherwise
drops back to handling them the same way as the
standard importer.

I have suggested that more could be done if the OpenSCAD language could
be expanded to add user information to a CSG file.
i.e. So that an OpenSCAD macro/library could add extra info to the CSG
file that the importer could deal with but Paul Torsen
did not warm to the idea. For example if such an enhancement was
implemented by OpenSCAD a library that implemented
a thread in OpenSCAD could also output to the CSG file, info about the
thread before executing its OpenSCAD statements
and again after, to indicate it had ended. The FreeCAD importer could
detect the request to create a thread, use the FreeCAD
thread making facility and ignore any subseqent CSG statement till it
got to the one indicating the end of thread request,

It is also possible to load and edit OpenSCAD scripts directly in the
FreeCAD workbench (probably only workable with
smallish scripts). A Google GSOC project was suggested to improve it see
https://github.com/opencax/GSoC/issues/62
but nobody took up the idea.

--
========== Art & Ceramics ===========
https://www.instagram.com/ksloan1952/


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Bingo. I used the OpenSCAD Workbench in FreeCAD, loaded my SCAD file, and generated a STEP file. The guys at job shop loved it, and now they think I'm a wizard. They can do everything as usual within SolidWorks. There are two problems that I will encounter, as you alluded to. First problem is with threads. I generate my own polyhedron(). Second problem is bevel gear teeth. I also generate by own polyhedron(). To get around this, they have requested that for the thread I include the major diameter for screws, and minor diameter for threaded hole. They then "cut it" using their tool. For teeth, they requested that I include the shape that is pre-tooth-cuts. This also makes sense. So for example my bevel gears have spherical-shaped stumps, so I need to just give them the spherical shell before the teeth are cut. Maybe I can add some markings or indents that show more clearly where the teeth start. Results of using FreeCAD in combination with OpenSCAD look very promising. I won't abandon OpenSCAD. Absolutely wonderful tool it is. Sent with Proton Mail secure email. ------- Original Message ------- On Wednesday, November 16th, 2022 at 2:56 AM, Keith Sloan <keith@sloan-home.co.uk> wrote: > [OpenSCAD] Re: SolidWorks & OpenSCAD interoperability > > The FreeCAD OpenSCAD workbench and the Alternate importer > https://github.com/KeithSloan/OpenSCAD_Alt_Import > > Work by either importing a CSG file or creating a CSG from a SCAD file > under the covers, for the later the workbench needs to be > told where to find the OpenSCAD executable. > > As the CSG file is a minimum scripting language to create CSG objects > the FreeCAD import parses the file with a python > library for Lex/Yacc, FreeCAD objects are then created for the language > statements, so for Cube a FreeCAD box is create etc. > i.e. Brep representation. > > You can then export as STEP which can then be imported into SolidWorks, > use FreeCAD Path Workbench etc. > > The two OpenSCAD statements that cannot be handled directly in this > manner are Hull and Minkowski as there > is no direct Brep equivalent. When the parser finds such statements on > the stack it converts the relevant objects on the stack > to a Mesh form and calls the OpenSCAD executable to perform the Hull or > Minkowski request and output a Mesh/STL file > that the importer then deals with as a Mesh. So if you are wanting to > design models in OpenSCAD for use in Solidworks > try and avoid Hull and Minkowski. > > The Alternate importer tries to handle certain Hull and Minkowski > requests, so two parallel cylinders. Minkowski requests > where one object is a sphere as used to create a fillet but otherwise > drops back to handling them the same way as the > standard importer. > > I have suggested that more could be done if the OpenSCAD language could > be expanded to add user information to a CSG file. > i.e. So that an OpenSCAD macro/library could add extra info to the CSG > file that the importer could deal with but Paul Torsen > did not warm to the idea. For example if such an enhancement was > implemented by OpenSCAD a library that implemented > a thread in OpenSCAD could also output to the CSG file, info about the > thread before executing its OpenSCAD statements > and again after, to indicate it had ended. The FreeCAD importer could > detect the request to create a thread, use the FreeCAD > thread making facility and ignore any subseqent CSG statement till it > got to the one indicating the end of thread request, > > It is also possible to load and edit OpenSCAD scripts directly in the > FreeCAD workbench (probably only workable with > smallish scripts). A Google GSOC project was suggested to improve it see > https://github.com/opencax/GSoC/issues/62 > but nobody took up the idea. > > > -- > ========== Art & Ceramics =========== > https://www.instagram.com/ksloan1952/ > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
SP
Sanjeev Prabhakar
Thu, Nov 17, 2022 12:00 AM

Thanks for your work.

I tried this simple file with 1 polyhedron.

It seems to take a longtime and not loading element.

Can you suggest how to convert this

On Wed, 16 Nov 2022 at 14:27, Keith Sloan keith@sloan-home.co.uk wrote:

[OpenSCAD] Re: SolidWorks & OpenSCAD interoperability

The FreeCAD OpenSCAD workbench and the Alternate importer
https://github.com/KeithSloan/OpenSCAD_Alt_Import

Work by either importing a CSG file or creating a CSG from a SCAD file
under the covers, for the later the workbench needs to be
told where to find the OpenSCAD executable.

As the CSG file is a minimum scripting language to create CSG objects
the FreeCAD import parses the file with a python
library for Lex/Yacc, FreeCAD objects are then created for the language
statements, so for Cube a FreeCAD box is create etc.
i.e. Brep representation.

You can then export as STEP which can then be imported into SolidWorks,
use FreeCAD Path Workbench etc.

The two OpenSCAD statements that cannot be handled directly in this
manner are Hull and Minkowski as there
is no direct Brep equivalent. When the parser finds such statements on
the stack it converts the relevant objects on the stack
to a Mesh form and calls the OpenSCAD executable to perform the Hull or
Minkowski request and output a Mesh/STL file
that the importer then deals with as a Mesh. So if you are wanting to
design models in OpenSCAD  for use in Solidworks
try and avoid Hull and Minkowski.

The Alternate importer tries to handle certain Hull and Minkowski
requests, so two parallel cylinders. Minkowski requests
where one object is a sphere as used to create a fillet but otherwise
drops back to handling them the same way as the
standard importer.

I have suggested that more could be done if the OpenSCAD language could
be expanded to add user information to a CSG file.
i.e. So that an OpenSCAD macro/library could add extra info to the CSG
file that the importer could deal with but Paul Torsen
did not warm to the idea. For example if such an enhancement was
implemented by OpenSCAD a library that implemented
a thread in OpenSCAD could also output to the CSG file, info about the
thread before executing its OpenSCAD statements
and again after, to indicate it had ended. The FreeCAD importer could
detect the request to create a thread, use the FreeCAD
thread making facility and ignore any subseqent CSG statement till it
got to the one indicating the end of thread request,

It is also possible to load and edit OpenSCAD scripts directly in the
FreeCAD workbench (probably only workable with
smallish scripts). A Google GSOC project was suggested to improve it see
https://github.com/opencax/GSoC/issues/62
but nobody took up the idea.

--
========== Art & Ceramics ===========
https://www.instagram.com/ksloan1952/


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Thanks for your work. I tried this simple file with 1 polyhedron. It seems to take a longtime and not loading element. Can you suggest how to convert this On Wed, 16 Nov 2022 at 14:27, Keith Sloan <keith@sloan-home.co.uk> wrote: > [OpenSCAD] Re: SolidWorks & OpenSCAD interoperability > > The FreeCAD OpenSCAD workbench and the Alternate importer > https://github.com/KeithSloan/OpenSCAD_Alt_Import > > Work by either importing a CSG file or creating a CSG from a SCAD file > under the covers, for the later the workbench needs to be > told where to find the OpenSCAD executable. > > As the CSG file is a minimum scripting language to create CSG objects > the FreeCAD import parses the file with a python > library for Lex/Yacc, FreeCAD objects are then created for the language > statements, so for Cube a FreeCAD box is create etc. > i.e. Brep representation. > > You can then export as STEP which can then be imported into SolidWorks, > use FreeCAD Path Workbench etc. > > The two OpenSCAD statements that cannot be handled directly in this > manner are Hull and Minkowski as there > is no direct Brep equivalent. When the parser finds such statements on > the stack it converts the relevant objects on the stack > to a Mesh form and calls the OpenSCAD executable to perform the Hull or > Minkowski request and output a Mesh/STL file > that the importer then deals with as a Mesh. So if you are wanting to > design models in OpenSCAD for use in Solidworks > try and avoid Hull and Minkowski. > > The Alternate importer tries to handle certain Hull and Minkowski > requests, so two parallel cylinders. Minkowski requests > where one object is a sphere as used to create a fillet but otherwise > drops back to handling them the same way as the > standard importer. > > I have suggested that more could be done if the OpenSCAD language could > be expanded to add user information to a CSG file. > i.e. So that an OpenSCAD macro/library could add extra info to the CSG > file that the importer could deal with but Paul Torsen > did not warm to the idea. For example if such an enhancement was > implemented by OpenSCAD a library that implemented > a thread in OpenSCAD could also output to the CSG file, info about the > thread before executing its OpenSCAD statements > and again after, to indicate it had ended. The FreeCAD importer could > detect the request to create a thread, use the FreeCAD > thread making facility and ignore any subseqent CSG statement till it > got to the one indicating the end of thread request, > > It is also possible to load and edit OpenSCAD scripts directly in the > FreeCAD workbench (probably only workable with > smallish scripts). A Google GSOC project was suggested to improve it see > https://github.com/opencax/GSoC/issues/62 > but nobody took up the idea. > > > -- > ========== Art & Ceramics =========== > https://www.instagram.com/ksloan1952/ > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >