Handles
Handles are a feature of a PythonPart, which improves the user's experience by allowing him to edit the geometry (or in some cases also non-geometrical properties) directly in the model view. The user can be provided a possibility to perform various operations e.g.:
- changing a dimension with dimension handle
- define a coordinate with coordinate handle
- execute action with button handle
- hiding or displaying a component with checkbox handle
- increment a dimension with increment handle
- input an angle with rotation handle
A handle can be assigned to a PythonPart parameter. If that is the case, it is possible to show an input field directly inside the viewport.
Create a handle
Handle is created by instantiating the class HandleProperties. Object of this class represents a handle. Handle processing differs depending on whether the PythonPart is an interactor or not. Please refer to the relevant subsection to learn more.
The composition of the HandleProperties class is shown below.
Handle type
The enumeration class ElementHandleType defines the layout of the handle. The default value when instantiating the class HandleProperties is HANDLE_CIRCLE and can be changed to one of the following:
Layout | Type |
---|---|
![]() |
HANDLE_ARROW |
![]() |
HANDLE_CIRCLE |
![]() |
HANDLE_SQUARE_BLUE |
![]() |
HANDLE_SQUARE_EMPTY |
![]() |
HANDLE_SQUARE_RED |
![]() |
HANDLE_SQUARE_RIGHT |
Handle parameter data
The data class HandleParameterData connects the handle to a specific PythonPart parameter defined in the .pyp file. Thanks to this, a parameter value is recalculated every time a connected handle is modified. The recalculation is performed depending on the defined HandleParameterType.
Handle parameter type
The enumeration class HandleParameterType defines how the value of the parameter property assigned to the handle should be recalculated, when the handle is modified. Please refer to the API reference to see, what recalculation methods are available.
Handle direction
The enumeration class HandleDirection defines the allowed direction, in which the handle can be moved when being modified. Please refer to the API reference to see the available options.