v1.1
|
|
Style template includes:
A parameter and port description file in JSON format must contain the object style parameter groups in the following structure:
The metadata
section contains data that will be displayed in the Categories window in Renga Professional. The style template version must be specified as 3 numbers separated by dots, such as "1.2.34".
The styleParameters
section contains parameter groups that describe all possible object style parameters. The visibility of parameter groups in the object style editor can be enabled or disabled using the Style Template API functions.
Each parameter must contain a name, text, and type. Depending on the parameter type, additional data is specified.
Allowed parameter types:
Value | Description |
---|---|
Integer | Integer |
Real | Real number |
String | String |
CoreEnum | Style Template API enumeration |
UserEnum | User enumeration |
Length | The length in millimeters |
Angle | The angle in decimal degrees |
Id | Identifier |
Boolean | Boolean (true/false) |
For all parameter types except Id
, you can specify the default
key. The value of this key will be the default value of the parameter. The value cannot be empty.
For numeric parameters, you can set the minimum and maximum values using the min
and max
keys.
For CoreEnum
, specify the CoreEnumType
key. Valid values for the key can be found in the Core Enums section.
For UserEnum
, create an items
array and set the values to select from the list.
For the Id
parameter type, you must specify the entityTypeId
key, the value of which should be specified according to the Renga API help. Currently, you can only set a link to the material:
The ports
section includes groups of parameters for describing ports.
The port description should include the name, text, flowDirection
, and a set of valid categories for pipe, duct, or electrical systems, known as systemCategories
.
Allowed flow directions:
Pipe system categories:
Duct system categories:
Electrical system categories:
The pipe accessory and duct accessory port descriptions may include a portRole
parameter to define the role of the port. Valid values:
Value | Description |
---|---|
TransitPort | Port for placing the object on a route. |
EndPort | Port to create a route from the object |
For example, to allow a pipe accessory to be both placed on a pipe route and connected to an electrical system, describe the ports as follows:
Using a Lua script, you can create an object style description. This allows you to create a three-dimensional model of the object that can be modified using parameters, represent the object for display on drawings, specify which parameters to display in the object style editor in Renga, and set the connection parameters and the position of ports.
A Lua script may contain:
Functions for specifying geometry, port positions, connection parameters, and setting the display of object style parameters are located in the Style
namespace.
To get parameters, use the Style.GetParameter()
function, and to get parameter values, use the Style.GetParameterValues()
function, which returns a table of parameters.
Example of getting a parameter value with Style.GetParameterValues()
:
In this case, the value of the "BodyWidth" parameter from the "Dimensions" parameter group will be printed to the log.
To set the visibility of parameters in the object style editor, you must get the parameter group or to the parameter object using the functions Style.GetParameterGroup(groupName)
or Style.GetParameter(groupName, parameterName)
.
Detailed geometry defines the object 3D model. To set the detailed geometry, the Style.SetDetailedGeometry(modelGeometry)
function is used, which takes as an argument the model geometry created using the Style Template API functions and classes.
For example:
Symbol geometry defines the symbol that will be displayed in a drawing. It can be created for the following types of objects:
To set the symbol geometry, the Style.SetSymbolGeometry(modelGeometry)
function is used, which takes as an argument the model geometry created using the Style Template API functions and classes.
Symbolic geometry defines the symbolic representation of an object in a drawing. It can be created for the following types of objects:
To set the symbolic geometry, the Style.SetSymbolicGeometry(modelGeometry)
function is used, which takes as an argument the model geometry created using the Style Template API functions and classes.
In a script, you can set:
You can get the port using the Style.GetPort(portName)
function, which takes as an argument the port name specified in the file with parameter and port descriptions.