Need help with customizable OpenSCAD file

I have an OpenSCAD file that will generate a shape that I have then successfully printed on a Bambu Lab A1. I have been just editing the scad file to change parameters like sizes and spacing. I would like to modify the file to make it a customizable file online at Makerworld. I am having trouble finding any documentation on the process. In someone else’s post I saw a reference to this Parametric Model Maker. I tried the “open yours” link and it imported it. And it seems that every global variable becomes an editable parameter. But I can’t figure out some of the ways to control this.

For instance, some parameters pick up nearby comments as if they are descriptions of the parameters, others do not. Is this controllable?

How do I set limits for values? For instance, if an angle goes to 90 degrees, later in the calculations I use tan(A) which goes to infinity. I want to limit angles to < 90. Also, I want angles >= 0. No negative numbers.

How do I have it not make every variable editable? I want some hidden because they are not variables, they are really constants (like 25.4 to convert units).

How do I control grouping of parameters. I might want the outside dimensions in one group and inside dimensions in another with a header before each.

I want to allow input in US units (aka inches) and metric (mm). Perhaps controlled via a boolean two position switch. Switches seem to work for “true/false”, but are there others (like enums in programing languages)?

Is there any document defining parameter definition and control?

Gary

I’m very new to OpenSCAD, but a couple comments:

For instance, some parameters pick up nearby comments as if they are descriptions of the parameters, others do not. Is this controllable?

It looks like if a code comment is directly above the variable, it will be used as a hint

// This comment will show as a customizer tip
var_1 = 10;

// This comment will NOT show as a customizer tip

var_2 = 10;

How do I control grouping of parameters. I might want the outside dimensions in one group and inside dimensions in another with a header before each.

You can create sections with this:

/* [Section Title] */

for example:

/* [Section 1] */
section_1_var_1 = 10;
section_1_var_2 = 20;

/* [Section 2] */
section_2_var_1 = 30;
section_2_var_2 = 40;

How do I have it not make every variable editable? I want some hidden because they are not variables, they are really constants (like 25.4 to convert units).

Put the variables you want editable towards the top, then add this underneath them. Everything below this point will not show up in the customizer window:

/* [Hidden] */

For example:

customizable_var_1 = 10;
customizable_var_2 = 20;

/* [Hidden] */

uncustomizable_var = 30;

I cannot post a link look for this words in a search engine OpenSCAD_User_Manual Customizer

Some options

// slider widget for number with max. value
sliderWithMax =34; // [50]

// slider widget for number in range
sliderWithRange =34; // [10:100]

//step slider for number
stepSlider=2; //[0:5:100]

// slider widget for number in range
sliderCentered =0; // [-10:0.1:10]

This is a good one to add to the others already provided.

// Type of shape
Type_of_Shape = 0; // [0:Cube,1:Sphere,2:Cylinder]

Type_of_Shape displays with spaces for underscores

Type of Shape

The UI shows

Cube
Sphere
Cylinder

The variable returns the number.

Adding a comment immediately preceding the variable declaration appears with the form field in the UI.

Hello
all the answers here are good.

The official Documentation is here
https://en.m.wikibooks.org/wiki/OpenSCAD_User_Manual/Customizer

a simple example of a customizable is here:

Greetings roebi