Plane connection
The elements of a PythonPart can be connected to a plane. The creation of the plane connection can be done by adding a Plane references dialog in the .pyp file. This entry creates a PlaneReferences object, that can be used to get the plane heights as follows:
plane_ref = build_ele.PlaneReferences.value
abs_bottom_elevation = plane_ref.GetAbsBottomElevation()
abs_top_elevation = plane_ref.GetAbsTopElevation()
height = abs_top_elevation - abs_bottom_elevation
cuboid_geo = AllplanGeo.Polyhedron3D.CreateCuboid(build_ele.Width.value,
build_ele.Depth.value,
height)
When the planes are changed in the Allplan project, all PythonParts with plane connections are checked for and, if necessary, recalculation of the PythonPart geometry is executed.
Example
For a complete usage of plane connection, see the example PlaneConnection located in:
- …\etc\Examples\PythonParts\BasisExamplesGeneral\PlaneConnection.pyp
- …\etc\PythonPartsExampleScripts\BasisExamplesGeneral\PlaneConnection.py
Surface planes
If the selected plane is a surface plane, the BottomTopPlaneService can be used to get the geometry of the surface plane as follows:
build_ele.ReferencePlaneBottom.value = \
AllplanArchEle.BottomTopPlaneService.GetBottomReferencePlane(AllplanEleAdapter.BaseElementAdapter(),
doc, build_ele.Plane.value)
The return value can be a:
depending on the geometry type of the selected surface plane.
Example
How to use this plane geometry to fit the geometry of the PythonPart to the plane is explained in the example BottomTopPlaneService located in:
- …\etc\Examples\PythonParts\ServiceExamples\BottomTopPlaneService.pyp
- …\etc\PythonPartsExampleScripts\ServiceExamples\BottomTopPlaneService.py