Programmatic 2D and 3D CAD and modeling

@Desertlap was taken by OpenSCAD, so thought we would set up a thread for discussing it and similar programs.

Previously, I’d noted my use of BlockSCAD/OpenSCAD at:

https://forum.tabletpc.review/t/made-a-box/535/6

and this is a sort of modeling/work I find fits well — but it’s kind of awkward the limitations which my work has run in to and I’m looking for alternatives, so suggestions would be welcome.

First, a list of some of the more notable projects along these lines:

2D:

  • Processing — https://processing.org/ — “…a flexible software sketchbook and a language for learning how to code within the context of the visual arts.”, based on JavaScript, there’s a Python wrapper which has an entire book on it
  • NodeBox — https://www.nodebox.net/ — “Cross-platform, node-based GUI for efficient data visualizations and generative design.”

There are also TikZ, METAPOST, and Asymptote, and lots of others, including direct programming/coding in SVG or PostScript

3D:

  • OpenSCAD — https://openscad.org/ — " The Programmers Solid 3D CAD Modeller", this was forked from/inspired by Art of Illusion and has many programs which follow after it w/ various variations
  • BlockSCAD — https://www.blockscad3d.com/ — the application of the Blockly programming system to OpenSCAD, I find this a nice way to sort of draw up a 3D model using a stylus
  • Ryven and PythonOCC — one of the many Python tools, this is the most graphical and interactive, if one finds the Ryven Node Editor of interest, and if the 3D modeling afforded by PythonOCC are workable
  • Moment of Inspiration — a commercial program apparently originally designed for use w/ a stylus, there is a node editor available for it which allows programmatic creation
  • Blender — the opensource tool for 3D modeling, there are a number of node editors and programming systems available for it
  • FreeCAD — an opensource 3D CAD tool, it can be scripted in Python and there are a number of different ways to interact w/ it, including a workbench which allows using the PureData visual programming system

Not a programming tool, but a parametric 3D modeler, some folks may want to consider/look into SolveSpace: https://solvespace.com/

That said, I mostly use Carbide Create because I work for the company.

If I could have the perfect program it would:

  • allow programming using a visual system as BlockSCAD does
  • allow writing out text files as Processing and NodeBox allow
  • have the option of interacting directly and visually as FreeCAD does
  • be as easy to install as SolveSpace

I’ve pretty much decided that my next effort is going to be to write a Python program which will write out OpenSCAD files for a 3D preview, and export to the .json file format which Carbide Create uses and/or G-code — unless someone has a better suggestion.

1 Like

@WillAdams I actually suggested OpenSCAD to one of our customers yesterday. My question to you, for both of us is would it possible to point to resources to learn what can be a daunting new product? I have some experience with AutoCad, though I consider myself far closer to newbie than even competent in it :slight_smile: and thus am hesitant to provide more than the most basic things to him to get started.

Thanks in advance !

I bought a book recently:

(mostly to support the project — read through it and then gave it to a co-worker’s son)

and as I’ve noted, mostly I use BlockSCAD, and my usage is kind of weird because I am specifically trying to cut things out using a 3D CNC router, mostly by modeling the tool movement, which is mostly something I’ve been able to puzzle out.

The OpenSCAD folks have a list of books:

https://openscad.org/documentation-books.html

The big thing is, it’s programming, so one can do things which one can describe mathematically which are a describable using its basic structures (cones, rectangles, spheres) or which one can describe mathematically (there is a polygon feature which I find mystifying, but which folks have been able to use to create remarkable things), so one’s ability at math and/or logic will be the factor which determines what can and can’t be made.

Things to remember:

  • it’s a functional language, so no reassignment outside of looping constructs
  • there are variables, arrays, and most programming structures, including loops
  • one can make modules and re-use them — modules can make either a 3D object, or return a variable, and it’s often useful to use those two features in concert

If you’d provide an example project I’d be glad to try to work out at least one approach to modeling it, so long as it’s simple enough for my feeble grasp at math (I have one joint design which is getting into conic sections and which I still haven’t managed to work out the mathematics of cutting it out yet).

1 Like

@WillAdams once again you have gone above and beyond in your answer. :smile:

I have at least the fundamentals in programming languages and the customer is an old hand at C++ and python so that book looks to be a great place to start for both of us.

And did I mention how much I dislike AutoCad…

I have resisted, and been warning folks against the siren call of Autodesk offering their Fusion 360 product “for free” pretty much since they first offered it.

At one of the points where they took away easy access to free licenses, my comment was:

Translation:

We have extracted all the beta-testing which we wanted for free out of naïve users and are now taking our game over to the other field where we can charge admission.

the balance of their business practices are no better, but I would need to be liquored up to go more in depth.

There’s actually been an almost endless parade of Python tools in this space:

https://web.archive.org/web/20211127014103/http://wiki.shapeoko.com/index.php/Programming#Python

(you may find the balance of that page of interest — lots of other tools in this space using lots of other programming languages)

but really, OpenSCAD’s popularity is well-deserved and it works well for the problem space of:

  • describable mathematically/programmatically
  • exportable to 3D as STL
    • OR
  • exportable to 2D as one or more planar intersections using DXF or SVG — if one can accept polylines

I mainly use Fusion 360, Rhino, and Blender.

I’ve tried OpenSCAD briefly but given that I’m usually working on collaborative files it just hasn’t been worthwhile.

BlenderCAD is looking pretty good and I’m loving where Blender as a whole is going.

FreeCAD is brilliant, but the amount of time you need to invest just to get the UI usable is nuts.
Still fantastic and has great potential, hopefully it grows as much as Blender has (shoutout to Blender nCNC).
i need to delve into the CAM and Sheet Metal of FreeCAD more as it could possibly get me away from Fusion.
However the current time investment is a major limiting factor at the moment.

I’ve tried MoI briefly, it’s great, but again, time.
Can’t learn them all.

Most of the FOSS software is what I use for fun when I have time, the majority of my work is invested in proprietary pipelines and will only get worst with SolidWorks, Inventor, and others slowly appearing in my future.

Shoutout for Alibre as another option too.

Carbide Create is nifty - I’ve used it briefly but found it after we had already an established workflow.
The Carbide Create videos on YouTube are fantastic.

I use RhinoCAM quite frequently but I find the workflow a lot more simplified than what I can achieve in Fusion with a lot more crashing and hanging. Whether that’s a Rhino or the PC build issue, I don’t know.

Unfortunately Fusion 360 scratches several itches for CAD, CAM, Sheet Metal, accessibility, and collaboration.
I still frequently look around for alternatives, but there are some things you just need to grin and bare at times.

It would be nice if there was a reasonable way to use AutoCAD collaboratively w/ folks accustomed to traditional CAD — even some sort of simplified mode where a project was shown as splines and nodes and they could be dragged around interactively, updating the coordinates in the code.

Blender and its add-ons is a universe to itself ---- mystified by your referring to a moribund plug-in which refers folks to: GitHub - vilemduha/blendercam: Automatically exported from code.google.com/p/blendercam

I also found a constraining sketcher for it which seems to have a lot of energy and enthusiasm, including a Discord:

We sell Alibre, and I’d like to use it, but the version which we sell is Atom3D and lacks scripting, and trying to do parametric design in it was clunky (though that may have been my limited understanding of the program), and I was rather put-off when it took the better part of a year for someone on the forum to explain that my problem w/ the spline tool was caused by a but in the program which required me to delete the preferences in order to get it working again.

The thing that kills me is, there are so many different programs, and there’s always one feature I like, but there’s no program which has enough of the features which I need to work the way that I wish to in an elegant fashion.

As noted above, I’ve been looking into working up a program which will:

  • afford an interface for a user to adjust the parameters of a design much like the OpenSCAD Customizer
  • write out an OpenSCAD file as a 3D preview
  • write out a matching Carbide Create file w/ toolpaths (apparently this uses a JSON format)
  • (optionally) write out a G-code file for cutting the file out

but it’s been slow going, mostly because I’d like to find a better solution.

I have competence in about 12 different 3D CAD packages from career and hobby. I find Blender to be the most confounding when it comes to UI. For example, it took me days of watching vids and googling to finally figure out how to @#$#$%% parent an armature to a mesh. And it was simply because I had the mouse cursor located in the wrong panel/pane when trying to activate the parent hotkey. It’s nuances like that, that make the whole CAD experience frustrating despite how conceptually every program does the same thing. And don’t get me started on all the different mouse/spaceball navigation control differences to orbit/pan/zoom.

I’m most intrigued by something called Gravity Sketch using VR, and being able to extrude things literally with your fingertips, like pulling taffy in an immersive environment.

1 Like

@WillAdams

It’s a difficult task to find anything that’s a nice uniform workflow.
So many hobby shops and businesses have such different workflows with so many custom add-ons and scripts.
It seems that many CAD software are forked from one another too.

Blender is so vast and varied.
Yeah, old plugin - goes to show I haven’t played with it for quite some time.
Last I was looking around, BlenderCAM wasn’t too great (I think it wasn’t compatible with 2.8+ at the time).
Thanks for bringing it to my attention again, great to see it’s still in development.

Yeah, that constraining sketcher add-on is the same in the YouTube video I linked.
It has potential.

I’ve dabbled with Alibre briefly.
I’m not surprised to hear about it being buggy or an inactive forum.
I think Atom/Workshop is meant to be a basic option for hobbyists.

I find that too, I use about 20+ programs in my profession and hobby, so many are almost there in it’s feature list, but I still find that I need to use several others just to get some things done in a timely manner.

Sounds like a nifty project.

@nyb72

Blender is just… Something.
I completely understand what you’re saying, I’m still learning.

It’s still so much better than what it was before the 2.8 update.
It’s a very hotkey driven program.

Oh man, I’m often using 3-5 2D/3D programs at once.
It’s a nightmare navigating between them all. If anything needs to be standardised it’s mouse navigation.

I have yet to delve into any VR programs, haven’t had a need to but am open to the idea.

2 Likes

Yeah one of our CAD guys tried to adopt Blender a few years back. I’ve rarely heard such a stream of profanities coming from that corner of our offices :slight_smile:

1 Like

If you’re not swearing at your computer every 10 minutes while learning new software, are you even trying? :upside_down_face:

3 Likes

There are some programs where it all fits together just so, and just makes sense — Altsys Virtuoso (which became Aldus FreeHand 4, which was then sold to Macromedia) was one.

Lotus Improv for the NeXT and Right Brain’s TouchType.app (always regretted not having occasion to try their PasteUp.app) and Millennium Software’s Notebook.app were a couple of others where things just clicked.

I wound up spending some time with Gravity Sketch in VR.
I can see a ton of potential, but it’s a steep learning curve to inherently know all the gestures and button presses required to get into the flow of creating things the way this software envisioned.
Plus, I’m not entirely sure if I can make precise sizes of parts and extrusions.

Also, what kind of throws you off is that since everything is immersive, you lose a sense of scale once you start zooming in and out of things. It’s tough to explain unless you experience it. My best analogy is like those moments where you’re zoomed into a OneNote page, and you start handwriting normally, and when you zoom out you’ve realized what you’ve written is too small.

One really amazing positive of it though, is the space navigation. You can literally reach out and grab the model with your bare hands and flip/spin/resize with very intuitive movements. Turning your arm and wrist with part in hand is exactly how it should feel and look. Plus, you can move YOU around in space, you can walk around the part or crouch and look underneath. It’s like the part has 6 DOF in combination with your own 5 DOF movements.

1 Like

Sounds like itcs great for reviewing/viewing/experiencing a model, but not for the actual creating.

I couldn’t imagine trying to get the precision required for pretty much any project using motion controls either.

The rule of boat-building is:

If it looks fair, it is fair.

I could definitely see this working for car body design for example — for any work requiring precision, import a DXF w/ dimensions/hole placement and work based on that?

While it’s not specifically for CAD, there’s a new node editor programming environment for Python3, Nodezator:

which seems promising — waiting on a bug fix and then hopefully I’ll be able to work up a system which in parallel does 3D modeling using OpenSCAD and writes out the G-code to cut the design out.

I found this interesting repository of software.

1 Like

Yeah, they never finished adding the tools from the Shapeoko wiki’s programming page.