LineInteractor
Canonical path: ScriptObjectInteractors.LineInteractor.LineInteractor
Bases: BaseScriptObjectInteractor
Implementation of the interactor for line input
This script object interactor prompts the user for input a 3D line. Hitting ESC during the input of the start point cancels the input. When hit during the end point input, the input is continued. Start point is cleared and can be input again.
UvsTransformation
Canonical path: ScriptObjectInteractors.LineInteractor.LineInteractor.UvsTransformation
Class representing transformation between UVS coordinate system and world coordinate system
__init__
__init__(uvs_adapter: AssocViewElementAdapter)
Initialize from UVS
Parameters:
-
uvs_adapter
(AssocViewElementAdapter
) –element adapter pointing to the UVS
__init__
__init__(
interactor_result: LineInteractorResult,
is_first_input: bool,
prompt: str,
allow_pick_up: bool = False,
uvs_to_world: bool = False,
preview_function: Callable[[Line3D], list] | None = None,
default_input_value: float | None = None,
abscissa_element: CURVES = None,
)
initialize
Parameters:
-
interactor_result
(LineInteractorResult
) –result of the interactor
-
is_first_input
(bool
) –is this the first input in an input sequence
-
prompt
(str
) –prompt message shown in the dialog line
-
allow_pick_up
(bool
, default:False
) –allow to pick up a line from an existing element
-
uvs_to_world
(bool
, default:False
) –when True and line is input in an UVS, the resulting line will be transformed to from UVS to world coordinate system
-
preview_function
(Callable[[Line3D], list] | None
, default:None
) –function for generating preview elements during the input
-
default_input_value
(float | None
, default:None
) –default input value. If set to None, no input value field is provided.
-
abscissa_element
(CURVES
, default:None
) –abscissa element for the point projection
draw_preview
draw_preview(line: Line3D) -> None
Draw the preview during the input.
If a function generating preview elements from a 3D line is defined, use it. Otherwise preview a red 3D line.
Parameters:
-
line
(Line3D
) –line to preview
get_input_line
overloaded
get_input_line() -> Line3D
Construct the input line from the mouse message.
This overload is meant to be used inside events, where no mouse message is available ().
Returns:
get_input_line(mouse_msg: int, pnt: Point2D, msg_info: AddMsgInfo) -> Line3D
Construct the input line from the mouse message.
This overload is meant to be used inside process_mouse_msg event.
Parameters:
-
mouse_msg
(int
) –mouse message ID
-
pnt
(Point2D
) –input point in Allplan view coordinates
-
msg_info
(AddMsgInfo
) –additional mouse message info
Returns:
-
Line3D
–The input line as follows:
-
Line3D
–- During start point input (start_point property is empty):
- If line pick is allowed and a line was found, it will be returned.
- Otherwise
- When mouse was clicked, the clicked point is saved in start_point property.
- A zero-line is returned.
-
Line3D
–- During end point input (start_point property is not empty):
- resulting line is constructed from the start_point and the current point
on_cancel_function
on_cancel_function() -> OnCancelFunctionResult
Handles the event of hitting ESC during the input
Cancels the input, when ESC is hit during the start point input. Otherwise restarts the start point input.
Returns:
-
OnCancelFunctionResult
–False during the start point input, True otherwise
process_mouse_msg
process_mouse_msg(mouse_msg: int, pnt: Point2D, msg_info: AddMsgInfo) -> bool
Handles the process mouse message event
Parameters:
-
mouse_msg
(int
) –mouse message ID
-
pnt
(Point2D
) –input point in Allplan view coordinates
-
msg_info
(AddMsgInfo
) –additional mouse message info
Returns:
-
bool
–True/False for success.
start_input
start_input(coord_input: CoordinateInput)
Start the input of the line's start point
Parameters:
-
coord_input
(CoordinateInput
) –API object for the coordinate input, element selection, ... in the Allplan view