Skip to content

PythonPartTransaction

Canonical path: PythonPartTransaction.PythonPartTransaction

Implementation of the PythonPart transaction. The transaction creates the elements in the drawing file and introduces additional steps, that would normally have to be introduced separately, after the creation. This is to make the creation easier to implement in a PythonPart script. These additional steps are:

  • correct creation of PrecastElements (precast elementation)
  • in modification mode: recreating reinforcement labels, created with native Allplan function
  • connecting existing elements (also other PythonParts) to the created PythonPart
  • creation of UVSs using the appropriate function
  • rearrangement of the reinforcement mark numbering
  • creation of one single undo step

Methods:

  • __init__

    Initialize

  • execute

    Execute the transaction. Calling the method, makes the framework perform following operations:

__init__

__init__(
    doc: DocumentAdapter,
    connect_to_pyp: ConnectToPythonPart = ConnectToPythonPart(),
)

Initialize

Parameters:

execute

execute(
    placement_matrix: Matrix3D,
    view_world_projection: ViewWorldProjection,
    model_ele_list: list[Any],
    modification_ele_list: ModificationElementList,
    rearrange_reinf_pos_nr: ReinforcementRearrange = ReinforcementRearrange(),
    append_reinf_pos_nr: bool = True,
    asso_ref_object: BaseElementAdapter | None = None,
    uuid_parameter_name: str = "",
    _elementation_delete_py: bool = True,
    use_system_angle: bool = True,
    elements_to_delete: BaseElementAdapterList | None = None,
) -> BaseElementAdapterList

Execute the transaction. Calling the method, makes the framework perform following operations:

  1. Creates the elements from the model_ele_list in the drawing file.
  2. If there are any PrecastElements in the model_ele_list, the framework sets the right reference point and performs the precast elementation.
  3. In the modification mode: if there are any BarPlacement in the model_ele_list, the framework recreates the labeling for them. This is particularly important, when some reinforcement was labeled manually outside PythonPart with native Allplan functions after creating the PythonPart.
  4. If there were any ViewSectionElements in the model_ele_list, framework creates them using the right creation function and considering other created elements.
  5. If the uuid_parameter_name was specified, the UUID of created PythonPart is written into this parameter.
  6. When a connection to another PythonPart was specified in the constructor, a connection is created.
  7. If the rearrange_reinf_pos_nr was provided, framework checks, if the rearrangement is needed (any new reinforcement was created). If that's the case, the mark numbers are rearranged according to the provided settings.
  8. At the end, one undo step is created for all the actions mentioned.

Parameters:

  • placement_matrix (Matrix3D) –

    placement matrix

  • view_world_projection (ViewWorldProjection) –

    view world projection

  • model_ele_list (list[Any]) –

    list with the model elements

  • modification_ele_list (ModificationElementList) –

    list with the UUID's of the modified PythonPart elements

  • rearrange_reinf_pos_nr (ReinforcementRearrange, default: ReinforcementRearrange() ) –

    data for the reinforcement rearrange

  • append_reinf_pos_nr (bool, default: True ) –

    When set to True, the reinforcement position numbers are appended to the existing position numbers

  • asso_ref_object (BaseElementAdapter | None, default: None ) –

    associative view reference object

  • uuid_parameter_name (str, default: '' ) –

    if set, the model object UUID of the created PythonPart is assigned to this name

  • _elementation_delete_py (bool, default: True ) –

    delete the PythonPart after the precast elementation

  • use_system_angle (bool, default: True ) –

    use the default system angle state (False = no use of the system angle) In case of True, the state of defined elements in the modification_ele_list is used - empty list = creation mode: use the system angle - element in list = modification mode: don't use the system angle

  • elements_to_delete (BaseElementAdapterList | None, default: None ) –

    elements which should be delete inside the created transaction

Returns: