diff --git a/src/components/Customizer.tsx b/src/components/Customizer.tsx
index 8145edf..a00456e 100644
--- a/src/components/Customizer.tsx
+++ b/src/components/Customizer.tsx
@@ -1,8 +1,11 @@
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
-import { Accordion, AccordionDetails, AccordionSummary } from '@mui/material';
+import Accordion from '@mui/material/Accordion';
+import AccordionDetails from '@mui/material/AccordionDetails';
+import AccordionSummary from '@mui/material/AccordionSummary';
import Checkbox from '@mui/material/Checkbox';
import FormControlLabel from '@mui/material/FormControlLabel';
import FormGroup from '@mui/material/FormGroup';
+import MenuItem from '@mui/material/MenuItem';
import TextField from '@mui/material/TextField';
import React, { useMemo } from 'react';
@@ -63,6 +66,27 @@ export default function Customizer({ parameters, onChange }: Props) {
parameter.type === 'number' ||
parameter.type === 'string'
) {
+ if (parameter.options) {
+ return (
+
+ {parameter.options.map((option, idx) => (
+
+ ))}
+
+ );
+ }
+
return (
);
diff --git a/src/lib/openSCAD/parseParameter.ts b/src/lib/openSCAD/parseParameter.ts
index ff67556..010b4ba 100644
--- a/src/lib/openSCAD/parseParameter.ts
+++ b/src/lib/openSCAD/parseParameter.ts
@@ -1,9 +1,23 @@
+type ParameterOption = {
+ value: string | number;
+ label: string;
+};
+
+type ParameterRange = {
+ min?: number;
+ max?: number;
+ step?: number;
+};
+
export type Parameter = {
name: string;
type: 'string' | 'number' | 'boolean';
value: string | boolean | number;
description?: string;
group?: string;
+ range?: ParameterRange;
+ options?: ParameterOption[];
+ maxLength?: number;
};
export default function parseParameters(script: string): Parameter[] {
@@ -13,7 +27,8 @@ export default function parseParameters(script: string): Parameter[] {
script = script.split(/^(module |function )/m)[0];
const parameters: Record = {};
- const parameterRegex = /^([a-z0-9A-Z_$]+)\s*=\s*([^;]+)/gm; // TODO: Use AST parser instead of regex
+ const parameterRegex =
+ /^([a-z0-9A-Z_$]+)\s*=\s*([^;]+);[\t\f\cK ]*(\/\/.*)?/gm; // TODO: Use AST parser instead of regex
const groupRegex = /^\/\*\s*\[([^\]]+)\]\s*\*\//gm;
const groupSections: { id: string; group: string; code: string }[] = [];
@@ -50,7 +65,48 @@ export default function parseParameters(script: string): Parameter[] {
while ((match = parameterRegex.exec(groupSection.code)) !== null) {
const name = match[1];
const value = match[2];
- let description;
+ const typeAndValue = convertType(value);
+
+ let description: string;
+ let options: ParameterOption[];
+ let range: ParameterRange;
+
+ if (match[3]) {
+ const rawComment = match[3].replace(/^\/\/\s*/, '').trim();
+ const cleaned = rawComment.replace(/^\[+|\]+$/g, '');
+
+ if (!isNaN(rawComment)) {
+ // If the cleaned comment is a number, then we assume that it is a step
+ // value (or maximum length in case of a string)
+ if (typeAndValue.type === 'string') {
+ range = { max: parseFloat(cleaned) };
+ } else {
+ range = { step: parseFloat(cleaned) };
+ }
+ } else if (rawComment.startsWith('[') && cleaned.includes(',')) {
+ // If the options contain commas, we assume that those are options for a select element.
+ options = cleaned
+ .trim()
+ .split(',')
+ .map((option) => {
+ const [value, label] = option.trim().split(':');
+ return { value, label };
+ });
+ } else if (cleaned.match(/([0-9]+:?)+/)) {
+ // If the cleaned comment contains a colon, we assume that it is a range
+ const [min, maxOrStep, max] = cleaned.trim().split(':');
+
+ if (min && (maxOrStep || max)) {
+ range = { min: parseFloat(min) };
+ }
+ if (max || maxOrStep || min) {
+ range = { ...range, max: parseFloat(max || maxOrStep || min) };
+ }
+ if (max && maxOrStep) {
+ range = { ...range, step: parseFloat(maxOrStep) };
+ }
+ }
+ }
// Now search for the comment right above the parameter definition. This is done
// by splitting the script at the parameter definition and using the last line
@@ -71,7 +127,9 @@ export default function parseParameters(script: string): Parameter[] {
description,
group: groupSection.group,
name,
- ...convertType(value),
+ range,
+ options,
+ ...typeAndValue,
};
}
});
diff --git a/tests/__snapshots__/openSCADparseParameters.test.ts.snap b/tests/__snapshots__/openSCADparseParameters.test.ts.snap
index 1b7275e..4563487 100644
--- a/tests/__snapshots__/openSCADparseParameters.test.ts.snap
+++ b/tests/__snapshots__/openSCADparseParameters.test.ts.snap
@@ -6,6 +6,8 @@ exports[`testing parameter parsing of openscad scripts testing checkbox.scad: ch
"description": "description",
"group": undefined,
"name": "Variable",
+ "options": undefined,
+ "range": undefined,
"type": "boolean",
"value": true,
},
@@ -18,6 +20,25 @@ exports[`testing parameter parsing of openscad scripts testing dropDownBox.scad:
"description": "combo box for number",
"group": undefined,
"name": "Numbers",
+ "options": [
+ {
+ "label": undefined,
+ "value": "0",
+ },
+ {
+ "label": undefined,
+ "value": "1",
+ },
+ {
+ "label": undefined,
+ "value": "2",
+ },
+ {
+ "label": undefined,
+ "value": "3",
+ },
+ ],
+ "range": undefined,
"type": "number",
"value": 2,
},
@@ -25,6 +46,21 @@ exports[`testing parameter parsing of openscad scripts testing dropDownBox.scad:
"description": "combo box for string",
"group": undefined,
"name": "Strings",
+ "options": [
+ {
+ "label": undefined,
+ "value": "foo",
+ },
+ {
+ "label": undefined,
+ "value": "bar",
+ },
+ {
+ "label": undefined,
+ "value": "baz",
+ },
+ ],
+ "range": undefined,
"type": "string",
"value": "foo",
},
@@ -32,6 +68,21 @@ exports[`testing parameter parsing of openscad scripts testing dropDownBox.scad:
"description": "labeled combo box for numbers",
"group": undefined,
"name": "Labeled_values",
+ "options": [
+ {
+ "label": "S",
+ "value": "10",
+ },
+ {
+ "label": "M",
+ "value": "20",
+ },
+ {
+ "label": "L",
+ "value": "30",
+ },
+ ],
+ "range": undefined,
"type": "number",
"value": 10,
},
@@ -39,6 +90,21 @@ exports[`testing parameter parsing of openscad scripts testing dropDownBox.scad:
"description": "labeled combo box for string",
"group": undefined,
"name": "Labeled_value",
+ "options": [
+ {
+ "label": "Small",
+ "value": "S",
+ },
+ {
+ "label": "Medium",
+ "value": "M",
+ },
+ {
+ "label": "Large",
+ "value": "L",
+ },
+ ],
+ "range": undefined,
"type": "string",
"value": "S",
},
@@ -51,6 +117,25 @@ exports[`testing parameter parsing of openscad scripts testing example1.scad: ex
"description": "combo box for number",
"group": "Drop down box:",
"name": "Numbers",
+ "options": [
+ {
+ "label": undefined,
+ "value": "0",
+ },
+ {
+ "label": undefined,
+ "value": "1",
+ },
+ {
+ "label": undefined,
+ "value": "2",
+ },
+ {
+ "label": undefined,
+ "value": "3",
+ },
+ ],
+ "range": undefined,
"type": "number",
"value": 2,
},
@@ -58,6 +143,21 @@ exports[`testing parameter parsing of openscad scripts testing example1.scad: ex
"description": "combo box for string",
"group": "Drop down box:",
"name": "Strings",
+ "options": [
+ {
+ "label": undefined,
+ "value": "foo",
+ },
+ {
+ "label": undefined,
+ "value": "bar",
+ },
+ {
+ "label": undefined,
+ "value": "baz",
+ },
+ ],
+ "range": undefined,
"type": "string",
"value": "foo",
},
@@ -65,6 +165,21 @@ exports[`testing parameter parsing of openscad scripts testing example1.scad: ex
"description": "labeled combo box for numbers",
"group": "Drop down box:",
"name": "Labeled_values",
+ "options": [
+ {
+ "label": "L",
+ "value": "10",
+ },
+ {
+ "label": "M",
+ "value": "20",
+ },
+ {
+ "label": "XL",
+ "value": "30",
+ },
+ ],
+ "range": undefined,
"type": "number",
"value": 10,
},
@@ -72,6 +187,21 @@ exports[`testing parameter parsing of openscad scripts testing example1.scad: ex
"description": "labeled combo box for string",
"group": "Drop down box:",
"name": "Labeled_value",
+ "options": [
+ {
+ "label": "Small",
+ "value": "S",
+ },
+ {
+ "label": "Medium",
+ "value": "M",
+ },
+ {
+ "label": "Large",
+ "value": "L",
+ },
+ ],
+ "range": undefined,
"type": "string",
"value": "S",
},
@@ -79,6 +209,11 @@ exports[`testing parameter parsing of openscad scripts testing example1.scad: ex
"description": "slider widget for number",
"group": "Slider",
"name": "slider",
+ "options": undefined,
+ "range": {
+ "max": 100,
+ "min": 10,
+ },
"type": "number",
"value": 34,
},
@@ -86,6 +221,12 @@ exports[`testing parameter parsing of openscad scripts testing example1.scad: ex
"description": "step slider for number",
"group": "Slider",
"name": "stepSlider",
+ "options": undefined,
+ "range": {
+ "max": 100,
+ "min": 0,
+ "step": 5,
+ },
"type": "number",
"value": 2,
},
@@ -93,6 +234,8 @@ exports[`testing parameter parsing of openscad scripts testing example1.scad: ex
"description": "description",
"group": "Checkbox",
"name": "Variable",
+ "options": undefined,
+ "range": undefined,
"type": "boolean",
"value": true,
},
@@ -100,6 +243,8 @@ exports[`testing parameter parsing of openscad scripts testing example1.scad: ex
"description": "spinbox with step size 1",
"group": "Spinbox",
"name": "Spinbox",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 5,
},
@@ -107,6 +252,8 @@ exports[`testing parameter parsing of openscad scripts testing example1.scad: ex
"description": "Text box for vector with more than 4 elements",
"group": "Textbox",
"name": "Vector6",
+ "options": undefined,
+ "range": undefined,
"type": "string",
"value": "[12,34,44,43,23,23]",
},
@@ -114,6 +261,8 @@ exports[`testing parameter parsing of openscad scripts testing example1.scad: ex
"description": "Text box for string",
"group": "Textbox",
"name": "String",
+ "options": undefined,
+ "range": undefined,
"type": "string",
"value": "hello",
},
@@ -121,6 +270,12 @@ exports[`testing parameter parsing of openscad scripts testing example1.scad: ex
"description": "Text box for vector with less than or equal to 4 elements",
"group": "Special vector",
"name": "Vector1",
+ "options": undefined,
+ "range": {
+ "max": 50,
+ "min": 0,
+ "step": 2,
+ },
"type": "string",
"value": "[12]",
},
@@ -128,6 +283,12 @@ exports[`testing parameter parsing of openscad scripts testing example1.scad: ex
"description": undefined,
"group": "Special vector",
"name": "Vector2",
+ "options": undefined,
+ "range": {
+ "max": 50,
+ "min": 0,
+ "step": 2,
+ },
"type": "string",
"value": "[12,34]",
},
@@ -135,6 +296,12 @@ exports[`testing parameter parsing of openscad scripts testing example1.scad: ex
"description": undefined,
"group": "Special vector",
"name": "Vector3",
+ "options": undefined,
+ "range": {
+ "max": 50,
+ "min": 0,
+ "step": 2,
+ },
"type": "string",
"value": "[12,34,46]",
},
@@ -142,6 +309,12 @@ exports[`testing parameter parsing of openscad scripts testing example1.scad: ex
"description": undefined,
"group": "Special vector",
"name": "Vector4",
+ "options": undefined,
+ "range": {
+ "max": 50,
+ "min": 0,
+ "step": 2,
+ },
"type": "string",
"value": "[12,34,46,24]",
},
@@ -154,6 +327,11 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": "How high should each segment be?",
"group": "Shape parameters",
"name": "segment_heights",
+ "options": undefined,
+ "range": {
+ "max": 2,
+ "min": 0,
+ },
"type": "string",
"value": "[35, 35, 35, 35, 35]",
},
@@ -161,6 +339,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": "How wide should each segment be?",
"group": "Shape parameters",
"name": "segment_diameters",
+ "options": undefined,
+ "range": undefined,
"type": "string",
"value": "[140, 100, 120, 90, 110, 90]",
},
@@ -168,6 +348,21 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": "The shape of the twig",
"group": "Shape parameters",
"name": "twig_shape",
+ "options": [
+ {
+ "label": undefined,
+ "value": "circle",
+ },
+ {
+ "label": undefined,
+ "value": "square",
+ },
+ {
+ "label": undefined,
+ "value": "ellipse",
+ },
+ ],
+ "range": undefined,
"type": "string",
"value": "circle",
},
@@ -175,6 +370,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": "How much should the twigs be twisted?",
"group": "Shape parameters",
"name": "twig_twist",
+ "options": undefined,
+ "range": undefined,
"type": "string",
"value": "[25, 25, 25, 0, 25]",
},
@@ -182,6 +379,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": "How much should the twigs in the counter direction be twisted?",
"group": "Shape parameters",
"name": "twig_counter_twist",
+ "options": undefined,
+ "range": undefined,
"type": "string",
"value": "[25, 25, 25, 0, 25]",
},
@@ -189,6 +388,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": "How thick should a twig be?",
"group": "Shape parameters",
"name": "twig_diameter",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 3,
},
@@ -196,6 +397,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": "How many twigs should there be?",
"group": "Shape parameters",
"name": "twig_count",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 25,
},
@@ -203,6 +406,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": "How many twigs should be in the other direction?",
"group": "Shape parameters",
"name": "twig_counter_count",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 25,
},
@@ -210,6 +415,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": "The height of the top ring",
"group": "Shape parameters",
"name": "top_height",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 15,
},
@@ -217,6 +424,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": "The height of the bottom ring",
"group": "Shape parameters",
"name": "bottom_height",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 5,
},
@@ -224,6 +433,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": "How big is the thing you want to put in here?",
"group": "Socket parameters",
"name": "socket_diameter",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 81,
},
@@ -231,6 +442,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": undefined,
"group": "Socket parameters",
"name": "socket_step_top_offset",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 2,
},
@@ -238,6 +451,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": undefined,
"group": "Socket parameters",
"name": "socket_step_height",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 2.5,
},
@@ -245,6 +460,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": undefined,
"group": "Socket parameters",
"name": "socket_step_diameter",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 87,
},
@@ -252,6 +469,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": "Override the general settings and let the randomizer go wild!",
"group": "Randomize Parameters",
"name": "override_values",
+ "options": undefined,
+ "range": undefined,
"type": "boolean",
"value": false,
},
@@ -259,6 +478,12 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": "The seed for the random number generator.",
"group": "Randomize Parameters",
"name": "seed",
+ "options": undefined,
+ "range": {
+ "max": 9999999,
+ "min": 1,
+ "step": 1,
+ },
"type": "number",
"value": 1.1,
},
@@ -266,6 +491,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": "The amount of segments will be chosen between those two numbers.",
"group": "Randomize Parameters",
"name": "min_max_segment_count",
+ "options": undefined,
+ "range": undefined,
"type": "string",
"value": "[2, 5]",
},
@@ -273,6 +500,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": "The height of each segment is between those two numbers.",
"group": "Randomize Parameters",
"name": "min_max_heights",
+ "options": undefined,
+ "range": undefined,
"type": "string",
"value": "[0, 180]",
},
@@ -280,6 +509,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": "Min/max of all the diameters.",
"group": "Randomize Parameters",
"name": "min_max_diameters",
+ "options": undefined,
+ "range": undefined,
"type": "string",
"value": "[100, 180]",
},
@@ -287,6 +518,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": "The amount of twig twist will be between those two numbers.",
"group": "Randomize Parameters",
"name": "min_max_twig_twist",
+ "options": undefined,
+ "range": undefined,
"type": "string",
"value": "[0, 180]",
},
@@ -294,6 +527,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": "Min/max of the twig diameter.",
"group": "Randomize Parameters",
"name": "min_max_twig_diameter",
+ "options": undefined,
+ "range": undefined,
"type": "string",
"value": "[2, 20]",
},
@@ -301,6 +536,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": "The twig count of both twig directions will be between those two numbers.",
"group": "Randomize Parameters",
"name": "min_max_twig_count",
+ "options": undefined,
+ "range": undefined,
"type": "string",
"value": "[5, 15]",
},
@@ -308,6 +545,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": undefined,
"group": "Quality settings",
"name": "shell_fn",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 5,
},
@@ -315,6 +554,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": undefined,
"group": "Others",
"name": "show_labels",
+ "options": undefined,
+ "range": undefined,
"type": "boolean",
"value": false,
},
@@ -322,6 +563,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-513382
"description": undefined,
"group": "Others",
"name": "show_parameters",
+ "options": undefined,
+ "range": undefined,
"type": "boolean",
"value": false,
},
@@ -334,6 +577,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-682650
"description": "Size of the panel on the x-axis",
"group": "Basics",
"name": "length",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 180,
},
@@ -341,6 +586,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-682650
"description": "Size of the panel on the y-axis",
"group": "Basics",
"name": "depth",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 180,
},
@@ -348,6 +595,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-682650
"description": "Should a backplate be used?",
"group": "Basics",
"name": "use_backplate",
+ "options": undefined,
+ "range": undefined,
"type": "boolean",
"value": false,
},
@@ -355,6 +604,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-682650
"description": "Size of a single cube on the x-axis",
"group": "Cube parameters",
"name": "cube_length",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 20,
},
@@ -362,6 +613,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-682650
"description": "Size of a single cube on the y-axis",
"group": "Cube parameters",
"name": "cube_depth",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 20,
},
@@ -369,6 +622,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-682650
"description": "Minimum height of a single cube",
"group": "Cube parameters",
"name": "cube_min_height",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 5,
},
@@ -376,6 +631,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-682650
"description": "Maximum height of a single cube",
"group": "Cube parameters",
"name": "cube_max_height",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 80,
},
@@ -383,6 +640,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-682650
"description": "Wall thickness of cube",
"group": "Cube parameters",
"name": "cube_wall_thickness",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 1,
},
@@ -390,6 +649,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-682650
"description": "Top perimeter thickness",
"group": "Cube parameters",
"name": "cube_top_thickness",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 2,
},
@@ -397,6 +658,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-682650
"description": "Which seed to use? -1 generates a new layout with each generation",
"group": "Cube parameters",
"name": "seed_value",
+ "options": undefined,
+ "range": undefined,
"type": "string",
"value": "-1",
},
@@ -404,6 +667,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-682650
"description": undefined,
"group": "Hanging holes",
"name": "use_hanging_holes",
+ "options": undefined,
+ "range": undefined,
"type": "boolean",
"value": true,
},
@@ -411,6 +676,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-682650
"description": "The thickness of the baseplate where the opening for the screw/nail is",
"group": "Hanging holes",
"name": "wall_hole_thickness",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 1,
},
@@ -418,6 +685,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-682650
"description": "The diameter of the center hole",
"group": "Hanging holes",
"name": "wall_hole_center_size",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 7,
},
@@ -425,6 +694,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-682650
"description": "The diameter of the screw so it can slide along the hanging hole handles",
"group": "Hanging holes",
"name": "wall_hole_screw_d",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 3,
},
@@ -432,6 +703,8 @@ exports[`testing parameter parsing of openscad scripts testing printables-682650
"description": "The thickness of the head of the screw, so it will fit behind the hole",
"group": "Hanging holes",
"name": "wall_screw_head_size",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 3,
},
@@ -444,6 +717,10 @@ exports[`testing parameter parsing of openscad scripts testing slider.scad: slid
"description": "slider widget for number with max. value",
"group": undefined,
"name": "sliderWithMax",
+ "options": undefined,
+ "range": {
+ "max": 50,
+ },
"type": "number",
"value": 34,
},
@@ -451,6 +728,11 @@ exports[`testing parameter parsing of openscad scripts testing slider.scad: slid
"description": "slider widget for number in range",
"group": undefined,
"name": "sliderWithRange",
+ "options": undefined,
+ "range": {
+ "max": 100,
+ "min": 10,
+ },
"type": "number",
"value": 34,
},
@@ -458,6 +740,12 @@ exports[`testing parameter parsing of openscad scripts testing slider.scad: slid
"description": "step slider for number",
"group": undefined,
"name": "stepSlider",
+ "options": undefined,
+ "range": {
+ "max": 100,
+ "min": 0,
+ "step": 5,
+ },
"type": "number",
"value": 2,
},
@@ -465,6 +753,12 @@ exports[`testing parameter parsing of openscad scripts testing slider.scad: slid
"description": "slider widget for number in range",
"group": undefined,
"name": "sliderCentered",
+ "options": undefined,
+ "range": {
+ "max": 10,
+ "min": -10,
+ "step": 0.1,
+ },
"type": "number",
"value": 0,
},
@@ -477,6 +771,8 @@ exports[`testing parameter parsing of openscad scripts testing specialChars.scad
"description": undefined,
"group": "Settings",
"name": "$fn",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 200,
},
@@ -484,6 +780,8 @@ exports[`testing parameter parsing of openscad scripts testing specialChars.scad
"description": undefined,
"group": "Settings",
"name": "width",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 30,
},
@@ -491,6 +789,8 @@ exports[`testing parameter parsing of openscad scripts testing specialChars.scad
"description": undefined,
"group": "Settings",
"name": "length",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 50,
},
@@ -498,6 +798,8 @@ exports[`testing parameter parsing of openscad scripts testing specialChars.scad
"description": undefined,
"group": "Hidden",
"name": "height",
+ "options": undefined,
+ "range": undefined,
"type": "number",
"value": 10,
},
@@ -510,6 +812,8 @@ exports[`testing parameter parsing of openscad scripts testing specialVector.sca
"description": "Spin box box for vector with less than or equal to 4 elements",
"group": undefined,
"name": "Vector2",
+ "options": undefined,
+ "range": undefined,
"type": "string",
"value": "[12,34]",
},
@@ -517,6 +821,8 @@ exports[`testing parameter parsing of openscad scripts testing specialVector.sca
"description": undefined,
"group": undefined,
"name": "Vector3",
+ "options": undefined,
+ "range": undefined,
"type": "string",
"value": "[12,34,45]",
},
@@ -524,6 +830,8 @@ exports[`testing parameter parsing of openscad scripts testing specialVector.sca
"description": undefined,
"group": undefined,
"name": "Vector4",
+ "options": undefined,
+ "range": undefined,
"type": "string",
"value": "[12,34,45,23]",
},
@@ -531,6 +839,12 @@ exports[`testing parameter parsing of openscad scripts testing specialVector.sca
"description": undefined,
"group": undefined,
"name": "VectorRange3",
+ "options": undefined,
+ "range": {
+ "max": 50,
+ "min": 1,
+ "step": 2,
+ },
"type": "string",
"value": "[12,34,46]",
},
@@ -538,6 +852,11 @@ exports[`testing parameter parsing of openscad scripts testing specialVector.sca
"description": undefined,
"group": undefined,
"name": "VectorRange4",
+ "options": undefined,
+ "range": {
+ "max": 50,
+ "min": 1,
+ },
"type": "string",
"value": "[12,34,45,23]",
},
@@ -550,6 +869,10 @@ exports[`testing parameter parsing of openscad scripts testing spinbox.scad: spi
"description": "spinbox with step size 0.5",
"group": undefined,
"name": "Spinbox",
+ "options": undefined,
+ "range": {
+ "step": 0.5,
+ },
"type": "number",
"value": 5.5,
},
@@ -562,6 +885,8 @@ exports[`testing parameter parsing of openscad scripts testing splitAfterFunctio
"description": "Text box for vector with more than 4 elements",
"group": undefined,
"name": "Vector6",
+ "options": undefined,
+ "range": undefined,
"type": "string",
"value": "[12,34,44,43,23,23]",
},
@@ -569,6 +894,10 @@ exports[`testing parameter parsing of openscad scripts testing splitAfterFunctio
"description": "Text box for string with length 8",
"group": undefined,
"name": "String",
+ "options": undefined,
+ "range": {
+ "max": 8,
+ },
"type": "string",
"value": "length",
},
@@ -581,6 +910,8 @@ exports[`testing parameter parsing of openscad scripts testing testbox.scad: tes
"description": "Text box for vector with more than 4 elements",
"group": undefined,
"name": "Vector6",
+ "options": undefined,
+ "range": undefined,
"type": "string",
"value": "[12,34,44,43,23,23]",
},
@@ -588,6 +919,10 @@ exports[`testing parameter parsing of openscad scripts testing testbox.scad: tes
"description": "Text box for string with length 8",
"group": undefined,
"name": "String",
+ "options": undefined,
+ "range": {
+ "max": 8,
+ },
"type": "string",
"value": "length",
},