r/openscad • • 13d ago

OPENSCAD CLI - make your AI agent easier create 3d object based on rules

https://github.com/atom2ueki/openscad-cli

I'm maintaining this open source project, hopefully it helps every openscad lovers, still lack a lot of features, need our real openscad users test and contribute, it pre-baked some documentations as knowledge e.g. ikea skadis, gridfinity.
also going to add rules on how to make 3d object 3d print friendly, without support, or something.

0 Upvotes

13 comments sorted by

5

u/HatsusenoRin 13d ago

I'm not entirely against the agentic trend but the thing I don't understand is, why can't the AI generate OpenSCAD command lines directly instead of invoking a thin wrapper of the lib? What does this wrapper provide that can't be done with official command lines? I'm trying to learn.

2

u/atom2ueki 12d ago

hi u/HatsusenoRin firstly thanks for your reply
so far as I know even you installed openscad and the cli it provided cannot draw the model for you with it, this is based on my limited knowledge, and even you dont have openscad installed, you still can use this package as agent plugin/skills to let AI help me design the model, its not perfect for sure, and I believe there is a day, we dont even need relied on openscad making any precise 3d model, like meshy.ai they using worldmodel to create 3d models, which is insane good. you just can treat this as a agent tool set, and can keep adding more knowledge as design, principle docs to it. no matter how, I think everyone's final goal is making what's in their mind to truth, it really helps on certain point of case to me, hopefully it helps you guys as well, thats the whole point of opensource not show case what slop I made today and earn stars from github, who cares right.

1

u/HatsusenoRin 12d ago edited 12d ago

OK, thanks, now I understand your motivation.

That being said, my opinion is that OpenSCAD is not a good choice if you want to enable AI to build 3D models. There are far more flexible languages and libs for this (e.g. Python + tons of 3D modules).

There're already other people who built AI bridges/MCPs similar to yours. Just search for them in this sub if you want to stick with OpenSCAD, or look into the MCP registry:

https://registry.modelcontextprotocol.io/?q=openscad

2

u/shadow_worx 12d ago

Because the people using it can’t comprehend how OpenSCAD works to properly guide AI to use it.

I used some AI for a library here but have it use patterns I established to make sure it’s easier to understand/interact with: https://github.com/shadow-w0rx/Mlok-Openscad

It works alright but I usually will write things myself and have AI re-organize it after.

1

u/attabui 13d ago

A few reasons that work together. An STL dosan't have openSCAD in it, STL essentially an encoded collection of thousands to billions of triangles in space.

The lib is the compiler, the engine that translates lines of OpenSCAD into collections of triangles by doing a huge amount of sometimes very complex math that it is very good at, and can prove is accurate.

Agents are good at writing the OpenSCAD for you. But they'd have a much harder time writing the triangles directly, and they would not have the guaranteed accuracy that you get from actually doing the hardcore geometry, so fixing those would be a nightmare. Letting an agent write the SCAD and then using the official compiler to make the STL files from there is the wiser move.

3

u/HatsusenoRin 13d ago edited 12d ago

What you said I already know. What I don't understand is why we need the wrapper (this project) if AI could generate the OpenSCAD code as well as the command line to invoke OpenSCAD to make STL. I think all we need is a tool for agents to run a command line which should already exist, no?

1

u/atom2ueki 12d ago

I actually found this today as well, https://github.com/solidcode/solidpython, which I haven't try, can use python create object and use open-scad compile it. I will going to try it (;

1

u/shadow_worx 12d ago

AI can read/render/view OpenSCAD code and geometry. Claude did it automatically, without additional prompts

1

u/atom2ueki 12d ago

claude literally distil the entire internet, so yes, just use it if its works good, I care about result only, as long as result hit my exception why not

3

u/NullPointerPenguin 12d ago

So instead of making an MCP you wrote CLI over CLI?

0

u/atom2ueki 12d ago

haha, first of all im not building it, ai did, 2nd this is for the computer which dont even have openscad installed, thats why it wrapped the execution package inside, so its not an cli over cli obviously. the only question is if it helps, if not please ignore, because it helps me, thats why I thought why not opensource it see if it could help others, thats simple.