We’re excited to announce Generators: a new feature that brings parametric CAD models to MakerRepo. While a plain @artifact function always builds the same model, a generator lets visitors on MakerRepo.com tweak dimensions, counts, or any other parameter and get a customized model built on demand.

What is a generator?

A generator is a parametric CAD model: a function that takes user-supplied parameters and produces a customized artifact. It’s the code-first answer to the “customizable parts” challenge we discussed in our Manufacturing as Code article: instead of manually exporting variants for each parameter combination, you define the parameters once in code, and MakerRepo builds whatever your visitors request.

How it works

Generators use the @customizable decorator from the mr library together with Pydantic models to define, validate, and constrain parameters. Each field in your parameter model becomes a knob users can adjust in the web UI.

Here’s a minimal example: a customizable box:

from build123d import *
from mr import customizable
from pydantic import BaseModel
from pydantic import Field


class BoxParameters(BaseModel):
    width: float = Field(default=10, gt=0)
    height: float = Field(default=10, gt=0)
    length: float = Field(default=10, gt=0)


@customizable(sample_parameters=BoxParameters(width=10, height=10, length=10))
def main(parameters: BoxParameters):
    box = Box(parameters.width, parameters.height, parameters.length)
    return box

Because parameters are Pydantic models, you get automatic validation, serialization, and clear error messages for free. Use Field constraints like gt=0, ge, le, min_length, and pattern to keep values in valid ranges.

Custom validation

For more complex validation (for example, ensuring that notch positions don’t overlap along a post), you can perform custom checks inside your generator and raise GeneratorValidationError with structured field-level errors. MakerRepo displays these in the web UI so users know exactly which fields need attention.

See the Generators documentation for the full validation example and API details.

On MakerRepo.com

  1. Push your code: CI discovers every @customizable function and registers it as a generator.
  2. Sample build: MakerRepo builds the model with your sample_parameters and displays a snapshot in the repository UI.
  3. Customize: Visitors adjust parameters in the web UI and request a new build with their values.

Generated models are cached for identical parameters, so repeat requests return instantly.

Learn more

For the complete guide (including @customizable arguments, performance considerations, and a full working example), head to the Generators documentation.

You can also explore the generator_example.py file in the open-models repository for a real-world example.

We’re still in the early stages with generators and plan to add features like B-Rep caching and local CLI support in future releases. We’re also working on improving the performance of model generation—stay tuned! Try it out and let us know what you think! Any feedback or suggestions are welcome at support@makerrepo.com. 😄👍