Hacker News new | past | comments | ask | show | jobs | submit login
Solvespace – parametric 2d/3d CAD (github.com)
128 points by trymas on Oct 6, 2016 | hide | past | web | favorite | 40 comments



I've been using this software quite extensively to design a small 25m2 house I'm building earlier this year. It can be a bit rough around the edges, but it's already quite usable and powerful!

IMO the main issue is that the constraint solver recomputes everything whenever you add/move something, even though past additions are already properly constrained. As a result, the software gets less and less responsive as your design gets more complicated. I don't know if the devs adressed that issue (it's a tough one), but I know it was already on the radar a few months ago.


Does it get as bad as OpenSCAD? I found that anything even remotely complex using OpenSCAD brings the machine down to a crawl. And I'm on an overclocked 5930K with 64GB ram ;-)

I'd be very curious to see a couple screenshot of your project! I used Google Sketchup to do landscaping last year around my house; I wonder how this would compare...

sketchup plan: https://goo.gl/photos/Qc5mEnFiFm9UWBvv8 reality: https://goo.gl/photos/Gn66MSc8UPshR3CC8


Here you go!

http://imgur.com/a/LOBge

The design is a bit crude, but the goal was to get the structure's dimensions right. And it worked!

http://imgur.com/a/rCZfk


Try throwing render() around heavy blocks of code. That should speed up successive renders quite a bit.


Have you tried freecad? I think it uses openscad as backend but has a slightly better (and faster) UI.


It uses Open Cascade: https://www.opencascade.com/


I don't know if the devs adressed that issue (it's a tough one)

If these are linear constraints, maybe they can use the "Cassowary" incremental solver.

[1] http://overconstrained.io/


In the current solver, the constraints are linearized. It's not especially complex (just 500 LOC, not counting the symbolic algebra system that feeds it) or clever, but it does the job: https://github.com/solvespace/solvespace/blob/master/src/sys...

We've been planning to evaluate Eigen for a while, but I will also look at Cassowary, thanks!

That being said, depending on the sketch, often the vast majority of the time SolveSpace is calculating after dragging something is spent not in solver, but rather regenerating geometry, and that's harder to optimize.


"Constraint" means something different to Cassowary than it does to us here, and isn't obviously useful. An optimized matrix library (Eigen, BLAS, LAPACK, etc.) would provide a modest speedup without too much work.

So yeah, the constraints in SolveSpace are nonlinear. They're solved by a Newton-ish method, which for underconstrained sketches also minimizes at each step the sum of the squares of the distances that any un-dragged points move (plus some other stuff). The Jacobian matrix is computed by an internal symbolic algebra system, allowing considerable flexibility in the range of user-facing constraints without a combinatorial explosion of hand-coded special cases.

As whitequark notes, the final solution of the constraint equations is a relatively small part of the overall work. The difficulty is mostly in writing them, to handle many useful cases in relatively few lines of code, and to converge reasonably in the Newton's method.

For a dramatic speedup, we could partition the constraint equations into roughly-triangular form, and then solve sub-systems in dependency order. Practical sketches seem to have a lot of such structure, and a visualization of that graph would be an interesting expression of the design intent. (To be clear, this isn't a spreadsheet; you still have to numerically solve systems of multiple equations, just not all of your equations at once.) I wrote an earlier solver that did this in some cases, but SolveSpace doesn't at all.


I don't work on Solvespace and therefore don't know for sure, but I suspect they're not linear. In particular, a significant fraction of all constraints in a CAD system like that are of the form "the distance between these two points must equal x", which is a not linear in any of the positions

I'd love to be wrong about this, because this general problem is one I'd be very interested in being able to solve more efficiently.


2d geometric constraints solvers are usually based on BFGS algorithm (https://en.wikipedia.org/wiki/Broyden–Fletcher–Goldfarb–Shan...). This is what we use in Shapr3D for example (http://www.shapr3d.com)


This seems to be more than just a parametric 3D drawing program (at least based on a quick look at a tutorial). The workflow seems to be heavily constraint based. You make a bunch of connected lines of no particular orientation and dimension and then specify a bunch of restrictions on what sort of thing is possible. Eventually you end up with your design based on a bunch of tiny specifications.

Strikes me as different than something more drafting oriented like Freecad. It's more like a type of 3D breadboard.


This is the standard with commercial CAD packages like Solidworks/AutoCAD because it's much more effective for the part design process than manual drafting. I can't really think of any paremetric CAD packages that aren't also constraint based.


>The workflow seems to be heavily constraint based.

That strikes me as being very similar to the Part Design Workbench of FreeCAD which uses the Sketcher and constraint solver. Anyone have more details on a comparison of Solvespace and FreeCAD?

http://www.freecadweb.org/wiki/index.php?title=Basic_Part_De...


SolveSpace is indeed similar to FreeCAD's Part Design module. One major difference is that SolveSpace uses the same solver for constraints in 2D and 3D, as well as for sketches and assemblies, whereas in FreeCAD the Assembly module is separate.


The name is quite descriptive.


Solvespace is the best open parametric CAD package I've used by far. For people coming from commercial CAD packages like SolidWorks the design process is easy to pick up. The UI is definitely a bit rough, but it's so much more powerful than anything else I've used.


How is the crash rate?

I used to use Inventor professionally, and that had a MTBF of perhaps 4 hours. I haven't needed a CAD program since then, but one of the things that'd make me try Solvespace first is that whitequark appears to actually care about reliability.


I care a lot about reliability! In fact, FreeCAD's incessant crashing (and the fact that it corrupted the savefile when doing that) was the single biggest reason I put so much time into improving SolveSpace, although working assembly support is a close second.

Even in case that SolveSpace does crash, it has an autosave facility (with a five minute interval by default), and so you should never lose more than five minutes of work.

You should also use the 2.x branch and not the released version 2.1, as the branch has some important bugfixes. I will release 2.2 within a few of days though.


I can't believe I hadn't heard of it before. I just went through the tutorial and I'm duly impressed. I'll definitely try this for my next design. I couldn't find a way to donate, but I'd gladly send an appreciation to the people working on this.


did you use FreeCAD? what does FreeCAD lack compared to this?


Assemblies. Freecad technically has the ability to create assemblies, but it's been in beta for years, and you have to compile it from source in order to get it.

Also, I find solvespace much easier to use the Freecad. Freecad has such a myriad of options and controls that I find myself often taking a while to find the one I'm looking for. Solvespace is a much more focused tool, having fewer but easier to find controls.


That looks interesting -- especially the path generator, as most CAM software are non-free and all clunky..

Funny that one of their example of clamps looks exactly the same as the one I've designed to hold the spindle on my CNC! (cut from sheet aluminium https://github.com/buserror/buserror-reprap/blob/master/stl/...)


I've been planning to integrate libarea (of HeeksCNC fame), which can generate HSM toolpaths.


Let me plug qcad, a free and open source cad system that allows you to work parametrically as well using plain javascript.

I've done some pretty complex stuff in it and it hasn't let me down yet.

I'll give solvespace a shot to see how it compares, for me the reason to use parametric CAD is that I'm far more comfortable programming something than editing it in a GUI, and besides it makes changing stuff so much easier.


That's 2D only, though.


That's true. But when you're drafting machine parts/machines you rarely need true 3D and that's what I'm using it for.



"Currently, the focus of development is to improve SolveSpace's handling of complex assemblies with many similar parts by allowing to load a hierarchy of sketches instead of a single sketch and propagate the changes as they are made, and to derive many variants of geometry from a single sketch. For example, these changes would allow to use a single basic sketch to model framework made from varying lengths of 80/20 profile, whereas currently that would require a separate sketch for every size of cut."


FreeCAD & OpenSCAD have both been mentioned a lot in this thread. If you like the thought of the scripting power OpenSCAD gives you, but like the convenience of a GUI at times, the cadquery plugin for FreeCAD may be worth a look. It provides a Python scripting environment in FreeCAD that you can use in tandem with GUI operations.

https://github.com/dcowden/cadquery


Does the FreeCAD plugin enable live-coding (instant preview on the normal canvas)?


6MB installer free .exe, oldschool. Makes me wanna contribute a lot.


I like the concept, and I am sure that I will try it out soon. I do however miss some screenshots on the website of the full application, and asking a user to download a video on a website in 2016 seems a bit off, why not use YouTube or some other service that offers embeds?


Anyone care to weigh in on how this compares to FreeCAD?


If you are using FreeCAD, probably try to run Solvespace or read one of it's tutorials, and you'll see the difference.

I have not used both apps extensively, but clearly FreeCAD is much bigger tool with wider use-cases. If talking about 3D cad only, I like minimalist Solvespace's approach better (from UI/UX stand point and from source code's perspective as well), easier menus, easier use (simple shortcuts), readable and rather small-ish codebase.


The maintainer, whitequark, has an equally interesting portfolio outside Solvespace: https://lab.whitequark.org


the examples page [http://solvespace.com/examples.pl] is very well thought-out


Is there a product roadmap? Would be interested only if/when some sort of iLogic-like implementation is present. Otherwise, keep up the great work.


I'm not aware of any plan to incorporate programatic costraints into Solvespace. I've given this a little bit of thought before, and I suspect it could be best done with a scripting language tied into Solvespace, in the style of Blender.


There are vague plans for integrating Lua in a way that lets people implement new constraints without touching the C++ code, but the current architecture makes it very hard. We're refactoring it but it will take a while until such scripting is viable.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: