Connection Mixin¶
Handles COM connection lifecycle: connect, disconnect, reconnect, and application detection.
adapters.mixins.connection_mixin.ConnectionMixin
¶
Mixin for connection management.
connect
¶
Connect to the CAD application via COM, initializing COM for this thread.
Tries to attach to an already-running instance first. If none is found
and only_if_running is False, launches a new instance.
| PARAMETER | DESCRIPTION |
|---|---|
only_if_running
|
When True, return False instead of launching a new CAD instance if none is currently running.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the connection was established successfully. |
| RAISES | DESCRIPTION |
|---|---|
CADConnectionError
|
If COM initialization fails or the ProgID is invalid. |
check_document_change
¶
Check if the active document in the CAD application has changed. If it has, update self.document to the new active document.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the document changed, False otherwise.
TYPE:
|