Adapter Manager¶
Singleton registry that manages adapter instances and active CAD type detection.
adapters.adapter_manager
¶
CAD Adapter management and caching.
Handles: - Adapter resolution (which CAD to use) - Adapter caching and reuse - Active CAD type tracking - Lazy connection on first use
AdapterRegistry
¶
Singleton registry for managing CAD adapter instances.
Encapsulates global state for adapter caching and active CAD tracking. Thread-safe with locks for concurrent access.
get_instance
classmethod
¶
Return the singleton AdapterRegistry instance, creating it if necessary.
Thread-safe via double-checked locking.
| RETURNS | DESCRIPTION |
|---|---|
AdapterRegistry
|
The singleton AdapterRegistry instance. |
reset
classmethod
¶
Destroy the singleton instance, forcing re-creation on next access.
Primarily used in tests to reset state between test cases.
get_cad_type
¶
Get the currently active CAD type name, or 'None' if disconnected.
get_adapter
¶
Get the active CAD adapter instance. Auto-detects if none exists.
| PARAMETER | DESCRIPTION |
|---|---|
only_if_running
|
If True, fails if CAD is not already open.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Any
|
CAD adapter instance |
| RAISES | DESCRIPTION |
|---|---|
CADConnectionError
|
If adapter cannot be created or connected |
get_cad_instances
¶
Get the dictionary of all CAD adapter instances.
| RETURNS | DESCRIPTION |
|---|---|
Dict[str, Any]
|
Dictionary mapping CAD type to adapter instance |
auto_detect_cad
¶
Auto-detect and connect to available CAD applications on startup (thread-safe).
shutdown_all
¶
Disconnect and cleanup all CAD adapter instances (thread-safe).
set_active_cad_type
¶
Convenience function - stubbed out for backwards compatibility.
get_adapter
¶
Convenience function - delegates to singleton registry.
get_cad_instances
¶
Convenience function - delegates to singleton registry.
auto_detect_cad
¶
Convenience function - delegates to singleton registry.