Skip to content

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:

>>> hatching = SectionFill.as_hatching(303)
>>> hatching.apply_on_model_elements(model_ele_list)

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:

>>> section_fill.type = SectionFillType.HATCHING
>>> section_fill.number = 303

Methods:

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

background_color: int | None

Color of the background (only for pattern or hatching)

Raises:

  • ValueError

    If the type is other than HATCHING or PATTERN

bitmap property writable

bitmap: str

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

number: int

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

type property writable

Type of the surface element

__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__

__repr__() -> str

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:

add_section_filling_attribute staticmethod

add_section_filling_attribute(elem, section_fill, attr_list)

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:

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:

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:

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:

from_surface_ele_properties classmethod

from_surface_ele_properties(
    surface_ele_props: SurfaceElementProperties,
) -> SectionFill

Create a SectionFill object from SurfaceElementProperties

Parameters:

Returns:

get_bitmap

get_bitmap() -> str

Get the bitmap

Returns:

  • str

    Absolute path to the file with a bitmap

get_number

get_number() -> int

Get ALLPLAN Resource ID of the pattern/hatch/etc.

Returns:

  • int

    ALLPLAN Resource ID of the pattern/hatch/etc.

get_type

get_type() -> SectionFillType

Get type

Returns:

set_bitmap

set_bitmap(bitmap: str)

Set the absolute path to the file with a bitmap

Parameters:

  • bitmap (str) –

    Absolute path to the file with a bitmap

set_number

set_number(number: int)

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)

Set the type of the surface element

Parameters:

Placeholder