Create parameter¶
The parameter can be defined in form variable=expression.
To create a parameter in the active partset or part:
select in the Main Menu Part - > Parameter item or
click Parameter button in the toolbar:
The following property panel appears.
Input fields:
defines parameter name following the naming rules of the python language for variables;
panel Expression evaluates the expression input manually as a real number by python eval() function. In the simplest case an expression is a real number. Some standard python modules (like math) are imported by default before evaluation.
Comment contains any text. This field is optional.
The property panel checks validity of the expression. For an invalid expression Apply button is disabled and an error message generated by python interpreter during the evaluation is shown in the status bar and in pop-up of Apply button.
TUI Command:
-
model.
addParameter
(Part_doc, Name, Value, Comment)¶ - Parameters
part – The current part object
string – The parameter name
number – The parameter value
string – The parameter comment
- Returns
Created object.
Write error in Python console if: - parameter name is empty. - parameter don’t have unique name. - parameter expression is empty or incorrect.
See Also a sample TUI Script of a Create Parameter operation.
Result¶
The created parameter and its current value are displayed in the Object Browser, in a special section Parameters.