SectionFill
Canonical path: SectionFill.SectionFill
Representation of a surface element, shown when an element is cut through in a section view
This class can be used to apply a filling, hatching, pattern, face style or bitmap to a ModelElement3D, as in this case these properties are managed through ALLPLAN attributes.
Examples:
To assign a hatching with ALLPLAN internal ID of 303 (reinforced concrete) to model_ele_list containing
3d solids represented by ModelElement3D, use the following code:
To assign a bitmap to the same model_ele_list, use the following code:
>>> bitmap = SectionFill.as_bitmap('C:/path/to/bitmap.jpg')
>>> bitmap.apply_on_model_elements(model_ele_list)
To create a SectionFill object from a parameter with ValueType of SurfaceElementProperties, use the following code:
>>> surface_ele_props = build_ele.NameOfYourSurfaceElementPropertiesParameter.value
>>> section_fill = SectionFill.from_surface_ele_properties(surface_ele_props)
To change the type of the surface element, first set the type, then the number or bitmap path:
Methods:
-
__init__–Initialize the surface element
-
__repr__–Return a string representation of the object
-
add_section_filling–Add section filling to element
-
add_section_filling_attribute–Add section filling and attributes to element
-
apply_on_model_elements–Apply the section fill to the given ModelElement3D or list of them
-
as_bitmap–Initialize the surface element as a bitmap
-
as_face_style–Initialize the surface element as face style
-
as_filling–Initialize the surface element as filling
-
as_hatching–Initialize the surface element as hatching
-
as_pattern–Initialize the surface element as pattern
-
from_surface_ele_properties–Create a SectionFill object from SurfaceElementProperties
-
get_bitmap–Get the bitmap
-
get_number–Get ALLPLAN Resource ID of the pattern/hatch/etc.
-
get_type–Get type
-
set_bitmap–Set the absolute path to the file with a bitmap
-
set_number–Set the ALLPLAN Resource ID of the pattern/hatch/etc.
-
set_type–Set the type of the surface element
Attributes:
-
background_color(int | None) –Color of the background (only for pattern or hatching)
-
bitmap(str) –Absolute path to the file with a bitmap (image files like .jpg or .png are allowed)
-
number(int) –ALLPLAN Resource ID of the pattern/hatch/etc.
-
type(SectionFillType) –Type of the surface element
background_color
property
writable
Color of the background (only for pattern or hatching)
Raises:
-
ValueError–If the type is other than HATCHING or PATTERN
bitmap
property
writable
Absolute path to the file with a bitmap (image files like .jpg or .png are allowed)
Raises:
-
ValueError–If the type is other than BITMAP
number
property
writable
ALLPLAN Resource ID of the pattern/hatch/etc.
In case of FILLING, the ID of the ALLPLAN standard color.
Raises:
-
ValueError–If the fill type is BITMAP
__init__
__init__(
section_type: SectionFillType,
number: int,
bitmap_path: str = "",
background_color: int | None = None,
)
Initialize the surface element
Use dedicated methods like as_hatching(), as_pattern(), etc. rather than this constructor.
Parameters:
-
section_type(SectionFillType) –Type of the surface element (filling, hatching, pattern, etc.)
-
number(int) –ALLPLAN Resource ID of the pattern/hatch/etc.
-
bitmap_path(str, default:'') –Absolute path to the file with a bitmap (image files like .jpg or .png are allowed)
-
background_color(int | None, default:None) –Color of the background (only for pattern or hatching)
__repr__
Return a string representation of the object
Returns:
-
str–string representation
add_section_filling
staticmethod
add_section_filling(elem: ModelElement3D, section_fill: SectionFill)
Add section filling to element
Parameters:
-
elem(ModelElement3D) –element to add section fill
-
section_fill(SectionFill) –section fill
add_section_filling_attribute
staticmethod
Add section filling and attributes to element
Parameters:
-
elem–element to add section fill
-
section_fill–section fill
-
attr_list–attribute list
apply_on_model_elements
apply_on_model_elements(
elements: ModelElement3D | list[ModelElement3D] | ModelEleList,
)
Apply the section fill to the given ModelElement3D or list of them
Parameters:
-
elements(ModelElement3D | list[ModelElement3D] | ModelEleList) –ModelElement3D or list of them to apply the section fill to
as_bitmap
classmethod
as_bitmap(bitmap_path: str) -> SectionFill
Initialize the surface element as a bitmap
Parameters:
-
bitmap_path(str) –Path to the bitmap
Returns:
-
SectionFill–SectionFill object with bitmap type
Raises:
-
FileNotFoundError–If the bitmap file is not found
as_face_style
classmethod
as_face_style(face_style_id: int) -> SectionFill
Initialize the surface element as face style
Parameters:
-
face_style_id(int) –ID of the face style
Returns:
-
SectionFill–SectionFill object with face style type
as_filling
classmethod
as_filling(filling_id: int) -> SectionFill
Initialize the surface element as filling
Parameters:
-
filling_id(int) –ID of the filling
Returns:
-
SectionFill–SectionFill object with filling type
as_hatching
classmethod
as_hatching(
hatching_id: int, background_color: int | None = None
) -> SectionFill
Initialize the surface element as hatching
Parameters:
-
hatching_id(int) –ID of the hatching
-
background_color(int | None, default:None) –Optional background filling color
Returns:
-
SectionFill–SectionFill object with hatching type
as_pattern
classmethod
as_pattern(pattern_id: int, background_color: int | None = None) -> SectionFill
Initialize the surface element as pattern
Parameters:
-
pattern_id(int) –ID of the pattern
-
background_color(int | None, default:None) –Optional background filling color
Returns:
-
SectionFill–SectionFill object with pattern type
from_surface_ele_properties
classmethod
from_surface_ele_properties(
surface_ele_props: SurfaceElementProperties,
) -> SectionFill
Create a SectionFill object from SurfaceElementProperties
Parameters:
-
surface_ele_props(SurfaceElementProperties) –SurfaceElementProperties object
Returns:
-
SectionFill–SectionFill object
get_bitmap
Get the bitmap
Returns:
-
str–Absolute path to the file with a bitmap
get_number
Get ALLPLAN Resource ID of the pattern/hatch/etc.
Returns:
-
int–ALLPLAN Resource ID of the pattern/hatch/etc.
set_bitmap
Set the absolute path to the file with a bitmap
Parameters:
-
bitmap(str) –Absolute path to the file with a bitmap
set_number
Set the ALLPLAN Resource ID of the pattern/hatch/etc.
Parameters:
-
number(int) –ALLPLAN Resource ID of the pattern/hatch/etc.
set_type
set_type(section_type: SectionFillType)