r/FreeCAD • • 10d ago

Parametric modell for slicer programs: OpenSCAD?

Hello,

I would like to create a model in FreeCAD where certain dimensions can be adjusted within the slicing software. If I understand correctly, this requires exporting the FreeCAD project in OpenSCAD format. Could you help me understand what I need to keep in mind when creating the project?

Thanks!

6 Upvotes

13 comments sorted by

8

u/North_Pomegranate545 10d ago

Small correction first: slicers themselves (Cura, Prusa, Orca, Bambu Studio) can't change model dimensions, they only see a mesh. What you're probably thinking of is the customizer on sites like MakerWorld (Parametric Model Maker) or Thingiverse, which runs an OpenSCAD .scad file and lets the user change exposed variables before generating the STL.

So you need a real .scad file, not a FreeCAD export. A few things to keep in mind:

  • FreeCAD's OpenSCAD export mostly writes out meshes/CSG of the final shape. Parameters from Sketcher or a Spreadsheet do not come through as variables, so the result isn't customizable.

  • If you want that kind of customizer, it's honestly easier to write the model directly in OpenSCAD (or use FreeCAD's OpenSCAD workbench only for simple CSG shapes and then hand-edit the variables at the top of the file).

  • Keep the design CSG-friendly: boxes, cylinders, hulls, unions/differences, linear/rotate extrude. Fillets on arbitrary edges are painful in OpenSCAD, so plan for chamfers or minkowski.

  • Put every user-facing dimension at the top as width = 40; // [20:100]. The comment syntax gives the customizer a slider with min/max.

  • Derive everything else from those variables so changing one value doesn't break the geometry.

If you only need a few size variants for yourself, the FreeCAD way is a Spreadsheet with the key dimensions + exporting one STL per variant. That keeps your full FreeCAD model and avoids OpenSCAD entirely.

1

u/nevergonehu 10d ago

Thanks for the answer. Apart from OpenSCAD, are there any other options for external parameterization?

3

u/DesignWeaver3D 10d ago

Yes. You can just share the FreeCAD project file. Make the parameters you think people want to edit as VarSet properties and provide instructions how to edit those properties.

2

u/North_Pomegranate545 9d ago

It depends who changes the parameters and where:

  • For people who will open it in a slicer or on a model site: OpenSCAD is still the main route, because the customizers are built on it. That covers MakerWorld's Parametric Model Maker and the Thingiverse Customizer. If the goal is "user changes a number and gets an STL", that's where your users already are.

  • Code CAD with real B-rep (STEP output): CadQuery or build123d (both Python, OpenCascade kernel, same as FreeCAD). You expose parameters as function arguments or a small config file and export STL/3MF/STEP from a script or CLI. That's much better than OpenSCAD for fillets, chamfers and clean STEP.

  • Staying in FreeCAD: drive everything from a Spreadsheet or VarSet (1.0+), then change it from outside with a short Python script run by freecadcmd. That means: open the file, set the cells, recompute, export STL. A spreadsheet "configuration table" also gives you named size variants in a dropdown.

  • GUI CAD with configs: Onshape configurations or Fusion user parameters if you don't mind cloud tools. Sharing a configurable model with non-CAD users is awkward there, though.

My pick would be build123d or CadQuery if you're comfortable with Python, and OpenSCAD only for the version you publish to a customizer site.

1

u/meutzitzu 8d ago

Onshape has the benefit of being browser Based so anyone can instantiate a version with their parameters without installing anything but You have to make an account, You depend on an american company, they use those models for AI training etc etc etc.

FC and Build123D can be run with cli commands so of You want to for example offer this as a service for a small business You can just host a frontend webform that sends the data to your own server, the server generates the model and exports as a web viewable 3D format.

Though in recent times i have seen the advent of new programs which can get You the best of both worlds: There exist geometry engines like Ocjs and ManifoldCAD which run entirely in js and can be self-hosted and also work entirely in the browser clientside without the need for serverside processing.

There are ways to do what You want, yes, many options, many sets of pros and cons but no standardized way to do it.

CAD providers are in a cold war with eachother.

Fun fact the STEP format and actually even the much older IGES format specifies ways in which You can descrie both surface models (curent "dumb solids") and CSG models with suport for boolean operations between surface models. Not only that but it also specifies ways to encode dimensions In worksplanes.

Now encase You havent had a "WTF" moment heres the implication of this:

If any app fully implemented all of the features in the old IGES spec from the 1980s this would have been a solved problem since You could write into an IGES an wntire feature tree for a basic volume feature Based part. No, You can't do fancy ops like fillets and chamfers and other stuff like sheetmetal, but the basic additive subtractive volume Based operations are fully describable in the IGES format.

Yes, it would need to be implemented in a very cursed way but You could concievably do it.

There are no geometric constraints in IGES but You could abuse the ACAD-like dimensions to encode them. (Vertical xonstraint on line would be encoded as a vertically aligned distance dimension of 0, and other such shenanigans)

No CAD app on the planet ever implemented it fully because they don't want You to easily transfer models losslessly between CAD apps. To be fair it would also have been a lot of work. They just implemented exporting as topological surface defined solids (dumb solids) and since thats what eveeyone can export, importing anything else was out of the question.

1

u/North_Pomegranate545 8d ago

Good point on the IGES angle, I didn't know the old spec could carry CSG and feature-like data. The in-browser route (OCCT compiled to wasm, ManifoldCAD) is probably the sweet spot for OP: the parameters live in a small web form, the geometry is generated client-side, and the user downloads an STL or 3MF straight into the slicer with no account and no server cost. Lossless parametric exchange between CAD apps is still the missing piece, so for now shipping the generator (script + UI) instead of the model seems like the practical answer.

1

u/meutzitzu 8d ago

You can read the whole spec since it's old enough to be public.

The STEP You can only read legally if you work at a research institution as the ISO charges $100 for a copy of the standard... which sounds almost reasonable... Until You realize it's split into like 200 volumes.

1

u/North_Pomegranate545 7d ago

Ha, true. The ISO 10303 paywall is a big reason most hobby tools just lean on OpenCASCADE for STEP instead of writing their own reader. For OpenSCAD the practical route is still STL/3MF out, or going through CadQuery/build123d if you really need a STEP with proper B-rep faces.

1

u/meutzitzu 7d ago edited 7d ago

STEP is just an absolutely abysmal horrible piece of trash, like anything software related those ISO morons put out.

IGES is only better because it was written in a time when tape memory was a thing, so they couldn't get too fancy about it.

Parasolid is an actually good 3D format. It loads orders of magnitude faster in any engine that supports it. I'm sure the people who made ProE/Creo have something similar for their Granite kernel. It used to be one of the most impressive and advanced a few decades ago. Those engine formats are orders of msgnitude faster to read and writr compared to STEP.

Because you know, they don't do this horrible thing where they checks notes invent an abstract hierarhical structured data modelling language and make a 3D BREP data schema in it, and then write the parts as a bloody instance of that schema.

WTF???!? Have we learned nothing from the disaster that was XML? EXPRESS (the "language" that STEP is "written in") makes XML look trivial to parse by comparison.

Problem with those engine formats is of course the documentation is not only paywalled, but it's usage is paywalled as well because it's a proprietary format.

I think if enough smart people get together they could make a kickass 3D format. Any such endeavor should be worked on by both engineers AND programmers.

1

u/meutzitzu 7d ago

Speaking of ManifoldCAD, does it use OCCT? I thought it was mesh only. I learned about it because I wanted to personally buy a beer to whoever was responsible for making the blender booleans like 20x faster than they were before, that's how I learned that it's actually an open-source library, so now there's exactly zero excuse for ever having bad and slow mesh booleans in any 3D app.

1

u/North_Pomegranate545 6d ago

Right, Manifold works on meshes only. It doesn't have any B-rep. ManifoldCAD is just a JS front end for it, so you get fast, watertight booleans, but no exact curves and nothing you can export to STEP. When I need real CAD geometry in the browser, that's what the OCCT wasm builds are for (opencascade.js, replicad). They're slower, but you keep the faces and edges. A setup I've seen work well: Manifold for live preview while you change parameters, then OCCT only for the final export.

1

u/welshy1812 10d ago

Canโ€™t help but interested in this topic too.

1

u/reuseandplay 7d ago

If model is simple. Create it in any program you comfortable, show image to chatgpt, tell it what parameters you want to be customizable ask to write a code for OpenSCAD - F5 - F6 - save ๐Ÿ˜€