Common properties
Every geometrical object in Allplan has format properties like line thickness, type and color. In Python API, they are represented with CommonProperties class. This class contains information about:
- Pen thickness, stroke and color, with which the geometrical object should be drawn, represented with an ID number.
- Layer, which the object belongs to, also represented by a number.
- Whether the pen thickness, stroke or color should be taken from layer definition or from the object itself (if so, the pen thickness, stroke and color of the object are ignored).
- Should the object be printable (see property construction line on the figure below).
- Draw order (see image below sequence) - in case of overlapping, the object with higher draw order will be visible.
Global settings
The class AllplanGlobalSettings gives the access the common properties currently set in Allplan as global setting through the method GetCurrentCommonProperties. Getting these settings might be useful to set the initial values of CommonProperties for the element creation.
Palette controls
To give the user the control over common properties, it is necessary to include following controls in the palette:
- for Pen thickness, Stroke, Color and Layer use the corresponding resource control
- for the from layer and printable state use an ordinary checkbox
- for the draw order we recommend an integer slider restricted to values ranging between -15 and 15
Tip
To include all the controls needed for setting pen, stroke, color and layer the with one parameter, use the common properties parameter. This is the most effective way, since there is no need to include all the above mentioned controls as individual parameters into the palette.
Reading and Modifying the properties
Depending on the object type, common properties can be either read and modified or read only.
- In objects of type BaseElementAdapter, which are e.g., the result of an element selection, the common properties are read-only and can be get by the GetCommonProperties method
- In AllplanElement objects (a parent class for general 2D and 3D objects, architectural objects and many others) the common properties can be read as well as set. This can be done by either using the getter and setter methods or reading/writing the CommonProperties property.