Questions about parametric modeling

Hi all, I am aware that with the parametric model maker you can add comments above or after parameters that are used to embellish the menu system. For example using /* allows you to add a group header or // [0:0.5:10] adds a slider to the parameter. Is there a list or site that explains these available options?

Specifically I have a model that has an array parameter like [20, 25, 40] that is able to allow more or less array elements such as [20,25,40,25,35]. However when BL sees the variable, it breaks each number into its’ own field which then doesn’t allow the user to add or subtract from the number of elements in the array. I need for this variable to be treated more like a text field.

Any guidance would be fantastic.

Thanks!

You’re talking about the OpenSCAD customizer - which is documented with the rest of OpenSCAD.

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Customizer

Thank you thank you!!!

Any chance someone knows how to implement the item shown for vector 6 so I can use a text box?

Or if that is not an option, is there anyway to make the input boxes smaller and on the same like like is shown for vectors 1-4?

image

Thanks!

That is a text box, it says that in the example image you included.

No.

The presentation is built into the UI and automatically created based on your chosen input.

You should also be aware, that the version used in MaklerWorld Parametric UI is different from what you see in the provided guide.

You should use the guide provided and then experiment with how it looks within MakerWorld.

1 Like

Clearly I have been experimenting and thus the questions. At the moment trying to figure out how to convert the text box entry from the form into an array of numbers.

The example you provided would be written like this.

// Text box for vector with more than 4 elements
Vector6=[12,34,44,43,23,23];

You can access this in code like this…

echo(str(“Vector6 2nd ordinal = “, Vector6[1]));

Which will show the following in the console…

Vector6 2nd ordinal = 34

You don’t have to do anything special, it is a vector to start with, the UI simply falls back to a text box as it has a limit of 4 values when displaying vectors as this is the common high number for vectors within OpenSCAD, you are not limited within the code though, just in the customiser UI.

1 Like

Thanks for the recommendation. I tried it out in Bambu and openscad. In Bambu even the 6 element array comes up with 6 separate input boxes. In openscad I was getting a parse error.

I continued to play with code, research, and watch ChatGPT fail a billion times and came up with a solution. This method with the BOSL2 library is working.

// Original comma-separated string
a = “20,25,30,35,40”; // [1:50]

split_a = str_split(a, “,”); // Split string into substrings
numeric_a = [ for (s = split_a) parse_int(s) ]; // Convert substrings to integer