Skip to content

Update of identical Python Parts

After a PythonPart has been changed, Allplan checks within the DF for PythonParts with the same name and the same original parameter values. If such PythonParts are found, the following message appears:

Update of identical PythonParts

Depending on the button clicked, the identical PythonParts are updated.

In some cases, it makes sense to exclude parameters from the identical check e.g., when they are only needed for the placement of the PythonPart inside the model. To achieve this, <ExcludeIdentical> tag can be added to the <Parameter>



An example is shown in the IdenticalRotatedPlate PythonPart, located in:

  • …\etc\Examples\PythonParts\BasisExamples\IdenticalRotatedPlate.pyp
  • …\etc\PythonPartsExampleScripts\BasisExamples\

In this example, a plate can be rotated around all three axes. The rotation angle is input in the palette as a parameter. If all parameters were used for an identical check, plates with identical geometry, but not identical rotation angles will not be considered as identical PythonParts. Setting the <ExcludeIdentical> tag to True in the rotation parameter solves this issue.

In addition, the local transformation of the PythonPart e.g., by the rotation angles, must be included in a local placement matrix of the PythonPart.

create_element(build_ele, doc):
    pyp_util = PythonPartUtil()
    python_part = pyp_util.create_pythonpart(build_ele, 
                                             local_placement_mat) #(1)!

    return CreateElementResult(python_part)
  1. The local_placement_mat contains a Matrix3D object, which describes all the rotations.

Further information can be found in the example files.