Parameters and rules

Parameters

Each feature value in Meridian is a named parameter. For example, the distance of the first extrude is Extrude1_Distance. You can also add user parameters.

To see and change the parameters, select Tools > Parameters.

Expressions

A parameter value can be a number or an expression.

Example Result
25 25 in the document unit. In a millimeter document, this is 25 mm. In an inch document, this is 25 in.
2 in 2 inches (50.8 mm).
120/2 Meridian keeps the value 60 mm.
Thickness * 2 Two times the parameter Thickness.
Sqrt(Width ^ 2 + Height ^ 2) The diagonal of a rectangle.

Units

You can write these units after a number: mm, cm, m, in and deg. A number without a unit uses the unit of the document. Angles are in degrees.

Operators

Operator Meaning
+ - * / Add, subtract, multiply, divide
\ Integer division (Meridian rounds both values, divides, and removes the fraction)
^ Power
Mod Remainder

Functions

Group Functions
Trigonometry Sin, Cos, Tan, Asin, Acos, Atan
Trigonometry in degrees SinD, CosD, TanD, AsinD, AcosD, AtanD
Angle conversion Radians, Degrees
Rounding Round, Ceiling, Floor, Int, Fix
Other Sqrt, Abs, Min, Max, Exp, Log, Sign
Constant PI

In a parameter expression, Meridian knows when a value is an angle. Thus Sin, Cos and Tan of an angle parameter use its degrees. In a rule, these functions use radians. Refer to Angles in rules.

References

Rules for expressions

Meridian Rules

A rule is a short program that changes parameters and properties. The language is similar to Visual Basic.

To write and run rules, select Tools > Rules. To run the selected rule, select Tools > Run Rule.

Example

' Comments start with ' or //
Extrude1_Distance = 35
Param("BoltPattern1_Count") = Round(Extrude1_Distance / 5)
Properties("Revision Number") = "R1"
Dim ratio = 0.5

If Extrude1_Distance >= 30 And Properties("Material") <> "Aluminum" Then
    EdgeFillet1_Radius = 4
ElseIf Extrude1_Distance < 10 Then
    EdgeFillet1_Radius = 1
Else
    EdgeFillet1_Radius = 2
End If

Statements

Statement What it does
Name = value Sets a parameter.
Param("name") = value Sets a parameter. Parameters("name") is the same.
Properties("name") = "text" Sets a document property. Property("name") is the same.
Dim name = value Makes a variable that only the rule uses.
If ... Then ... ElseIf ... Else ... End If Runs lines only when a condition is true. A short If can be on one line.

More operators in rules

Angles in rules

In a rule, Sin, Cos and Tan use radians. The unit deg does not change a value to radians. Thus Sin(30 deg) is the sine of 30 radians. For degrees, use SinD, CosD and TanD. For example, SinD(30) is 0.5. You can also use Radians(x) and Degrees(x).

How a rule runs

Run a rule from the command line

meridian rule part.mpart myrule.txt --save
meridian rule part.mpart -e "Extrude1_Distance = 40" --out part-40.mpart

Refer to Command line.