Code CAD – Use code to create CAD models
cadhub.xyz
cadhub.xyz
I'm really bullish on software driven CAD, myself and other CadHub volunteers talk regularly about a future in which Mechanical Engineering and design is very similar to software engineering.
I'll be the first person it admit that some of the current CodeCAD tools aren't production ready, OpenSCAD for example I can't imagine being used by mechanical engineers. So the idea is mostly about unifying the community with a website dedicated to this paradigm, and if we're lucky we play a small role in promoting more development and better tools in the future.
Some of the reasons it's got potential:
- 3d-diffs on pull requests [1]
- Automated FEM, CFD etc simulations akin to CI/CD [2]
- PLM managed through git
- plus git in general is such a good way for teams to work together
That said as a mechanical engineer for going on two decades now, I really get no value from this kind of mechanical design. I grew up on Solidworks and now use OnShape. That kind of physical modeling is very important. Being able to click on a face and sketch some geometry and then extrude it really feels like the right modality for me. I’d really love to see more investment in that kind of parametric visual CAD.
EDIT: An example of one of my recent projects: https://twitter.com/TLAlexander/status/1450001567088713730
Direct manipulation/GUI will always be faster at producing content. It worth exploring how much the two can we wedded with code synthesis. I get that code synthesis attempts normally produce poor quality code, but maybe a hybrid work flow could work between using the GUI and fixing up code.
It's a shame that the current CodeCAD tools have very little interaction with he part viewer.
https://www.youtube.com/watch?t=290&v=jC2_O5Jh_Rg&feature=yo...
https://twitter.com/TLAlexander/status/1450001567088713730
I will check out those videos when I get a chance.
I suck at 3d modeling, so I evaluate tools from a “how much value can a noob get” point of view.
Honestly CAD is very complex software and is not well suited to a single engineer working in their hobby time. I think a huge reason Blender has been successful is that they built a sustainable crowd funding system. They currently pull in $166k each month with that system: https://fund.blender.org/
I am pleased to see also Godot engine (a similar type of tool) pulling in over $7k/month (last I checked) on Patreon.
Anyway there is a “business model” for open source projects even if they don’t sell anything. Call it a funding model. I think open source projects need to get a handle on that for anything that exceeds a very small team.
I am trying to build this kind of sustainable funding for my own open source farming robot (link in profile) and I think we’re going to go with Open Collective at least as a front end.
For fiscal hosting we’ve applied to the Open Collective Foundation and the Software Freedom Conservancy.
I think open source CAD really needs a funding plan like this. It’s a very large software project and we’ve seen how Blender and Godot are able to actually get traction and produce a compelling program with resources like that.
What I desparately want though is an on-disk format that's plaintext, makes sense, and results in reasonable diffs so that I can use git for version control.
I just don't understand, being familiar with git, how people can work with 'save and mark new version' style 'version control' that's so prevalent among tools that have anything at all.
In software we solved this with code style guides and later code formatting tools. I would be surprised if e.g. a Python script could not format the STEP files to a "canonical" representation before committing the file to version control.
[1] https://files.pine64.org/doc/datasheet/pinephone/PinePhone%2...
Has You tried SolveSpace app?
[1] https://git.io/SolveSpace3x (latest nightly builds + various useful resources)
EDIT: I see you linked some tutorials so I will have to check those out!
> Howdy! Well we absolutely need more open source CAD tools.
Please, no. We need one (or two for competition) really good open source solid modeling CAD tools with parametric and other interfaces. We do not need a dozen competing tools with varying feature overlap that need to be meticulously vetted before committing to one. Not to mention wasted dev time as each tool implements similar features in different ways, wasting very limited open source dev time.Often I feel like FreeCAD is "getting there" but it's nowhere near "there" yet.
Yes, please!
I'm sorry but this is probably not a good idea. A typical PDM/PLM implements many things that don't exist or are not in the spirit of git, including but not limited to:
- Per-object security, lifecycle-dependent security (e.g. an object that is Work in Progress may be editable, but it becomes read-only when Released), groups and roles (per-object groups), LDAP / Active Directory integration, ITAR compliance.
- Object lifecycle (Work in Progress / Released / Obsolete etc.), driven by workflow graph that can be adjusted for the specific customer. Ability for one or more engineers to vote to accept or reject a transition from one lifecycle state to another.
- Revisioning: automatic generation of initial revision in prescribed format, automatic increment which follows the lifecycle (e.g. when transitioning from Released back to Work in Progress).
- Part numbers: automatic generation in prescribed format, alternate part numbers (e.g. when a supplier uses a different number for the same part).
- BOMs, including support for family tables.
- Custom attributes, search, "copy structure", viewable (usually PDF) generation, integration/customization API and many many other "small" details...
There are things CAD-as-code excels at, but once you leave the happy path of simple primitives with a few holes and a bit of chamfer, I found things can get really ugly real quick. Organic shapes are very hard to construct, and simply generating polylines or the like either fails because OpenSCAD takes literal hours to render or because CadQuery throws some weird error halfway through and I just can't get it to work.
I'd love to see a free or at least affordable (for hobbyists) CAD solution that isn't code-only, cloud-only, totally crippled in terms of functionality, or extremely arcane. I believe Fusion 360 went cloud-only (or almost) last year or so, and between Fusion 360 and FreeCAD (which I tried to learn, but couldn't figure out) there seems to be a big opportunity for an affordable, user-friendly, open CAD tool for the 3D printer owning masses (there are dozens of us!)
It's quality software, and free (as in beer). It's hard to compete with that. Most hobbyists care more about making their designs rather than software ideology, myself included.
Also, it's clunky, but I've had success by using Python to generate OpenSCAD code. The best application of this was an SVG to OpenSCAD path converter.
If this was important for my life, I might put in the effort. If it is for passing curiosity, I probably won't. Especially when it impacts not just this software but opens an entire universe of what exploits can now be run on my PC.
When I have to set up a VM to sandbox an environment for a tool, it stretches my patience. It makes the tool extremely cumbersome.
I'm actively working on bringing CadQuery and all its dependencies to Nix because *Conda is an abomination of highest order.
Moreover the pywrap and OCP which are CadQuery's dependencies are even much worse. They are like galleries of every DevOps anti-pattern ever invented. The more you dive into them the more horrible it gets.
CQ is actually nice though.
Modelling via code in cadquery is definitely a different approach in a lot of ways, but it is extremely powerful too: you get all the goodies like parameter-based, non-destructive history but also things that might not be obvious up front, like being able to "comment out" sections of your model (not just hide them - but skip generating them) temporarily, building up reusable helper routines, easily swapping out rough prototype vs thoroughly designed parts that are depended upon downstream in the model, and being able to organize complex models into separate modules.
I don't think I'd necessarily recommend this approach to modelling to a non-developer, but if you're already a developer, it is tough to beat (for 3D printing at least).
Wikipedia has a page on it [1], but quickly skims over some techniques without much details.
[1] https://en.wikipedia.org/wiki/Robust_geometric_computation
difference() {
hull() {
...
}
translate([1, 0])
circle(r)
}
I mean, those are just s-expressions in disguise. (difference
(hull ...)
(translate
(circle r)
[1, 0]))
The distinction between modules and functions also seems unnecessary.https://github.com/farrellm/scad-clj
Demonstrated and talked about in this clip: https://www.youtube.com/watch?v=uk3A41U0iO4
edit: it is a fantastic talk but the part related to this starts at 17:35
I can run OpenSCAD locally and there's never a lag like that when I pan/tilt/zoom the camera. I could understand if that lag occurs in this web app if OpenSCAD wasn't actually running in the browser but instead as an instance on a server, but the page you linked to doesn't state whether that's what's happening.
Or maybe it's just an approach to "bake" the model into an image to save resources or prevent potential freezes?
I'm not criticizing it but am just curious about the reasoning.
The JSCAD integration is however all in-browser and is far smoother. They should lead with it, IMO.
The current version should be:
I pirated SolidWorks last week and it is an absolute joy to use. It is like night and day compared to any scripting based CAD system out there.
CAD and code absolutely do not, and should not mix.
I tend to agree, having done both programming and mechanical design. Drawing by writing code is pounding a screw.
The major CAD systems have some scripting capability, for when you need to generate a gear or a geodesic dome or something that needs procedural generation. They also have constraint solvers, so you can specify constraints and let the system find a solution that satisfies them. Try the demo version of Fusion 360 for that.
It's sometimes more painful to use code for quick "all I need is a funny shaped..." projects. Some projects really benefit from having a for loop, though.
- From the same source files, I can generate either an "assembled" model or a "print version" arranged for 3D printing.
- Integrated into github CI/CD so that I know immediately if I broke my designs. Easy to write tests for things like bounding box size.
- Use eslint to enforce style rules. Mocha for tests. Typescript if you want.
- Browserify to bundle the design into a website. Directly from the source CAD files, without rendering to a huge mesh file format.
It's cool because you get access to the whole javascript ecosystem, and it's native to the browser.
https://www.amazon.com/Automatic-SketchUp-Creating-Models-Ru...
Libfive is quite good to check out too but yes openscad and cadquery are the most used.
Lots of potential, but IMO not really usable for real world work.
For example, there isn't any (or I haven't found any) simple way to create a clean fillet between two complex surfaces other than blending them and hoping for the best.
Documentation of the API is lacking, except for a bunch of examples in scheme (not exactly the most popular language for CAD folks).
Python API exists, but documentation is ... reading the source code.
Finally, the implicit surface tessellation algos used in libfive are IMO somewhat unpredictable and getting them to produce precise shapes (which is something fairly desirable in mechanical engineering) is hard.
What about Antimony and VisualScriptCAD?[0,1]
Personally, I would never consider a web-based software for professional use. An opaque profit model makes me think you’re looting my intellectual property to resell, mining crypto with obfuscated JS or WASM, or you’re snatching up market share to get bought by Google who will just kill the service and leave me hanging.
There’s a lot of room for better software in AEC but CAD is pretty robust and very affordable at this point.
I agree with you about the web-based criticism though. Working in a browser feels pretty limiting and it's so slow.
Plugging into existing frameworks (like Rhino) is quite easy and can open the door to other realms of optimization/simulation for the designs you are scripting. For instance you could leverage generative design (e.g., https://www.youtube.com/watch?v=-HLRtXSG7fQ) and other software that can be used to evaluate designs according against variety of criteria ranging from structural integrity, to environmental performance, to 3d-printability, etc. If there’s open source frameworks you can plug into, even better.. and if not.. then maybe that’s what’s missing: an easy standard way for various opensource projects to share and edit information.
Programmatically-defined designs make sense to me only if you can easily change parameters to quickly produce, evaluate, and optimize the designs/variations/results. Otherwise - Better to use a GUI that allows for more direct (and less abstracted) expression of designer intent
Similarly open source CAD makes sense if it can be augmented by other open source projects - including sharing and editing data from these various projects
It's a little different but essentially it takes data to define geometry and machine operations. We generate that data in code and pass it on to cadcode. Cadcode then passes that on to our NC machines.
I worked on a web-based version of a major player in the industry and the projected ended up getting canned. Ironically, because (I think) they really couldn't figure out a good way to profit from it. A license for the desktop product was like $xx,000, but the ideas tossed around for the web-based version were like $y.00 per minute of instance time (basically like EC2 pricing). Turns out that $y would need to be Very Large to be even remotely profitable.
The product itself was pretty slick though. I was really surprised at how well it performed.
I've seen a lot of enthusiasm for OnShape (a relatively new web-based CAD tool) among professional CAD users, particularly when there's more than a handful of people working on one project.