Reinforcement labeling
Abstract
In this article you'll learn how to:
- label rebars and meshes
- how to do it for newly created as well as existing reinforcement
- place rebar or mesh schemas
Rebars
Rebar labels are represented with BarLabel
class.
There are four main type of labels (see also LabelTypes
class):
Label type | Scheme |
---|---|
Label with pointer | ![]() |
Label with fan | ![]() |
Label with comb | ![]() |
Label with dimension line | ![]() |
Class diagram
classDiagram
direction BT
class BarLabel {
str AdditionalText
BarLabelPointerProperties PointerProperties
bool ShowTextPointer
list[int] VisibleBars
TextProperties TextProperties
}
class LabelType{
<<Enumeration>>
LabelWithComb
LabelWithDimensionLine
LabelWithFan
LabelWithPointer
}
class BarLabelProperties{
bool ShowPositionNumber
bool ShowBarDiameter
bool ShowBarDistance
bool ShowBarCount
bool ShowSteelGrade
}
class TextProperties{
eTextAlignment Alignment
int BackgroundColor
int Font
}
class BarLabelPointerProperties {
int Color
float CombLineAngle
int EndSymbol
float EndSymbolSize
int Pen
bool ShowTextPointerEndSymbol
int Stroke
}
LabelType "1" --o BarLabel
BarLabelProperties "1" --o BarLabel
BarLabelPointerProperties "1" --o BarLabel
TextProperties "1" --o BarLabel
The composition of BarLabel
is shown on the UML diagram
above:
LabelType
determines the type of the labelBarLabelProperties
defines what will be displayed on the label.TextProperties
defines the styling of the label.BarLabelPointerProperties
defines the styling of the leader.
Info
BarLabel
can be used to label only placements
represented with BarPlacement
i.e.,
linear and rotational ones! Currently, it is not possible to label other placements, such as
CircularAreaElement
or
ExtrudeBarPlacement
.
BarLabel
should not be confused
with LabelElement
, which represents general
label texts in ALLPLAN, whereas BarLabel is an object dedicated for rebars.
Define bar label
First, define what information the label should include. This is done with
BarLabelProperties
:
label_properties = AllplanReinf.BarLabelProperties()
label_properties.ShowPositionNumber = True
label_properties.ShowBarDiameter = True
label_properties.ShowBarDistance = False
...
Next, define the styling of the label with TextProperties
:
text_properties = AllplanBasisElements.TextProperties()
text_properties.Alignment = AllplanBasisElements.TextAlignment.eRightMiddle
...
Next, define the styling of the leader with BarLabelPointerProperties
.
Skip this step if your label does not include any leader (ShowTextPointer
set to False
):
pointer_properties = AllplanReinf.BarLabelPointerProperties()
pointer_properties.EndSymbol = 1
pointer_properties.Color = 1
# options relevant only for label with comb
pointer_properties.CombLineByLength = True #(1)!
pointer_properties.CombLineValue = 200 #(2)!
pointer_properties.CombLineAngle = 45
...
- When set to True, the comb tines will have a fixed length, defined in
combLineValue
. Otherwise, thecombLineValue
will be the distance between labeled rebar and the tip of the comb tine - This length/distance is given in millimeter on a print layout! It will therefore vary depending on the scale set in DF.
Tip
For the leader styling, you can use a dedicated parameter of value type ReinfBarLabelPointer
.
Here
you can learn more.
Now you can construct BarLabel
. The definition
varies, depending on the label type:
This type of label is recommended, when the rebar shape is displayed in its real dimensions (view direction is perpendicular to the rebar plane). This type of label consists of the label text and (optionally) a leader. There are two ways to define it:
By providing the reference point of the label in the global coordinate system
(as a Point2D
):
label = AllplanReinf.BarLabel(
reinforcementType = AllplanReinf.Bar,
type = AllplanReinf.LabelType.LabelWithPointer,
positionNumber = 1,
labelProp = label_properties,
labelPoint = AllplanGeo.Point2D(...), #(1)!
angle = AllplanGeo.Angle())
-
The placement point. The Alignment you set in
text_properties
will be consider.
By providing an offset from a point located on a specified leg of the labeled rebar
(as a Vector2D
):
label = AllplanReinf.BarLabel(
reinforcementType = AllplanReinf.ReinforcementType.Bar,
type = AllplanReinf.LabelType.LabelWithPointer,
positionNumber = 1,
labelProp = label_properties,
shapeSide = 3, #(1)!
shapeSideFactor = 0.5, #(2)!
labelOffset = AllplanGeo.Vector2D(-123, 123),
angle = AllplanGeo.Angle())
-
The label will be created relative to the 3rd leg. Leg numerations starts with 1 and hooks are considered as legs.
-
This means, that the offset is calculated from the middle of the leg (indicated by the red point on the image). According to the vector in
label_offset
, the label will be created 200mm to the left from this point (the offset vector is indicated by the blue arrow on the image).
This type of label is recommended for linear placements shown on UVS, where the placement line is displayed in its real dimension. In other words: the view direction is perpendicular to the placement line.
Failure
Do not create this kind of label in a UVS, which view direction is parallel to the placement line, as this will create damaged data in the DF!
Construct the label object like so:
label = AllplanReinf.BarLabel(
reinforcementType = AllplanReinf.Bar,
type = AllplanReinf.LabelWithDimensionLine,
positionNumber = 1,
labelProp = label_properties,
bDimLineAtShapeStart = False, #(1)!
dimLineOffset = 200) #(2)!
- Assuming the placement line goes in X+ direction, setting this argument to False will create the dimension line above the placement.
-
This is the distance between the placement line and the dimension line:
This type of label is recommended when labeling multiple rebars in a UVS. But, unlike label with pointer:
- multiple leaders (a fan of leaders) to each displayed rebar are generated instead of just single one
- it is possible to place the label only by a point in global coordinate system, and not by an offset to a rebar leg
Construct the label object like so:
label = AllplanReinf.BarLabel(
reinforcementType = AllplanReinf.Bar,
type = AllplanReinf.LabelType.LabelWithFan,
positionNumber = 1,
labelProp = label_properties,
labelPoint = AllplanGeo.Point2D(...), #(1)!
angle = AllplanGeo.Angle())
-
The placement point. The Alignment you set in
text_properties
will be consider.
This type of label is recommended, when labeling longitudinal bars which are visible in a UVS as points. It is a mixture of a fan and a dimension line:
- like the fan, it has multiple leaders
- like the dimension line, it is placed by offset to the placement line
Failure
Do not create this kind of label in a UVS, which view direction is parallel to the placement line, as this will create damaged data in the DF!
Construct the label object like so:
label = AllplanReinf.BarLabel(
reinforcementType = AllplanReinf.Bar,
type = AllplanReinf.LabelType.LabelWithComb, #(1)!
positionNumber = 1,
labelProp = label_properties,
pointerProp = pointer_properties,
bDimLineAtShapeStart = True,
dimLineOffset = 200)
- This will create a comb with a number of tines equal to the number of labeled rebars.
Alternatively, we can create a comb pointing only the first and last two or three rebars.
See the documentation of the class
LabelType
to see all possible options.
Now, apply TextProperties
,
BarLabelProperties
BarLabelPointerProperties
or any other properties:
label.TextProperties = text_props
pointer_props = BarLabelPointerProperties(...)
label.ShowTextPointer = True #(1)!
label.PointerProperties = pointer_props
label.VisibleBars = [-1, 0, 1] #(2)!
label.LabelOffset = AllplanGeo.Vector2D(0,200) #(3)!
label.ShowAllBars(True) #(4)!
- For a label with comb, this option is irrelevant.
- This will result in only the first, last and the middle rebar being displayed. Relevant only for labels with comb and dimension line.
-
The label can be moved away from its initial position by a vector.
Info
Setting the
TextProperties.Alignment
in thetext_props
object toeLeftMiddle
oreRightMiddle
results in the Label being placed at the end or start of the dimension line respectively, as shown on the image above. In this case, the methodSetLabelOffset
will have no influence on the position of the label in relation to the dimension line -
Relevant for a label with dimension line. True will show all rebar markers on the dimension line, like this:
Example on GitHub
Following examples show full implementation of the above mentioned label types:
Meshes
Mesh labels are represented with MeshLabel
class.
Unlike for rebar labels, there is only one label type for meshes and its definition is similar
to rebar label with pointer.
Class diagram
classDiagram
direction BT
class MeshLabel {
Point2D LabelPoint
MeshLabelPointerProperties PointerProperties
Point2D PointerStartPoint
bool ShowTextPointer
ReinforcementLabelTextProperties TextProperties
}
class MeshLabelProperties{
bool ShowMeshCount
bool ShowMeshDimensions
bool ShowMeshType
bool ShowPositionNumber
}
class ReinforcementLabelTextProperties{
TextAlignment Alignment
int Font
int TextAngle
int TextColor
}
class MeshLabelPointerProperties {
int Color
int EndSymbol
float EndSymbolSize
int Pen
bool ShowTextPointerEndSymbol
int Stroke
}
MeshLabelProperties "1" --o MeshLabel
MeshLabelPointerProperties "1" --o MeshLabel
ReinforcementLabelTextProperties "1" --o MeshLabel
The composition of MeshLabel
is shown on the UML diagram
above:
MeshLabelProperties
defines what will be displayed on the label.ReinforcementLabelTextProperties
defines the styling of the label.MeshLabelPointerProperties
defines the styling of the leader.
Define mesh label
First, define what information the label should include. This is done with
MeshLabelProperties
:
label_properties = AllplanReinf.MeshLabelProperties()
label_properties.ShowPositionNumber = True
label_properties.ShowMeshType = True
label_properties.ShowMeshDimensions = False
...
Next, define the styling of the label with
ReinforcementLabelTextProperties
.
Skip this step, if you want to leave the settings to default:
text_properties = AllplanReinf.ReinforcementLabelTextProperties()
text_properties.Alignment = AllplanBasisElements.TextAlignment.eRightMiddle
...
Next, define the styling of the leader with MeshLabelPointerProperties
.
Skip this step if your label does not include any leader (ShowTextPointer
set to False
) or you are fine with the default settings:
pointer_properties = AllplanReinf.MeshLabelPointerProperties()
pointer_properties.EndSymbol = 1
pointer_properties.Color = 1
...
Tip
For the leader styling, you can use a dedicated parameter of value type ReinfMeshLabelPointer
.
Here
you can learn more.
Next, create the MeshLabel
object
There are two ways to define it:
By providing the reference point of the label in the global coordinate system
(as a Point2D
):
label = AllplanReinf.MeshLabel(
positionNumber = 1,
labelProp = label_properties,
labelPoint = AllplanGeo.Point2D(...))
-
The placement point. The Alignment you set in
text_properties
will be consider.
By providing an offset from a point located on a specified leg of the labeled rebar
(as a Vector2D
):
label = AllplanReinf.MeshLabel(
positionNumber = 1,
labelProp = label_properties,
shapeSide = 3, #(1)!
shapeSideFactor = 0.5, #(2)!
labelOffset = AllplanGeo.Vector2D(-123, 123))
-
The label will be created relative to the 3rd leg. Leg numerations starts with 1 and hooks are considered as legs.
-
This means, that the offset is calculated from the middle of the leg (indicated by the red point on the image). According to the vector in
label_offset
, the label will be created 200mm to the left from this point (the offset vector is indicated by the blue arrow on the image).
Finally, apply the text and leader properties (if you've defined these):
label.ShowTextPointer = True
label.PointerProperties = pointer_properties
label.TextProperties = text_properties
Labeling new elements
Follow these instructions, when you would like to create reinforcement elements and label them (e.g. in a UVS) at one go. If your goal is to only label existing reinforcement (e.g. created with another PythonPart or witch native ALLPLAN functionality), scroll further down .
To label reinforcement elements on a specific UVS, put the bar labels in a
BarLabelList
and mesh labels in
MeshLabelList
and assign them to the
properties BarLabels
and
MeshLabels
respectively
of this specific uvs instance:
To label reinforcement elements on the original position where it has been placed
(not within any UVS), append the label to the instance of
BarPlacement
or
MeshPlacement
using the
SetLabel()
method:
Labeling existing elements
Follow these steps to label existing reinforcement elements. I.e. elements, that were created using native ALLPLAN functions or other PythonPart.
Warning
Currently it is only possible to label rebar elements, and not meshes!
-
Get the
BaseElementAdapter
of the rebar representation line. Typically by implementing a selection.Info
- To learn more about what an element adapter actually is, refer to this article .
- To learn how to implement a selection, refer to this article .
- To get adapters of all the elements in the current drawing file, call
SelectAllElements()
The element adapter you'll need must be of type
BarsRepresentationLine_TypeUUID
. Here's how a filter function may look like: -
Extract the
BarsRepresentation
object from the element adapter by callingGetElement()
: -
Create a label, as explained above . When constructing
BarLabel
object, use the position number from the selected placement, like: -
Attach the label to the bars representation instance you want to label. Specifically, to the property
Label
-
Create a label
In a script object, add the
BarsRepresentation
instance with the assigned label to theModelEleList
which you will then pass to theCreateElementResult
, like:Create a python list and add the
BarsRepresentation
instance with the assigned label to it. Then usePythonPartTransaction
to create the labels.
Example on GitHub
LabelBarPlacementWithDimLine ( PYP | PY) is an advanced example showcasing the creation of label with dimension line for existing rebar elements
Schemas
Warning
Currently it is only possible to create bending schemas for newly created rebars.
It's not possible to create a schema for a mesh and for an existing rebar.
A bending schema can be created for all placements of a specific mark number (full schema) or for specific placements of that mark number (partial schema). To create a schema for a rebar position, follow these steps:
-
Create an instance of
BarSchema
and set up the options:schema = AllplanReinf.BarSchema( positionNumber = 1, #(1)! placementPoint = AllplanGeometry.Point2D(...) ) schema.AngleDimensioning = True schema.Dimensioning = False schema.SegmentDimensioning = True ...
- This is the script-internal mark number, and not the actual mark number visible to the user after creation of the reinforcement.
-
If you want to create a partial schema (include only specific placements, for full schema you can skip this step), associate the schema with the desired instances of
BarPlacement
using the methodSetPartialSchema()
: -
Add the
schema
instance to the list of model elements you want to create:
Warning
When creating a full schema with native functionality, ALLPLAN checks whether there is already a schema for the mark number and if so, prevents the user for creating a duplicate. This check is not done when creating schemas by the API. You have to check it by yourself.