v2.0
 
Style Templates of Reinforcement Units

Parameters Description File

The parameter description file in JSON format for reinforcement units must contain grouped style parameters in the following structure:

{
"metadata":{
"defaultName": "DefaultName",
"description": "Description",
"version": "1.0.0",
"author": "Author"
},
"styleParameters":[
{
"name": "Group1",
"text": "Group 1",
"params": [
{
"name": "ParameterName",
"text": "Parameter name",
"type": "Id",
"entityTypeId": "0000000-0000-0000-0000-000000000000"
}
]
},
{
"name": "Group2",
"text": "Group 2",
"params": [
{
"name": "ParameterName",
"text": "Parameter name",
"type": "Length",
"default": 595,
"min": 1,
"max": 1000000.0
}
]
}
]
}

Parameters

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.

"items" : [
{
"key" : "Item1",
"text" : "Item 1"
},
{
"key" : "Item2",
"text" : "Item 2"
},
{
"key" : "Item3",
"text" : "Item 3"
}
]

To allow a user to select a rebar style in the reinforcement unit style parameters, create an Id parameter:

{
"name": "RebarStyleId",
"text": "Rebar style",
"type": "Id",
"entityTypeId": "608edb78-96f3-40a6-a0ec-71000105581b"
}

Script File

A Lua script may contain:

  1. Getting parameters from the parameter file.
  2. Get the rebar style from the project.
  3. Description of the rebar and rebar group geometry.
  4. A symbolic geometry for display in a drawing.
  5. Setting parameter display in the object style editor.

Functions for getting parameters, adding rebars and rebar sets, specifying symbolic geometry, and customizing the display of rebar style parameters are in the Style namespace. The function to get the rebar style is in the Project namespace.

Parameters

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():

local parameters = Style.GetParameterValues()
print(parameters.Dimensions.Width)
The Style namespace contains functions to set geometry, get parameters and ports.
Definition GeometryStyleMethodRegistrator.h:12

In this case, the value of the "Width" 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).

Getting the rebar style and its parameters

To get the rebar style, use the Project.GetRebarStyle() function, which returns the rebar style by ID. Then you need to cast the obtained rebar style to the parameter container using the CastToParameterContainer() function. And then you can get the style parameters using the GetParameterValues() function.

Example of how to get rebar diameter:

local style = Project.GetRebarStyle(rebarStyleId)
local parameters = CastToParameterContainer(style)
print(parameters:GetParameterValues().RebarDiameter)
ParameterContainer CastToParameterContainer(Entity entity)
Casts an entity to parameter container, if casting is allowed.
The Project namespace contains functions to get styles.

Rebar Description

Functions for describing rebars:

  • Style.AddRebar() adds a rebar, taking as arguments the rebar style and its curve.
  • Style.AddRebarSet() adds a set of rebars, taking as arguments the rebar style, its curve and the step and count.

An example of how to add a rebar set:

Style.AddRebarSet(rebarStyleId, CreateLineSegment3D(Point3D(-500, 0, 0),
Point3D(500, 0, 0)),
Vector3D(1, 0, 0), 200, 5)
Three-dimensional point.
Three-dimensional vector.
Curve3D CreateLineSegment3D(Point3D startPoint, Point3D endPoint)
Creates line segment.

The detailed and simplified reinforcement geometry is automatically generated from the rebar description.

Symbolic Geometry

Symbolic geometry defines the symbolic representation of a reinforcement unit in a drawing.

To set the symbolic geometry, the Style.SetSymbolicGeometry(modelGeometry) function is used, which takes as an argument a model geometry. The model geometry is created from two-dimensional geometric primitives.