Input of a 3D point by handle¶
This example shows the usage of a handle to input a 3D point:
The Offset handle is used to input the value for the PythonPart parameter OffsetPoint. The source code for creating the handle looks like this:
offset_handle = HandleProperties("Offset", build_ele.OffsetPoint.value, AllplanGeo.Point3D(),
[HandleParameterData("OffsetPoint", HandleParameterType.POINT, False)],
HandleDirection.XYZ_DIR)
offset_handle.handle_type = AllplanIFW.ElementHandleType.HANDLE_SQUARE_RED
offset_handle.info_text = "Offset the cuboid"
handle_list.append(offset_handle)
Special details¶
the handle parameter type POINT is used to assign the input point from the moved handle to the PythonPart parameter OffsetPoint
The modification of the handle is limited to the values of the following tag of the parameter
<IntervalValue> as grid length for the distance between the handle and reference point
Handle processing¶
The processing of the handle click and move can be done inside the PythonPart script 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
"""
build_ele.change_property(handle_prop, input_pnt)
return create_element(build_ele, doc)
Clicking and moving the handle shows a preview like this: