Arithmetic Operators
Arithmetic operators are used to perform arithmetic operations between variables and/or values. Given y=5, the table below explains these arithmetic operators:
| Operator | Description | Example | Result |
|---|---|---|---|
| + | Addition | x=y+2 | x = 7 |
| - | Subtraction | x=y-2 | x = 3 |
| * | Multiplication | x=y*2 | x = 10 |
| / | Division | x=y/2 | x = 2.5 |
| % | Modulus (remainder) | x=y%2 | x = 1 |
Comparison Operators
Comparison operators are used in logical statements to determine equality or difference between variables or values. Given x=5, the table below explains comparison operators:
| Operator | Description | Example |
|---|---|---|
| == | Equal to | x==8 is false |
| === | Strict equal (value and type) | x===5 is true; x==="5" is false |
| != | Not equal | x!=8 is true |
| > | Greater than | x>8 is false |
| < | Less than | x<8 is true |
| >= | Greater than or equal to | x>=8 is false |
| <= | Less than or equal to | x<=8 is true |
Logical Operators
Logical operators are used to determine the logic between variables or values. Given x=6 and y=3, the table below explains logical operators:
| Operator | Description | Example |
|---|---|---|
| && | AND | (x < 10 && y > 1) is true |
| \ | \ | |
| ! | NOT | !(x==y) is true |
Conditional Operator
Syntax: variablename = (condition) ? value1 : value2
Example:
(k > 500) ? 25 : 18
If the value in variable k is greater than 500, returns 25, otherwise returns 18.
Common Functions
| Function Name | Description | Example |
|---|---|---|
| CP(direction, spacing, quantity) | Copy array | CP([1,0,0], 100, 10) |
| DRAWER_DEPTH(inner_depth, depth_value_array) | Automatically get drawer depth value | DRAWER_DEPTH(420, [300, 350, 400, 450, 500]), depth_value_array can be empty |
| MITERED(reference_point, face_normal, rotation_axis, angle) | 45-degree chamfer processing for panels | MITERED(0, [1,0,0], [0,-1,0], 90) |
| HIDE_EDGE(hidden_face) | Hide specified edges of panel | HIDE_EDGE([[1,0,0], [0,1,0]]) |
| CUT_PANEL(cutting_face, start_point, end_point, depth, whether_to_cut) | Cut panel shape | CUT_PANEL('right', [bh, 20, g], [bh, 30, 0], 5, true) |
| ADD_HOLE(center_point, size, drilling_face_normal, direction, whether_to_drill/array) | Parameterized hole drilling | ADD_HOLE([20, 20, bh], [5, 5, 5], [0, 0, 1], [1, 0, 0], [[5, 20, [1, 0, 0]], [5, 20, [0, 1, 0]]]) |
| ADD_GROOVE(center_point, size, grooving_face_normal, direction, whether_to_groove/array) | Parameterized grooving | ADD_GROOVE([20, 20, bh], [5, 5, 5], [0, 0, 1], [1, 0, 0], [[5, 20, [1, 0, 0]], [5, 20, [0, 1, 0]]]) |