ALLPLAN elements
AllplanElement is an abstract representation of basically any component that can be created in a DF, from a simple 2D line to a multi-layer wall. It serves as base for all other classes and has attributes that are common for types of model elements, such as format properties represented by the CommonProperties class, or a geometry object which can by represented by any object from the geometry module.
The next level of specialization are classes, that inherits from AllplanElement. Below is an overview of them:
-
Basis elements
BasisElement represents generic elements, such as lines, dimension lines, hatches or 3D objects.
Learn more below
-
Architecture
ArchElement represents all architectural elements like walls, slabs, beams and columns.
Learn more below
-
Precast
PrecastElement represents all elements from the precast module like fixtures or assembly groups.
Learn more below
-
Reinforcement
ReinfElement represents reinforcement components, like rebars, meshes and couplers.
Learn more in a separate article
Note
There are also elements, that do not fit into any of the above mentioned categories. These inherit directly from AllplanElement class. An example of such element is the UVS, which is represented by the ViewSectionElement class.
classDiagram
direction BT
class AllplanElement{
<<Abstract>>
+CommonProperties CommonProperties
+Attributes Attributes
+GeometryObject Any
+LabelElements list[LabelElement]
}
class ReinfElement{
<<Abstract>>
}
class ArchElement{
<<Abstract>>
+ConnectionUUID GUID
}
class BasisElement{
<<Abstract>>
}
class PrecastElement{
<<Abstract>>
}
class ViewSectionElement{
+DimensionElements
+GeneralSectionProperties
+ReinforcementLabels
+SectionDefinitionData
+TextElements
+ViewMatrix
}
ReinfElement --|> AllplanElement
BasisElement --|> AllplanElement
ArchElement --|> AllplanElement
PrecastElement --|> AllplanElement
ViewSectionElement --|> AllplanElement
style AllplanElement stroke:--md-accent-fg-color, stroke-dasharray: 9 5
style ArchElement stroke:--md-accent-fg-color, stroke-dasharray: 9 5
style ReinfElement stroke:--md-accent-fg-color, stroke-dasharray: 9 5
style BasisElement stroke:--md-accent-fg-color, stroke-dasharray: 9 5
style PrecastElement stroke:--md-accent-fg-color, stroke-dasharray: 9 5
Tip
Any object, that is an AllplanElement
can be put in the modelEleList
and created in the DF using
CreateElements function.
Basis elements
BasisElement is an abstract representation of generic elements such as lines, 3D-objects, hatchings or dimension lines. An element object usually has properties object of a dedicated class (like FillingElement has1 properties represented by FillingProperties).
The table 3 below gives you an overview of the most common basis elements as they are presented in ALLPLAN GUI together with their representation in the ALLPLAN Python API.
ALLPLAN element | API representation | Remarks |
---|---|---|
3D object | ModelElement3D | The geometry object must be a Polyhedron3D |
3D line | ModelElement3D | The geometry object must be a Line3D |
Circle | ModelElement2D | The geometry object must be an Arc2D |
Dimension line | DimensionLineElement | - |
Elevation point | ElevationElement | - |
Fill | FillingElement | - |
General 3D object | ModelElement3D | The geometry object must be a BRep3D |
Hatching | HatchingElement | - |
Label | LabelElement | - |
Line | ModelElement2D | The geometry object must be a Line2D |
Library symbol | LibraryElement | Learn more below |
Point symbol | Symbol2DElement | - |
Pattern | PatternElement | - |
Terrain point | Symbol3DElement | - |
Text | TextElement | - |
The UML diagram below shows the relationships between some of the classes from the table above. Showing all of them will make it unreadable. The relationship patterns does not differ much among them.
classDiagram
direction BT
class AllplanElement{
<<Abstract>>
+CommonProperties CommonProperties
+Attributes Attributes
+GeometryObject Any
+LabelElements list[LabelElement]
}
class BasisElement{
<<Abstract>>
}
class FillingElement{
+GetFillingProperties()
+SetFillingProperties()
}
class FillingProperties{
+FirstColor
+SecondColor
}
class TextElement{
+Text str
+TextProperties
}
class TextProperties{
+Alignment int
+Font int
+Width float
}
class ModelElement3D{
+TextureDefinition
+TextureMapping
}
class ModelElement2D{
+EndSymbolsProperties
+PatternCurveProperties
}
class DimensionLineElement{
+GetDimensionPoints()
+GetDirectionVector()
+GetPlacementVector()
}
class ElevationElement
class DimensionProperties{
+PointSymbol
+TextLocation
+TextOffset
}
class LibraryElement {
+Move()
+GetProperties()
}
class LibraryElementProperties{
+Producer
+PlacementMatrix
}
BasisElement --|> AllplanElement
FillingElement --|> BasisElement
FillingProperties "1" --o "*" FillingElement
TextElement --|> BasisElement
TextProperties "1" --o "*" TextElement
ModelElement3D --|> BasisElement
ModelElement2D --|> BasisElement
DimensionLineElement --|> BasisElement
ElevationElement --|> DimensionLineElement
DimensionProperties "1" --o "*" DimensionLineElement
DimensionProperties "1" --o "*" ElevationElement
LibraryElement --|> BasisElement
LibraryElementProperties "1" --o "*" LibraryElement
style AllplanElement stroke:--md-accent-fg-color, stroke-dasharray: 9 5
style BasisElement stroke:--md-accent-fg-color, stroke-dasharray: 9 5
Example
To create a simple cube with current format properties, define it's geometry and construct the ModelElement3D
model_element_3d = AllplanBasisElements.ModelElement3D()
model_element_3d.GeometryObject = AllplanGeo.Polyhedron3D.CreateCuboid(1000,1000,1000)
model_element_3d.CommonProperties = AllplanSettings.AllplanGlobalSettings.GetCurrentCommonProperties()
The model_element_3d
can be put into the CreateElementResult
data class (if your PythonPart is implemented as script object
or a standard PythonPart) or created directly
with CreateElements function.
Examples on GitHub
To see the full implementation of the above mentioned classes, have a look on the examples in ...BasisExamples/Objects ( PYP | PY).
Library elements
Elements saved in the ALLPLAN library are represented by the LibraryElement class. Currently, following element types can be accessed by the API:
- symbols
- smart symbols (macros)
- fixtures
To do that, a LibraryElement object must be constructed using appropriate LibraryElementProperties. These are defined differently depending on the type of the library element.
To place a symbol or a smart symbol, you must specify the absolute path to the .sym or .nmk file:
path = r"c:\Data\Allplan\2025\std\Library\2D Objects\Exterior\2D animals\Cat.sym" #(1)!
library_element_properties = AllplanBasisElements.LibraryElementProperties(
fullPathName = path,
elementType = AllplanBasisElements.LibraryElementType.eSymbol, #(2)!
placementMatrix = AllplanGeo.Matrix3D()) #(3)!
library_element = AllplanBasisElements.LibraryElement(library_element_properties)
- The method get_global_standard_path
will help you get an absolute path (like
C:\Data\...\std\Library\...
out of a relative path beginning with a keyword likeSTD\Library\...
) - Set the type accordingly:
eSymbol
for a symbol (.sym) oreSmartSymbol
for smart symbol (.nmk) - When you want to place the same (smart)symbol multiple times on different locations, instead of a single Matrix3D, provide a list of placement matrices (Matrix3DList). This will speed up the process significantly.
When accessing a fixture from the library, provide the absolute path to the .pfx or .lfx file as the fourth argument, leaving the first three empty, like this:
library_element_properties = AllplanBasisElements.LibraryElementProperties(
"", "", "", fixture_path, #(1)!
AllplanBasisElements.LibraryElementType.eFixtureSingleFile,
AllplanGeo.Matrix3D()) #(2)!
- The method get_global_standard_path
will help you get an absolute path (like
C:\ProgramData\...\std\Library\...
out of a relative path beginning with a keyword likeSTD\Library\...
) - When you want to place the same fixture multiple times on different locations, instead of a single Matrix3D, provide a list of placement matrices (Matrix3DList). This will speed up the process significantly.
When accessing a fixture from the legacy catalog, provide the path, group and element in the LibraryElementProperties constructor, like this:
fixture = build_ele.Fixture.value #(1)!
library_element_properties = AllplanBasisElements.LibraryElementProperties(
path = fixture.Path,
group = fixture.Group,
element = fixture.Element,
elementType = AllplanBasisElements.LibraryElementType.eFixture,
placementMatrix = AllplanGeo.Matrix3D())
- If you defined the parameter
Fixture
in the .pyp file, as described here, theFixture.value
will be a FixtureProperties object and will containpath
,group
andelement
properties. You can, of course, construct the object yourself.
In case of a line or plane fixture, at this point you have to specify a polyline using the SetPolyline method:
fixture_pol = AllplanGeo.Polyline3D()
fixture_pol += AllplanGeo.Point3D()
fixture_pol += AllplanGeo.Point3D(1500, 0, 0)
fixture_pol += AllplanGeo.Point3D(2500, 2000, 0)
library_element_properties.SetPolyline(fixture_pol)
library_fixture_element = AllplanBasisElements.LibraryElement(library_element_properties)
Now, you can construct the LibraryElement:
The created LibraryElement object can then directly be
appended to the elements property of the CreateElementResult data class
(in case of Standard PythonPart) or to the model_ele_list
argument of the
PythonPartTransaction.execute() method (in case of Interactor PythonPart).
Example on GitHub
To see the full implementation, refer to the example LibraryDialogs ( PYP | PY). It also shows, how to implement dialogs for ALLPLAN library.
Appending to a PythonPart
For a library element to be an integral part of a PythonPart, it must be appended to it as a child object. For that purpose, the PythonPartUtil offers the method add_library_elements. Refer to the article about PythonParts to learn more about appending child elements to a PythonPart.
Tip
If the PythonPart should solely consists of a library element, it is advisable to create at least a bounding box around it as an unprintable help construction and add it to the PythonPart container with add_pythonpart_view_2d3d. As a result, the user is still able to modify the PythonPart by double-click on the bounding box, whereas the library element remains a child-element of the PythonPart.
Example on GitHub
The example SymbolLibraryElement ( PYP | PY) shows, how to append a library symbol to a PythonPart, that should consist only of this symbol, and a bounding box.
Architecture elements
The abstraction of all architecture elements is the class ArchElement. All non-abstract classes representing positive components, like beam, walls, etc. as well as negative components, like window opening, inherit from it. Like basis element, an architectural element any has1 properties represented by a dedicated class. There is an abstraction of these specialized property classes called ArchBaseProperties. These are properties common for all kinds of architectural components.
For the sake of this article, let's divide the architectural components into two main groups:
-
Primary components
Components, that can exist on their own and does not rely on the existence of another component. E.g., walls, columns, slabs or beams.
Learn more below
-
Secondary components
Components that can only live within another component. E.g. a door opening can only exist in a wall. Deleting the wall will result in deletion of the opening.
Learn more below
Primary components
The primary components are the one, that can exist alone. The typical examples are walls, beams, slabs or columns. The table below gives you an overview of the most common components as they are presented in ALLPLAN GUI together with their representation in the ALLPLAN Python API.
ALLPLAN element | API representation | Geometry |
---|---|---|
Downstand Beam, Upstand Beam | BeamElement | Line2D, Arc2D or any 2D curve |
Structural framing beam | StructuralBeamElement | Point3D for start and end point |
Structural framing brace | StructuralBraceElement | Point3D for start and end point |
Column | ColumnElement | Point2D |
Structural framing column | StructuralColumnElement | Point3D |
Room | RoomElement | Polygon2D |
Slab | SlabElement | Polygon2D |
Wall | WallElement | Line2D, Arc2D or any 2D curve |
The following class diagram shows the relationships between classes representing following components: beams, columns, rooms, slabs and walls.
classDiagram
direction BT
class AllplanElement{
<<Abstract>>
+CommonProperties CommonProperties
+Attributes Attributes
+GeometryObject Any
+LabelElements list[LabelElement]
}
class ArchElement{
<<Abstract>>
+ConnectionUUID
}
class ArchBaseProperties{
<<Abstract>>
+LoadFromFavoriteFile()
+BackgroundColor
+CalculationMode
+CircleDivision
+CommonProperties
+FaceStyle
+Filling
+Hatch
+Material
+Pattern
+PlaneReferences
+Priority
+Surface
+Trade
}
class BeamElement{
+Properties
}
class BeamProperties{
+SetAxis()
+IsStartNewJoinedBeamGroup
+ShapeType
+Width
}
class AxisProperties{
+Distance
+Extension
+Modus
+OnTier
+Position
}
class ColumnElement{
+Properties
}
class ColumnProperties
class VerticalElementProperties{
<<Abstract>>
Angle
Depth
Radius
ShapePolygon
ShapeType
Width
}
class RoomElement{
+Properties
}
class RoomProperties{
+Function
+StoreyCode
}
class SlabElement{
+Properties
}
class SlabProperties{
+SetAttribute()
}
class WallElement{
+Properties
}
class WallProperties{
+GetAxis()
+GetWallTierProperties(tierIndex)
+GetThickness()
+GetTierCount()
+SetAxis()
+Axis
+PathElementAxisType
+StartNewJoinedWallGroup
+TierCount
}
class WallTierProperties{
+Thickness
}
WallElement --|> ArchElement
ArchElement --|> AllplanElement
BeamElement --|> ArchElement
ColumnElement --|> ArchElement
RoomElement --|> ArchElement
SlabElement --|> ArchElement
WallProperties "1" --o "*" WallElement
WallTierProperties "1..n" --* "1" WallProperties
AxisProperties "1" --o "*" BeamProperties
AxisProperties "1" --o "*" WallProperties
VerticalElementProperties <|-- ColumnProperties
ArchBaseProperties <|-- VerticalElementProperties
ArchBaseProperties <|-- BeamProperties
ArchBaseProperties <|-- SlabProperties
ArchBaseProperties <|-- RoomProperties
ArchBaseProperties <|-- WallTierProperties
BeamProperties "1" --o "*" BeamElement
ColumnProperties "1" --o "*" ColumnElement
RoomProperties "1" --o "*" RoomElement
SlabProperties "1" --o "*" SlabElement
style AllplanElement stroke:--md-accent-fg-color, stroke-dasharray: 9 5
style ArchElement stroke:--md-accent-fg-color, stroke-dasharray: 9 5
style ArchBaseProperties stroke:--md-accent-fg-color, stroke-dasharray: 9 5
style VerticalElementProperties stroke:--md-accent-fg-color, stroke-dasharray: 9 5
Here are the key outtakes from the above diagram:
- The look of an architectural component is defined not only in CommonProperties (pen, stroke and color), but also in the ArchBaseProperties (hatch, filling, surface).
- The geometry of an architectural component is usually defined by a 2-dimensional object (line, polygon, etc.). The PlaneReferences define, how the component behaves in Z direction. ArchBaseProperties.
- Each wall layer has its own WallTierProperties that inherits from ArchBaseProperties. This means that each layer can look differently and have different height.
Example
To create a beam, you need the BeamElement. From the diagram above we can tell that it has BeamProperties, which on the other hand has AxisProperties. Go from the latter to the first one. To keep the example simple, we skip most of the not-required properties.
axis_prop = AllplanArchElements.AxisProperties()
axis_prop.Extension = -1 #(1)!
axis_prop.Position = AllplanArchElements.WallAxisPosition.eLeft #(2)!
axis_prop.Distance = 0 #(3)!
- The default value of this property is 0, which may cause an unexpected behavior. Therefore,
set it to
1
or-1
. Learn more in the API reference - The default value is eUnknown, which may cause unexpected behavior.
- The Distance must be set accordingly! Independent from the Position!
In the second step, define the BeamProperties.
In the last step, construct the BeamElement.
axis = AllplanGeo.Line2D(0,0,3000,0) #(1)!
beam_ele = AllplanArchElements.BeamElement(beam_prop, axis)
-
Other curve objects, like Arc2D, are also possible:
That's it. The beam_ele
can be now put into the CreateElementResult
data class (if your PythonPart is implemented as script object
or a standard PythonPart) or created directly
with CreateElements function.
Examples on GitHub
To see the full implementation of the above mentioned classes, have a look on the examples in ...BasisExamples/Objects ( PYP | PY).
Secondary components
Secondary components are components that must have a parent component to exist. E.g. a door opening can only exist in a wall. Thus, elements with negative volume such as door opening, window opening, niche or recess fall into this group. But also some components with positive volume qualify: a flush pier can also exist only in a wall.
The table below gives you an overview of the most common components as they are presented in ALLPLAN GUI together with their representation in the ALLPLAN Python API.
ALLPLAN element | API representation | Remarks |
---|---|---|
Door opening | DoorOpeningElement | - |
Joint | JointElement | - |
Niche, recess, slit, opening | GeneralOpeningElement | Construct it by start and end point |
Polygonal niche, recess, slit, opening | GeneralOpeningElement | Construct it by a polygon |
Recess, opening in slab | SlabOpeningElement | - |
Window opening | WindowOpeningElement | - |
The following class diagram shows the relationships between classes representing following types of openings: niche/recess, door, window, and slab openings.
classDiagram
direction LR
class AllplanElement{
<<Abstract>>
+CommonProperties
+Attributes
+GeometryObject
+LabelElements
}
class ArchElement{
<<Abstract>>
+ConnectionUUID
}
class ArchBaseProperties{
<<Abstract>>
+LoadFromFavoriteFile()
+BackgroundColor
+CalculationMode
+CircleDivision
+CommonProperties
+FaceStyle
+Filling
+Hatch
+Material
+Pattern
+PlaneReferences
+Priority
+Surface
+Trade
}
class DoorOpeningElement{
+Properties
}
class DoorOpeningProperties{
+GetDoorSwingProperties()
+GetGeometryProperties()
+GetOpeningSymbolsProperties()
+GetRevealProperties()
+GetSillProperties()
+GetTierOffsetProperties()
+FrenchDoor
+Independent2DInteraction
+PlaneReferences
}
class WindowOpeningElement{
+Properties
}
class WindowOpeningProperties{
+GetGeometryProperties()
+GetOpeningSymbolsProperties()
+GetRevealProperties()
+GetSillProperties()
+GetTierOffsetProperties()
+Independent2DInteraction
+PlaneReferences
}
class GeneralOpeningElement{
+Properties
}
class GeneralOpeningProperties{
+GetGeometryProperties()
+GetOpeningSymbolsProperties()
+GetSillProperties()
+Independent2DInteraction
+OpeningType
+PlaneReferences
+VisibleInViewSection3D
}
class SlabOpeningElement{
+PlacementPoint
+Properties
}
class SlabOpeningProperties{
+GetOpeningSymbolsProperties()
+GetOpeningType()
+Independent2DInteraction
}
class VerticalOpeningGeometryProperties{
+Depth
+ProfilePath
+RiseAtTop
+Shape
+Width
}
class OpeningSymbolsProperties{
+OpeningRefPntIndex
+OpeningTierIndex
+SymbolNames
}
class VerticalOpeningRevealProperties{
+Depth
+InnerOffset
+OuterOffset
+SideOffset
+Type
}
class VerticalOpeningSillProperties{
+CommonProperties
+Type
}
class VerticalOpeningTierOffsetProperties{
+BottomOffset
+LeftOffset
+RightOffset
+TioOffset
+Type
}
class DoorSwingProperties{
+Angle
+BasePointIndex
+LeafThickness
+Type
}
class VerticalElementProperties{
<<Abstract>>
Angle
Depth
Radius
ShapePolygon
ShapeType
Width
}
ArchElement --|> AllplanElement
SlabOpeningElement --|> ArchElement
GeneralOpeningElement --|> ArchElement
DoorOpeningElement --|> ArchElement
WindowOpeningElement --|> ArchElement
SlabOpeningProperties "1" --o "*" SlabOpeningElement
SlabOpeningProperties --|> VerticalElementProperties
VerticalElementProperties --|> ArchBaseProperties
GeneralOpeningProperties "1" --o "*" GeneralOpeningElement
DoorOpeningProperties "1" --o "*" DoorOpeningElement
WindowOpeningProperties "1" --o "*" WindowOpeningElement
OpeningSymbolsProperties "1" --* "1" SlabOpeningProperties
OpeningSymbolsProperties "1" --* "1" GeneralOpeningProperties
OpeningSymbolsProperties "1" --* "1" DoorOpeningProperties
OpeningSymbolsProperties "1" --* "1" WindowOpeningProperties
VerticalOpeningGeometryProperties "1" --* "1" GeneralOpeningProperties
VerticalOpeningGeometryProperties "1" --* "1" DoorOpeningProperties
VerticalOpeningGeometryProperties "1" --* "1" WindowOpeningProperties
DoorSwingProperties "1" --* "1" DoorOpeningProperties
VerticalOpeningSillProperties "1" --* "1" GeneralOpeningProperties
VerticalOpeningSillProperties "1" --* "1" DoorOpeningProperties
VerticalOpeningSillProperties "1" --* "1" WindowOpeningProperties
VerticalOpeningRevealProperties "1" --* "1" DoorOpeningProperties
VerticalOpeningRevealProperties "1" --* "1" WindowOpeningProperties
VerticalOpeningTierOffsetProperties "1" --* "1" DoorOpeningProperties
VerticalOpeningTierOffsetProperties "1" --* "1" WindowOpeningProperties
style AllplanElement stroke:--md-accent-fg-color, stroke-dasharray: 9 5
style ArchElement stroke:--md-accent-fg-color, stroke-dasharray: 9 5
style ArchBaseProperties stroke:--md-accent-fg-color, stroke-dasharray: 9 5
style VerticalElementProperties stroke:--md-accent-fg-color, stroke-dasharray: 9 5
Here are the key outtakes from the above diagram:
- An opening is represented by an element class (e.g. door opening by DoorOpeningElement), which has1 properties represented by a dedicated class.
- There are two ownership levels: the property object also has2 properties for elements specific to that component, e.g. DoorOpeningProperties has DoorSwingProperties.
Example
Let's create a niche at the side of the beam from the previous chapter. To do this, you need to create the beam first!
created_elements = AllplanBaseElements.CreateElements(doc, #(1)!
AllplanGeo.Matrix3D(),
[beam_ele],
[], None)
created_beam = BaseElementAdapterFilter.get_elements_by_type(created_elements, AllplanElementAdapter.Beam_TypeUUID)[0]
- Creation of the element returns a list of BaseElementAdapter, from which you have to pick the adapter pointing to the beam.
According to the table above, the niche is represented by GeneralOpeningElement, which (according to the UML diagram) has GeneralOpeningProperties. Therefore, start with defining the properties:
opening_prop = AllplanArchElements.GeneralOpeningProperties(AllplanArchElements.OpeningType.eNiche)
opening_geo_prop = opening_prop.GetGeometryProperties() #(1)!
opening_geo_prop.Depth = 100.0
opening_prop.PlaneReferences = beam_prop.PlaneReferences #(2)!
- Note, that you do not construct the VerticalOpeningGeometryProperties object. It is already part of the GeneralOpeningProperties.
- To keep things simple, we assume the niche has the same height as the beam itself
Now all you need to do is to construct the niche element and create it in the database:
Warning
Because an opening (or any secondary element) needs an existing primary element, in order to create it you need to have the BaseElementAdapter pointing to the primary element. You can obtain it e.g. by element selection (in ALLPLAN you also have to select a slab before creating an opening in it).
You cannot implement the creation of the beam and the opening in a single transaction, which means you can implement it neither with a standard PythonPart nor with a script object PythonPart. Introducing two creation transaction is possible only in an interactor.
If your PythonPart should create only the opening (the primary component already exists), you can implement it with script object as well as with an interactor. But not with a standard PythonPart.
Example on GitHub
To see the full implementation of the above mentioned classes, have a look on the examples in ...BasisExamples/Objects ( PYP | PY).
-
The has relationship is an aggregation: you can assign the same properties to many elements and deleting the element will not delete the properties. ↩↩↩
-
In this case, the has relationship is a composition: a DoorOpeningProperties object consists of exactly one DoorSwingProperties, which are manipulable, but not interchangeable. Deleting the first means deleting the latter. ↩
-
Please do not consider the table as a complementary list of all supported elements, as we constantly extend our API. To have a full overview, to refer to the API reference ↩