Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: DSLCad – a programming language and interpreter for building 3D models (github.com/dschroer)
198 points by dschroer 7 months ago | hide | past | favorite | 92 comments
Hey HN. Over the last half a year I have been working on a 3D CAD programming language called DSLCAD. Today I am here to show my first release!

It is heavily inspired by OpenSCAD which got me hooked on the idea of a CAD programming language and what it can do.

Please let me know what you think. Ill be in the thread to answer any questions you may have.

I wish there was a way to combine the power of an imperative language driven model generating language like this (that generates breps, NOT meshes like openscad) but with the initial modeling using a GUI like a standard CAD tool. The reason being, it is much, much faster to draw complex parts using traditional methods versus trying to 'program' them. Writing code is fine for basic shapes, but go and try an 'code' a complex ribbed casting with bezier-definied swept surfaces.

I'd love to see a way to generate models with normal tools but, in the background, be able to access a code file that could then be embedded in an external script, headlessly. This way, say I have a part where 3 parameters change- I could take the code for that part, nest it in 3 for-loops, and iterate thru all the combinations of dimensions, procedurally generating the models (and potentially exporting them to a permanent format). FreeCAD allows actions to be scripted with Python but again, the actions have to be done in the language first- there is no 'going backward' from a part done in the GUI to Python (from what I can tell).

This is what parmetric programs like NX, Catia, Solidworks have the ability to do via "design tables" or other internal tools. But even those tools don't have an easily portable 'language' that the models are portable in, and the kernels aren't something that you can get in and poke around with (or interface with, say, Python, which is my dream).

Just food for thought for the author of this.

See Houdini: https://www.sidefx.com/

As a programmer, it's my favourite tool to make meshes. It's become a game studio standard over the last decade.

Meshes are not CAD data. Engineering applications need math surfaces, and thus use Boundary Representation (brep) based models, not triangle meshes.

This is the main difference between video games & vfx tols and engineering CAD tools and the reason why there is so little crossover in the software development of those tools.

The author's tool here uses OpenCascade which is a true solid modeling brep kernel, hence my comments.

> This is the main difference... and the reason why there is so little crossover

It's definitely _a_ reason, but not the only reason, and I personally wouldn't consider it the main reason. I used to be a mechanical engineer and now I work in software. Every day that I fire up solidworks for personal projects, I wish for exactly the kind of tool you described in GP. But the thing is, I wouldn't say that the choice of modeling kernel technology is the crucial point here. Frankly I think that the most fundamental problem is a complete lack of understanding between the two worlds.

In the MechE world, once you start talking about fabrication, manufacturing drawings and tolerances are really your bread and butter. This is such a profoundly basic thing for mechanical engineering, and yet completely absent from the kinds of modeling tools you see in video games and VFX. This is just a tiny example, but the real point, again, is a lack of shared understanding between the two domains. I mean... how would you go about capturing _design intent_ in one of these script-based tools? Even for something as trivial as drilling a hole in a rectangle, how am I going to know which corner to use for locating the hole?

As a MechE, your "source code" isn't the geometry you design, it's the history tree that lead to that design. It's the constraints and relations that you used to build the whole of the part. And I don't think that most people that work on software projects in this space have an appreciation for what that really means.

Don't get me wrong, CAD kernels are a hot mess. At every step, it's like you're basing the next function's source code on the compiled binary of everything you've written up to that point. It makes absolutely no sense. But it is, as of today, the closest analogue to how most MechE's I've talked to actually think about building parts. But I think that starts to get at the fundamental disconnect: people with a software background look at that and think, "surely something like CSG would be better; it makes things so much easier to compose". Whereas people with a MechE background look at these kinds of tools and think "ain't nobody got time for that." They're both right and they're both wrong.

It's said that breps vs. meshes in 3D is like vector vs. raster in 2D.

> Meshes are not CAD data...

Meshes clearly are CAD data just they may be less useful in certain fields. CAD is broader than whatever form of engineering you practice

Does Grasshopper in Rhino count?

Grasshopper can indeed drive NURBS surfaces in Rhino if I remember correctly, yes. But it suffers from the same problem I describe initially- you have to start with design from Grasshopper- it is a one-way-flow. There is no way to parametrically model something in Rhino and have it automatically generate a model graph that can then be reused.

This is the main difference between tools like Rhino and the aforementioned parametric modelers (Autodesk Fusion360 is another fully parametric solid modeler that supports a 'tree' build with parameters that can then be changed at will at any time, and the model will rebuild).

What is the end result you want? If you're modeling by hand, why do you want to "program" the model later? What would that look like? What units would you operate on? What would the output be? etc.

An example would be similar to how a catalog / design table is used for generating parts procedurally in software like Catia:

Say you have a CAD model of a special bolt you have made completely from scratch and it is fully parameterized- you can edit the diameter, the shank length, the thread length and pitch, the head size and height, etc. all by changing values in the parameters linked in the design tree. Doing this automatically updates the geometry.

Now say you have a catalog of 1000 sizes of this flavor of bolt. M6 thru M14, different threads, all the dimensions change to very specific standards... and you need to generate files for all those so they can be used by your company in assemblies or sent to others, but individually. Professional tools have ways to take, say, a CSV table of all those numbers and link the CSV to the CAD, and then generate and export STEP files and save them to a disk.

I've done just this example many times over the years in Catia V5. Highly parameterized part catalogs are prevalent in automotive and aerospace companies tied very closely to their CAD and PLM solutions (and thus highly non-portable and very much proprietary...) It would be great if there was some FOSS that was lightweight and similarly capable.

Looking more into it, FreeCAD can actually do something similar, but I don't know if the parameters are accessible to rebuild the models via a Python module outside of the GUI.

> Say you have a CAD model of a special bolt you have made completely from scratch and it is fully parameterized

But what does it mean to parameterize something you made from scratch? Either you built it as a parameterized model, or you didn't. If I understand, you'd basically like to design a model manually, and magically get it parameterized? That's probably possible to design a AI model that attempts to do that.

Every modern CAD tool like those commercial ones I have mentioned automatically track the paramaters as you build a model from scratch. They are parametric models by default. At any point you can go back and edit a number in the tree and the model will attempt to update as if you have used that value in the beginning. It's hard to explain this if you are not familiar with how those programs work.

I'm not talking magic here. What I'm saying is, I'd like the ability to read the model file as text outside the CAD package, and edit and compile (update) exportables in a scripting languge. Again, what I am saying is actually already the way many tools, like Catia and NX, etc work... but they lack an external API/callable module in an external language (Catia can be scripted with VB script, blegh.) And nothing that is FOSS.

Houdini, as a mesh based modeler, also called artistic modeler, is not appropriate for industrial design, because of the way it handles topology like every other mesh modelers.

This is a very different use case. CA industrial D software are actually aware of how machine tools work, that's why their tools and API are named based on real machine tools and have the exact same constraints as physical machine tools. Houdini has no such constraints nor awareness about manufacturing trade, anything goes including non-manifold geometries in topologies.

I've done that with the excellent Salomé[1]. Model and mesh something manually, export my actions to a python script, clean it up and refactor it.


Wow, yep a quick look and this is exactly what I am talking about. I was aware of the Salome project as the FE pre and post tools for code_aster and I'd even used the geometry and meshing tools before years ago, but had no idea they had a much fuller fledged CAD tool in this 'Shaper' module.

Honestly it's kinda buried in the fact that Salome as a whole has so many domains. I feel like more people would use this if it was promoted standalone. In some ways it looks similar yet more useable than FreeCAD.

If you like the idea of a "markdown for 3D models", you should definitely check out Smooth Voxels: https://svox.glitch.me/

I have a fork of it that is faster and also command line tools to make working with these kinds of objects UNIXy. https://github.com/webspace-sdk/smoothvoxels

Could I use this to make a very high genus watertight mesh for 3d printing? I want to make an irregular lattice for SLA 3D printing

Not sure - this isn’t really a CAD library, it’s more for computer graphics.

I think your front page needs a lot more "what it does" and "what it doesn't (yet)". above that it needs a "why this is not SCAD."

I suspect most people bouncing off openSCAD are upset by the "programming" language, so I hope yours is simpler and has less "functional" annoyances.

Having the first part of your landing page explain how your project doesn't require forcing one's mind through the eye of those needles like SCAD does would be a great step to get people interested in trying to do things with it.

IIRC I also think the OpenSCAD language has its issues but I wouldn’t call them “functional” annoyances. The composition in OpenSCAD is really weird in a way that I haven’t seen in any other language. The unnamed arguments you must access by position. The inability to create new types and thus the limitations of the kind of types you can work with. The workarounds to these limitations are much clunkier than having such things supported first class.

I guess it’s trying to be accessible to non programmers by maintaining a ‘simple’ interface. But as a programmer I find the language really lacking. In theory a restricted interface could improve performance but there are so many low hanging fruits that OpenSCAD doesn’t do that it’s hard to imagine that performance was a priority and the workarounds end up costing much more in performance.

A functional aspect of openscad is you can never modify a variable.

You have to write some pretty obtuse contortions to do some pretty common and useful things, just because of that.

Well, OpenSCAD isn't Turing-complete. What do you mean, you have to write? OpenSCAD focuses on scene description... I'm not sure what you mean here?

Be careful when asserting that things are not Turing-complete! I'm fairly sure OpenSCAD is indeed Turing-complete, if you discount the recursion limit of 1000000 (it even sports tail call optimization, so I'm not quite sure why it even has a recursion limit).

<edit> apparently the recursion limit is a deliberate feature to prevent infinite loops, as there is currently no way to interrupt such loops.

Interesting. Is it possible to input some data in a loop in OpenSCAD? "Input once" can be considered the whole program.

I don't know exactly what you mean but there are for loops to do something n times and iterate where values change each iteration. There is not goto. I don't know about recursion offhand, never tried.

Why even use the paradigm of a programming language as the description language if not to employ the features of a programming language that are different in some way from a simple pile of xml?

If you want a variable to actually function as a variable rather than merely a named constant, the only ways you can do it are things like huge ternary else lists that try to pre-handle all eventual possibilities at assign-time, and god help you if the values are expressions rather than simple alternative values, or passing it as a parameter to a module (function basically) that has to exist for no other reason than so that it can accept a parameter so that it can act like a variable that actually varies.

"scene description" happens to be exactly a great example of a problem. Preview mode, render mode, and importing the file into freecad are 3 distinct contexts that each want 99% the same code with only a few differences. One of those I can't even do. When I want to import a model into freecad, I have to manually comment out $fn $fa $fs and save the file in that condition, just so that freecad will interpret arcs as arcs instead of facets.

Digression there, anyway, for instance, I can't have a set of values that all change based on one other value, because I can't assign those values from within braces, so I can't say if(condition A) {set 50 values the A way...} I have to have 50 individual repeated condtional assignments, each with the same conditions and the same following string of ternary else other conditions and values

feat1 = opt == "optA" ? valA : opt == "optB" ? valB : opt == "optC" ? valC : ... valF;

feat2 = all those same conditions again...


feat50 = all those same conditions...

You might solve that by putting all that stuff into seperate files and having one condition that chooses one file to import, and that file has all simple assignments for a single case, but without having tried it I garantee it only creates some other problem like if the values are actually expressions that need to refer to other values in the main file...

Or in other cases, you have to break up a reasonable module into multiple modules, just so you can have one module with the common/shared features and a few others with the variable features, and a top level wrapper module that just calls the common one and decides which of the variable ones to call, and passes them all any values they need to share which were not in the global scope.

Sometimes this is not too unnatural, but sometimes it's completely ridiculous and wrong, but you have to do it only because openscad provides no better option.

And that still doesn't really show the problem. At least for my models, they are really more like model generators that I want to e highly configurable, and that really needs the ability to conditionally set a value and then overwrite it later, in order for the settings to be most useful for the user.

So for instance, the model has 30 values for various dimensions. Say there a 5 different versions of the model with 5 different sets of the 30 values. So I have either all those ternary lists or some seperate config files like above, or something even worse like 5 different top level wrapper modules that all they do is define a bunch of params to hand to a top level child, that the has to pass everything to every other module in the file...

Anyway, say you have that all done one way or another, you have your variable set of variables.

It's still not done because in the real world the user still needs to modify some of the values even after having chosen one of the main options. They wanted say th battery type B option, which defines a bunch of values based on that, but with 2 of those values modified from that starting point. Too bad. You can't set a default and then overwrite it. You can only find where the value is set and monkey hack that, or create a whole new top level option, copy the entire "battery type B" set to a new set and change your one or two things and call it the "battery type Bx" option...

I end up having to do a lot of putting as many of the possible user knobs as I can think of at the top with long descriptive names, and having some of them act as bounds on other values, so not just bottom_thickness but also maybe default_bottom_thickness and max_bottom_thickness and min_bottom_thickness etc, and then down in the code where the user isn't meant to go I'll have some expression that evaluates those and everything else to arrive at some actual value botzs or something that gets used in the rest of the file.

It has to be like that because there isn't usually a definitive heirarchy of this value always modifies that value but not the other way around.

Say there are dimA and dimB and d8mC, and they are all interrelated where say they must all sum to dimD, and all 4 can be set by the user. I don't know what the real values will be in the rest of the code until I know which if any of those values the user customized. So all of them have to start out as just provisional values. So I need seperately, a default dimA, a possibly user modified dimA, and finally a derived dimA that is actually used in the rest of the file. The default and user-set can't be the same either. Ypu can't just put dimA B C D at the top to be edited. If the user changes dimB, then maybe dimA needs to automatically adjust. if the user changes dimA, then maybe dimB or C needs to automatically adjust, and I may have perfectly good rules for that so that there is no reason not to make them automatic rather than just require the user to supply all good values.

So I have to define some default values that can't be changed, provide a whole duplicate set of possibly user defined overrides, which can't be changed, and derive from those yet another set of values that actually gets used in the rest of the file.

Maybe that isn't even the worst example, and maybe I'm not doing a good job communicating, but the stateless functional nature, makes the tool not that useful for something that is practically it's signature advertised feature, being a parameteic model generator rather than a static model describer.

Another little evidence of the lie of statelessness:

If there is no state needed to desribe a model, and it's wrong to want it and there is no valid reason to want to define and then overwrite a value, because you should have just set the value the right way in the first place...

...then why does it matter what order I write the assignments in the file?

Why is it an error to describe a relationship between values that haven't been assigned yet, if there is supposedly no such thing as "yet" in a stateless timeless world? The assignments are there later in the file. The described relationship is valid.

This leads to yet other contortions and sometimes flat limitations when there is a relationship between 2 values, but either one may possibly come first and be used to decide something automatically about the other.

Sometimes you can handle that by just having provisional desired values for both, that can both be assigned without conflict up front, and you evaluate the relationship between them later to get other actual values, but sometimes that's not actually so simple.

But regardless of workarounds, my point is more to show a very simple thing that exposes the fallacy of the proffessed ideal.

If you (not you, an openscad dev) would tell me that I don't need state from you, then why do you need state from me?

there should be a support group. "Show me where OpenSCAD hurt you".

I wrote this: https://github.com/sbambach/MarksEnclosureHelper

I shared your pain. But after some time, I've healed a lot.

The worse the complaint that sounds like hate, the more you have to remember, you can't be hurt by or hate something you don't care about.

I try to make everything I can in ooenscad despite all the above.

It blows my mind how a model can be described in 2k of human readable modifiable text that every other cad does in several megs of binary or xml.

And I have models that are build targets and dependencies in Makefiles! MAKE!

Thanks for the suggestion. Ill see what I can add to make it clear.

This looks awesome. If the 'fillet' works, that'd be enough for me to switch from OpenSCAD. Although to be honest, having a utility library like BOSL would be necessary too, or at least some way to make threads.

I'm going to download but another thing I would need to switch away from OpenSCAD - the ability to use an external editor, where the 3d model reloads correctly every time I save the program. Maybe your already has it, I'm going to check it out :)

Oof I'm back already, this is quite rough.

No editor included I see, that tripped me up for a second but it's IMO better than wasting your time on including one, once I got that it was fine.

I tried to enter the smallest program I could think of:

    cube(x=10, y=10, z=10);
but I couldn't get that to show anything. I can't resize the console it seems? So I'm not sure if there's an error on there. Either way, I'm not sure how I would go about finding out why I'm not seeing anything.

3d navigation seems wonky but maybe that's because there is no object yet? Sketchup has the same, it's no big deal, but I won't know until I can get something to render.

Some quick wins:

- draw axes in different colors and put a label on them - show scale markers on axes - add a minimal sample program, or some way to select a 'template' when doing 'new' that will provide a few samples - one minimal sample with a cube and a cylinder, one slightly more developed like the table in your screenshot, one that shows off each keyword/object. Maybe split across one for 2d, one for 3d. Or more as the library of functionality grows.

More work:

- Add a 3d navigation marker/tool like Blender has, that'll show where I'm looking at, and has 'zoom to all' function

All of these would have helped in terms of 'getting started'.

Apart from that - I'd first need to be able to at least render something to be able to say something useful :)

> No editor included I see, that tripped me up for a second but it's IMO better than wasting your time on including one [...]

It's using egui for the UI so adding an editor (w. syntax highlighting for the custom language) should be very easy[1].

[1] https://github.com/emilk/egui/blob/530e9f667c0969b09edb68f77...

Interesting. I just tried your example and it worked on my end.

Have you tried rendering any of the examples in the repo? I know its not ideal but just to see what is going on. Please add an issue on the repo so I can try to fix the issue you are experiencing.

I just tried a few, but no difference. One problem is that I can't see how far I'm zoomed in or out, and opening another file doesn't seem to reset the camera. So maybe there is something outside of the view that I can't seem, although zooming in and out doesn't seem to help.

I can open an issue but there isn't anything more than 'doesn't work' I can add. If you can describe some way for me to get information that's useful to debug, I can write that up.

Having renders "auto focus" has been on my mind. Probably will be coming soon. I was focused on getting the language and runtime in better shape first.

3D software commonly calls this "zoom extents" to automatically pan/zoom so that the model fills a useful portion of the screen.

In AutoCAD and Fusion 360 it's bound to double-click middle mouse because of how often it's used, though between users of 10 different 3D software packages you'll find 10 different but strongly held opinions on how the viewport navigation should work.

It is designed for use with an external editor. It watches the files and hot reloads when you save changes. I didn't want to do a sub par job building my own text editor.

I cant wait to hear about how it turns out for you.

While I understand not wanting to include a sub par job --- just including a basic text editing facility (whatever is included as the native text object in your programming toolkit) would lower the bar for new users, and facilitate folks doing quick/simple/one-off projects.

I've made my own fully 3d lovecraftian text editor, I'd like to give this a try and see if I can make a 3d object for my text editor, with my text editor.

Does it contain facilities for export into non-parametric mesh formats? (.obj / .fbx / collada..) np if not.

Not yet. Its certainly something that I want to support. I want to avoid supporting all the formats so settling on a few clear options in the space is the goal. Right now its only STL since its super standard and doesn't force me to cover everything. I will likely move away from STL as things settle.

Feel free to add a ticket requesting your favorite and I can look into moving to that format in the future.

Exporting to OBJ would get you 90% of the way there. If you're not doing anything but generating a mesh, then OBJ -> whatever converters exist for pretty much every datatype.

OBJ is also the easiest to implement, too. Assuming whatever geometry library you're using is using _real_ geometry and not using any sort of weird volumetric rendering, etc. then it should be 'trivial' to export to OBJ.

Sure thing.

I can still have fun with it in the meantime, if blender fails to export meshlab should succeed :p

Very cool project

Very cool, and excited to see more "Geometry as Code" tools getting built. In addition to comparing to OpenSCAD it'd also be awesome to see a comparison to CadQuery.

Oh interesting. I've recently tried learning JSCAD as I'm trying to model my freeline skates [(current progress here)](https://gist.github.com/nothingnesses/dc1171c2e20f7a6d9a1cb9...). I like it as I'm already familiar with JS (one reason I opted for it instead of OpenSCAD) and I don't have to compile/install anything but my browser. However, I'm running into a limitation with it as it doesn't have a native function that allows me to bend models, so I'm currently trying to write one.

Is it possible to bend models easily in DSLCAD? What would you say are some reasons why someone might use DSLCAD instead of JSCAD?

From my understanding JSCAD is aiming to be 1:1 compatible with OpenSCAD. So both strengths and limitations will come with that.

DSLCAD is a new take on the idea. Right now it doesn't support bending, however from my personal opinion, DSLCAD is simpler to develop for and should make it an easier platform to add bending support to.

Feel free to add an issue asking for bending and we can hash out how to make it work. Getting the API down is often as hard or harder then implementing the solution.

Years ago I came across this talk about a guy who built a Clojure wrapper around OpenSCAD in order to design his own keyboard. Potentially relevant:


Loved the idea of the Dactyl Manuform when I first saw it, however in the act of trying to customize it to exactly what I needed/wanted I found the whole process convoluted and annoying. I understand the idea behind it now and might try and set my environment up to match his (since I didn't know he had a video on it.) But either way I can't see this as being a good solution to the problem.

This is great, we need more of this sort of thing. Huge kudos for making it and documenting it. I will definitely be taking it for a spin.

1) Do you plan to add 'loft'? Without it, or some other type of morphing extrude, one is severely limited in the types of shapes it is possible to create.

2) I hope you don't mind me asking, what is the psychedelic-looking image I can see a sliver of in the screenshot? It looks like a rocking desktop background.

By the way, if you're not already aware of it, you may also be interested in looking at ZenCad for inspiration. It attempts to fill a similar niche (OpenSCAD-ish modeling + OpenCascade), except it uses Python.

Here is another programmable CAD project, Fornjot[1], also in Rust. Fornjot, too, is being actively developed.

Unfortunately it uses Rust for model description (compile times/learning curve).

That said, one could probably easily put a layer of scipting lang in-between. E.g. Rhai[2] or Lua or whatever.

And I guess if their tech is solid enough, someone will do that eventually and open a PR or fork the project. They do not use an existing geomtry kernel but do everything from scratch which makes this a very interesting endeavour.

There also seems to be a goal overlap between Fornjot and DieselCAD

[1] https://github.com/hannobraun/Fornjot

[2] https://rhai.rs/

Hey, author of Fornjot here.

Rust was chosen as a modeling language for two reasons:

1. Since the whole project is written in Rust, it was the most straight-forward choice. No dealing with bindings to another language or a scripting language runtime for the time being. 2. To provide an interesting alternative. I suspect that there can be a nice niche for Rust, creating infrastructure for writing models (e.g. libraries for generating screw threads, that kind of stuff).

I don't think that Rust is a great language for defining CAD models. Long-term, I suspect that the preferred choice for Fornjot will be something else. But for the time being, this decision allows me to focus on the CAD kernel.

> There also seems to be a goal overlap between Fornjot and DieselCAD

Do you have a link for DieselCAD? Searching on Google only got me car results.

DieselCAD = DSLCAD = the very subject of this disussion. :)


Ah, sorry! I missed that bit in the README and got confused :)

Thanks for checking it out. I am glad you like it.

1. Now that you have asked for it, I certainly plan on adding `loft`. Thank you for the suggestion. Looking quickly it looks quite reasonable to implement. I would expect to add it in the near future.

2. It is a digital art coloring book image that I filled in and used as a background.

Great stuff! If you're interested in something similar with a simpler language (Logo) and relative model construction (using the turtle) check out turtleSpaces: https://turtlespaces.org/2021/09/08/how-to-create-and-3d-pri... You can export STL files and 3D print them. We'll be adding a multi-color export method soon

If you haven't seen it you may want to check out https://github.com/zalo/CascadeStudio

From what I see, it is exposing the OpenCascade base commands directly, versus your completely new DSL, but you might be interested in a way to implement your DSL on top of such an interface such as this which takes out a lot of the extra work of having a rendering interface, exports, etc, maybe.

See also open source Pov-RAY. Not my software. It has full featured boolean volumes, and could be called text based Blender.

http://www.povray.org/ https://github.com/cyborg5/pov2mesh

It couldn't; POV-Ray outputs images, not meshes or CAD models. It is purely a graphics tool.

The project page says it outputs a triangle mesh. POV-Ray would have to have a notion of volumes and surfaces in order to calculate shadows and reflections.

I'm afraid you are mistaken. It does not output a triangle mesh, and the project page says no such thing. It does not even construct such a mesh internally. Its "notion of volumes and surfaces" is implicit and constrained to ray intersection tests for graphics rendering.

There is a news entry [0] pointing to a blog post [1] by someone who did manage to sort of reconstruct a triangle mesh from a POV-Ray scene. They had to write macros to shoot a bunch of depth test rays into the scene to generate a point cloud, and extract the surface in Meshlab. They've released some of the code [2] and it's called "pov2mesh". If you read any of that - or use POV-Ray at all - it's very clear that it's not a mesh editor, or any sort of CAD tool.

[0] http://www.povray.org/news/index.php#324 [1] http://graphics.cyborg5.com/2016/10/29/converting-pov-ray-sh... [2] https://github.com/cyborg5/pov2mesh

The link [0] literally says:

> #pov2mesh A Set of Macros in POV-Ray Language to Convert a POV-Ray to a Triangle Mesh

I never said it was a mesh editor or CAD tool or anything else except that it would need an internal representation of volumes and surfaces in a scene, and that the OP linked to a tool that generated a triangle mesh from this info.

[0] https://github.com/cyborg5/pov2mesh

It might be nice to be able to install it with homebrew on MacOS.

btw, I know it's not open source, but you might be interested in KittyCAD: I believe they're looking for software developers with CAD experience. And you could do worse than work with Jessie Frazelle!

I am not very familiar with the homebrew packaging process. I would be happy if someone wants to help set that up.

Ill take a look into KittyCAD. Seems like a cool idea and is worth digging further into.

Very cool! What modeling kernel does it use?

Out of curiosity - are you a mechanical engineer? I'd be curious to know what your history is with different CAD programs, and what effect that had on the design/use decisions you made with DSLCAD.

Its using open cascade.

I am not a mechanical engineer. I am a software developer however I have worked closely with engineers and have some experience with CAD applications.

Really most of my decisions come from working on larger projects in OpenSCAD as well as my contributions to the OpenSCAD project (WASM port).

It's using open cascade.

Can you say a little more about the geometry kernel? Is it NURBS-based, triangles, f-reps, etc?

IIRC, OpenSCAD uses CGAL and is all triangles under the hood; other tools use OpenCascade for NURBS modeling, or weirder DIY kernels.

It's using open cascade.

Would writing out text files be an option?

I've been trying to do this from OpenSCAD (now using RapCAD) and while I sort of have it working:


I'm not so far along that I wouldn't try something else.

You have a super interesting use case. Can you reach out on the github issues so that we can track it? From what I can tell you are trying to generate GCode directly from the software is that the case?

Yes, that's it exactly --- basically trying to avoid the need for additional CAM software and provide complete and total control over machine movement.

I'll have to check this out. Really great to see more of "cad as code". My current favorite is cadquery. It's pretty neat in that it simply is python.


This is great! I've been looking for something like this for a while. My only question is: does this do constraint-based modeling like other CAD software or do you have to specify individual parameter values?

Hey. I'm glad that this is what you are looking for. At the moment there isn't constraint based modeling. However given that you have a programming language at your disposal you can model your constraints yourself.

Thanks for the reply!

Would you accept a PR for first-class support for specifying constraints between variables (and object measurements) as part of the language or would that be divergent with the goals of the language? I find it to be an important part of SolidWorks etc. because often times I'm trying to build something where I know one of the dimensions is constrained a certain way but that's not how I'd parameterize the object. And I don't want to be doing math for e.g. calculating the diagonal over and over again as part of calculating parameter values or modeling constraints, I like that in Solidworks that's part of the package. I believe this issue is important to other mechanical engineers as well.

However I do want to say, great work, I think a programming language is a great step forward for CAD regardless, and this project seems to be pretty well done!

For sure I would accept a PR! One of the goals I have here is to try and make it approachable to expand for others. If you have an idea on how to make this work please feel free to work on it.

To save time up front I would suggest doing a bit of design work. Feel free to make an issue and post things like example code snippets of how you would like to see this work. We can work together to make this feature a reality.

This reminds me of https://github.com/nicklockwood/ShapeScript although that is limited to Apple platforms.

The inertial model rotation is a pleasure to use, I’ve done the same in some of my programs and while it feels a bit strange at first it does make it easier for me to perceive the shape as it moves.

Chamfer and fillet are awesome, but the pipe… mixed feelings, especially since it uses a dash. Either a normal pipe or an Ocaml-like |> would feel more natural.

The goal of pipe is to allow the code to read top to bottom. I always found it hard to explain the way an OpenSCAD program reads upwards when nesting operations.

As for the syntax there are certainly a lot of ways it could feel. JS devs would likely be familiar with =>, F# and Ocaml |>, Java ->. In the end I just picked one that felt natural to type for myself. From my experience if you write in enough languages you develop the ability to switch as needed.

This is very cool. Do you use Github Sponsors so I can tip you?

quick comment - if you have to note in the readme that it's pronounced "diesel cad" you should just rename it "dieselcad" and be done with that stumbling block.

You are probably right. The Linux hacker in me still kind of prefers having a bit of style to names. Maybe over time this will change.

Your LICENSE file is misspelled, by the way.

Your LICENCE comment is misspelt, imo. ;)

Fixed. Thank you :)

The link to the documentation page gives 404

Should be fixed now. CI issue

This might be the right thread to ask for help with a 3d problem I've been working on for a year or so.

I have a resin 3D printer, and I want to make handles for it. Specifically, ultra lightweight handles using an irregular lattice.

OpenSCAD chokes on trying to union 100s of cylinders. Real tools cost $1,000s. Right now it looks like I'll have to write something to do the union in voxel space

It's not really because Show HN is specifically for people showcasing their work and getting feedback. But there are lots of other kinds of threads where it might fit up to an including posting an Ask HN of your own.

For work or hobby? Fusion360 doesn't cost a penny for the latter. (I'd love to use code or FreeCAD or ideally FreeCAD stored as sane human readable code, but none of the options are quite what I imagine.)

1. FreeCAD. I am not 100% sure what you are trying to do, but FreeCAD most probably con do it. And the forum is there to help you if needed.

2. 3DExperience Solidworks for Makers. It's something like $100/year.

Applications are open for YC Winter 2024

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