Button handle¶
This example shows the usage of a handle as button:
The MirrorCuboid handle is used as button. The source code for creating the handle looks like this:
mirror_handle = HandleProperties("MirrorCuboid", point5, AllplanGeo.Point3D(),
[],
HandleDirection.CLICK)
mirror_handle.handle_type = AllplanIFW.ElementHandleType.HANDLE_ARROW
mirror_handle.info_text = "Mirror the cuboid"
mirror_handle.handle_angle = rot_angle
handle_list.append(mirror_handle)
Special details¶
no PythonPart parameter is assigned to the handle. The handle processing is done by the assigned handle ID MirrorCuboid.
the HandleDirection.CLICK is used to mark the handle as click handle
the handle is rotated by handle_angle
Handle processing¶
The processing of the handle click inside the PythonPart script can be done as follows:
def move_handle(build_ele,
handle_prop: HandleProperties,
input_pnt: AllplanGeo.Point3D,
doc: AllplanElementAdapter.DocumentAdapter):
"""
Modify the element geometry by handles
Args:
build_ele: the building element.
handle_prop handle properties
input_pnt: input point
doc: input document
"""
if handle_prop.handle_id == "MirrorCuboid":
build_ele.MirrorCuboid.value = not build_ele.MirrorCuboid.value
return create_element(build_ele, doc)
Clicking the handle shows a result like this: