Checkbox handle

This example shows the usage of a handle as checkbox:

../../_images/HandleCheckBox.png

The ShowInputControlsHandle handle is used as checkbox. The source code for creating the handle looks like this:

show_input_handle = HandleProperties("ShowInputControlsHandle", point1 + AllplanGeo.Point3D(0, -500, 0), AllplanGeo.Point3D(),
                                      [HandleParameterData("ShowInputControls", HandleParameterType.CHECK_BOX,
                                                            check_box_state = build_ele.ShowInputControls.value)],
                                      HandleDirection.CLICK)

show_input_handle.info_text = "Hide input controls" if build_ele.ShowInputControls.value else "Show input controls"

handle_list.append(show_input_handle)

Special details

  • the handle parameter type CHECK_BOX is used to define a checkbox handle

  • the state of the PythonPart parameter ShowInputControls is toggled between True and False by clicking to the button

  • the HandleDirection.CLICK is used to mark the handle as click handle

  • the info text is assigned depending on the state of the PythonPart parameter ShowInputControls.


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
    """

  build_ele.change_property(handle_prop, input_pnt)

  return create_element(build_ele, doc)

Clicking the handle shows a result like this:

../../_images/HandleCheckBoxResult.png