solidworks-mcp-python 1.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- solidworks_mcp/__init__.py +57 -0
- solidworks_mcp/adapters/__init__.py +40 -0
- solidworks_mcp/adapters/base.py +1882 -0
- solidworks_mcp/adapters/circuit_breaker.py +2052 -0
- solidworks_mcp/adapters/com_executor.py +252 -0
- solidworks_mcp/adapters/complexity_analyzer.py +272 -0
- solidworks_mcp/adapters/connection_pool.py +1884 -0
- solidworks_mcp/adapters/factory.py +366 -0
- solidworks_mcp/adapters/intelligent_router.py +218 -0
- solidworks_mcp/adapters/mock_adapter.py +4016 -0
- solidworks_mcp/adapters/pywin32_adapter.py +2842 -0
- solidworks_mcp/adapters/solidworks/__init__.py +17 -0
- solidworks_mcp/adapters/solidworks/bitmap.py +180 -0
- solidworks_mcp/adapters/solidworks/com_utils.py +56 -0
- solidworks_mcp/adapters/solidworks/dimension_layout.py +753 -0
- solidworks_mcp/adapters/solidworks/documentation.py +1476 -0
- solidworks_mcp/adapters/solidworks/drawing_standard.py +1993 -0
- solidworks_mcp/adapters/solidworks/face_selection.py +392 -0
- solidworks_mcp/adapters/solidworks/features.py +3362 -0
- solidworks_mcp/adapters/solidworks/io.py +3649 -0
- solidworks_mcp/adapters/solidworks/rebuild_diagnostics.py +269 -0
- solidworks_mcp/adapters/solidworks/rebuild_inspector.py +146 -0
- solidworks_mcp/adapters/solidworks/selection.py +308 -0
- solidworks_mcp/adapters/solidworks/sketch.py +2545 -0
- solidworks_mcp/adapters/sw_feature_errors.py +66 -0
- solidworks_mcp/adapters/sw_type_info.py +317 -0
- solidworks_mcp/adapters/vba_adapter.py +318 -0
- solidworks_mcp/adapters/vba_macro_executor.py +215 -0
- solidworks_mcp/agents/__init__.py +68 -0
- solidworks_mcp/agents/design_knowledge/assembly_patterns.md +127 -0
- solidworks_mcp/agents/design_knowledge/hinges.md +118 -0
- solidworks_mcp/agents/design_knowledge/snap_fits.md +93 -0
- solidworks_mcp/agents/design_knowledge/solidworks_basics.md +3 -0
- solidworks_mcp/agents/design_knowledge/tolerancing.md +128 -0
- solidworks_mcp/agents/harness.py +216 -0
- solidworks_mcp/agents/history_db.py +1508 -0
- solidworks_mcp/agents/retrieval_index.py +164 -0
- solidworks_mcp/agents/schemas.py +165 -0
- solidworks_mcp/agents/smoke_test.py +285 -0
- solidworks_mcp/agents/soc_exporter.py +650 -0
- solidworks_mcp/agents/soc_pickup.py +332 -0
- solidworks_mcp/agents/soc_rewind.py +221 -0
- solidworks_mcp/agents/vector_rag.py +665 -0
- solidworks_mcp/cache/__init__.py +5 -0
- solidworks_mcp/cache/response_cache.py +164 -0
- solidworks_mcp/config.py +729 -0
- solidworks_mcp/exceptions.py +37 -0
- solidworks_mcp/security/__init__.py +68 -0
- solidworks_mcp/security/auth.py +128 -0
- solidworks_mcp/security/cors.py +27 -0
- solidworks_mcp/security/rate_limiting.py +90 -0
- solidworks_mcp/security/runtime.py +155 -0
- solidworks_mcp/server.py +777 -0
- solidworks_mcp/server_cli_fixed.py +120 -0
- solidworks_mcp/setup/__init__.py +1 -0
- solidworks_mcp/setup/cli.py +399 -0
- solidworks_mcp/setup/clients.py +157 -0
- solidworks_mcp/setup/config_file.py +230 -0
- solidworks_mcp/setup/handshake.py +202 -0
- solidworks_mcp/setup/launcher.py +102 -0
- solidworks_mcp/setup/legacy.py +100 -0
- solidworks_mcp/setup/registration.py +193 -0
- solidworks_mcp/setup/solidworks.py +49 -0
- solidworks_mcp/tools/__init__.py +64 -0
- solidworks_mcp/tools/analysis.py +723 -0
- solidworks_mcp/tools/automation.py +578 -0
- solidworks_mcp/tools/docs_discovery.py +1476 -0
- solidworks_mcp/tools/drawing.py +1015 -0
- solidworks_mcp/tools/drawing_analysis.py +456 -0
- solidworks_mcp/tools/drawing_automation.py +627 -0
- solidworks_mcp/tools/engineering_data.py +466 -0
- solidworks_mcp/tools/error_classifier.py +232 -0
- solidworks_mcp/tools/export.py +833 -0
- solidworks_mcp/tools/file_facts.py +40 -0
- solidworks_mcp/tools/file_management.py +1473 -0
- solidworks_mcp/tools/input_compat.py +17 -0
- solidworks_mcp/tools/macro_recording.py +464 -0
- solidworks_mcp/tools/modeling.py +2360 -0
- solidworks_mcp/tools/sketching.py +1422 -0
- solidworks_mcp/tools/template_management.py +367 -0
- solidworks_mcp/tools/tool_boundary.py +280 -0
- solidworks_mcp/tools/vba_generation.py +1145 -0
- solidworks_mcp/ui/__init__.py +9 -0
- solidworks_mcp/ui/local_llm.py +725 -0
- solidworks_mcp/ui/routers/__init__.py +10 -0
- solidworks_mcp/ui/routers/checkpoint.py +24 -0
- solidworks_mcp/ui/routers/docs.py +47 -0
- solidworks_mcp/ui/routers/llm.py +83 -0
- solidworks_mcp/ui/routers/local_model.py +69 -0
- solidworks_mcp/ui/routers/model.py +75 -0
- solidworks_mcp/ui/routers/preview.py +38 -0
- solidworks_mcp/ui/routers/session.py +161 -0
- solidworks_mcp/ui/routers/viewer.py +154 -0
- solidworks_mcp/ui/schemas.py +502 -0
- solidworks_mcp/ui/server.py +298 -0
- solidworks_mcp/ui/service.py +481 -0
- solidworks_mcp/ui/services/__init__.py +136 -0
- solidworks_mcp/ui/services/_utils.py +958 -0
- solidworks_mcp/ui/services/checkpoint_service.py +1110 -0
- solidworks_mcp/ui/services/docs_service.py +282 -0
- solidworks_mcp/ui/services/llm_service.py +956 -0
- solidworks_mcp/ui/services/model_service.py +459 -0
- solidworks_mcp/ui/services/parameter_repair_service.py +314 -0
- solidworks_mcp/ui/services/preview_service.py +489 -0
- solidworks_mcp/ui/services/session_service.py +1389 -0
- solidworks_mcp/utils/__init__.py +9 -0
- solidworks_mcp/utils/feature_tree_classifier.py +342 -0
- solidworks_mcp/utils/logging.py +76 -0
- solidworks_mcp/utils/validation.py +77 -0
- solidworks_mcp/version.py +8 -0
- solidworks_mcp_python-1.5.0.dist-info/METADATA +410 -0
- solidworks_mcp_python-1.5.0.dist-info/RECORD +115 -0
- solidworks_mcp_python-1.5.0.dist-info/WHEEL +4 -0
- solidworks_mcp_python-1.5.0.dist-info/entry_points.txt +3 -0
- solidworks_mcp_python-1.5.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,1882 @@
|
|
|
1
|
+
"""Base adapter interface for SolidWorks integration.
|
|
2
|
+
|
|
3
|
+
Defines the common interface that all SolidWorks adapters must implement, following the
|
|
4
|
+
adapter pattern from the original TypeScript implementation.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from abc import ABC, abstractmethod
|
|
10
|
+
from collections.abc import Mapping
|
|
11
|
+
from dataclasses import dataclass
|
|
12
|
+
from datetime import datetime
|
|
13
|
+
from enum import StrEnum
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
from typing import Any
|
|
16
|
+
|
|
17
|
+
from pydantic import BaseModel
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class AdapterHealth(BaseModel):
|
|
21
|
+
"""Health status information for adapters.
|
|
22
|
+
|
|
23
|
+
Attributes:
|
|
24
|
+
average_response_time (float): The average response time value.
|
|
25
|
+
connection_status (str): The connection status value.
|
|
26
|
+
error_count (int): The error count value.
|
|
27
|
+
healthy (bool): The healthy value.
|
|
28
|
+
last_check (datetime): The last check value.
|
|
29
|
+
metrics (dict[str, Any] | None): The metrics value.
|
|
30
|
+
success_count (int): The success count value.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
healthy: bool
|
|
34
|
+
last_check: datetime
|
|
35
|
+
error_count: int
|
|
36
|
+
success_count: int
|
|
37
|
+
average_response_time: float
|
|
38
|
+
connection_status: str
|
|
39
|
+
metrics: dict[str, Any] | None = None
|
|
40
|
+
|
|
41
|
+
def __getitem__(self, key: str) -> Any:
|
|
42
|
+
"""Build internal getitem.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
key (str): The key value.
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
Any: The result produced by the operation.
|
|
49
|
+
"""
|
|
50
|
+
if key == "status":
|
|
51
|
+
return "healthy" if self.healthy else "unhealthy"
|
|
52
|
+
if key == "connected":
|
|
53
|
+
return self.connection_status == "connected"
|
|
54
|
+
if key == "adapter_type":
|
|
55
|
+
return (self.metrics or {}).get("adapter_type")
|
|
56
|
+
if key == "version":
|
|
57
|
+
return (self.metrics or {}).get("version", "mock-1.0")
|
|
58
|
+
if key == "uptime":
|
|
59
|
+
return (self.metrics or {}).get("uptime", 0.0)
|
|
60
|
+
return self.model_dump().get(key)
|
|
61
|
+
|
|
62
|
+
def __contains__(self, key: str) -> bool:
|
|
63
|
+
"""Build internal contains.
|
|
64
|
+
|
|
65
|
+
Args:
|
|
66
|
+
key (str): The key value.
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
bool: True if contains, otherwise False.
|
|
70
|
+
"""
|
|
71
|
+
legacy_keys = {"status", "connected", "adapter_type", "version", "uptime"}
|
|
72
|
+
if key in legacy_keys:
|
|
73
|
+
return True
|
|
74
|
+
return key in self.model_dump()
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class AdapterResultStatus(StrEnum):
|
|
78
|
+
"""Result status for adapter operations.
|
|
79
|
+
|
|
80
|
+
Attributes:
|
|
81
|
+
ERROR (Any): The error value.
|
|
82
|
+
SUCCESS (Any): The success value.
|
|
83
|
+
TIMEOUT (Any): The timeout value.
|
|
84
|
+
WARNING (Any): The warning value.
|
|
85
|
+
"""
|
|
86
|
+
|
|
87
|
+
SUCCESS = "success"
|
|
88
|
+
ERROR = "error"
|
|
89
|
+
WARNING = "warning"
|
|
90
|
+
TIMEOUT = "timeout"
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
@dataclass
|
|
94
|
+
class AdapterResult[T]:
|
|
95
|
+
"""Result wrapper for adapter operations.
|
|
96
|
+
|
|
97
|
+
Attributes:
|
|
98
|
+
data (T | None): The data value.
|
|
99
|
+
error (str | None): The error value.
|
|
100
|
+
execution_time (float | None): The execution time value.
|
|
101
|
+
metadata (dict[str, Any] | None): The metadata value.
|
|
102
|
+
status (AdapterResultStatus): The status value.
|
|
103
|
+
"""
|
|
104
|
+
|
|
105
|
+
status: AdapterResultStatus
|
|
106
|
+
data: T | None = None
|
|
107
|
+
error: str | None = None
|
|
108
|
+
execution_time: float | None = None
|
|
109
|
+
metadata: dict[str, Any] | None = None
|
|
110
|
+
|
|
111
|
+
@property
|
|
112
|
+
def is_success(self) -> bool:
|
|
113
|
+
"""Check if operation was successful.
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
bool: True if success, otherwise False.
|
|
117
|
+
"""
|
|
118
|
+
return self.status == AdapterResultStatus.SUCCESS
|
|
119
|
+
|
|
120
|
+
@property
|
|
121
|
+
def is_error(self) -> bool:
|
|
122
|
+
"""Check if operation had an error.
|
|
123
|
+
|
|
124
|
+
Returns:
|
|
125
|
+
bool: True if error, otherwise False.
|
|
126
|
+
"""
|
|
127
|
+
return self.status == AdapterResultStatus.ERROR
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
# SolidWorks data models
|
|
131
|
+
class SolidWorksModel(BaseModel):
|
|
132
|
+
"""SolidWorks model information.
|
|
133
|
+
|
|
134
|
+
Attributes:
|
|
135
|
+
configuration (str | None): The configuration value.
|
|
136
|
+
is_active (bool): The is active value.
|
|
137
|
+
name (str): The name value.
|
|
138
|
+
path (str): The path value.
|
|
139
|
+
properties (dict[str, Any] | None): The properties value.
|
|
140
|
+
type (str): The type value.
|
|
141
|
+
"""
|
|
142
|
+
|
|
143
|
+
path: str
|
|
144
|
+
name: str
|
|
145
|
+
type: str # "Part", "Assembly", "Drawing"
|
|
146
|
+
is_active: bool
|
|
147
|
+
configuration: str | None = None
|
|
148
|
+
properties: dict[str, Any] | None = None
|
|
149
|
+
|
|
150
|
+
def __getitem__(self, key: str) -> Any:
|
|
151
|
+
"""Build internal getitem.
|
|
152
|
+
|
|
153
|
+
Args:
|
|
154
|
+
key (str): The key value.
|
|
155
|
+
|
|
156
|
+
Returns:
|
|
157
|
+
Any: The result produced by the operation.
|
|
158
|
+
"""
|
|
159
|
+
if key == "title":
|
|
160
|
+
return self.name
|
|
161
|
+
if key == "units":
|
|
162
|
+
return (self.properties or {}).get("units")
|
|
163
|
+
return self.model_dump().get(key)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
class SolidWorksFeature(BaseModel):
|
|
167
|
+
"""SolidWorks feature information.
|
|
168
|
+
|
|
169
|
+
Attributes:
|
|
170
|
+
id (str | None): The id value.
|
|
171
|
+
name (str): The name value.
|
|
172
|
+
parameters (dict[str, Any] | None): The parameters value.
|
|
173
|
+
parent (str | None): The parent value.
|
|
174
|
+
properties (dict[str, Any] | None): The properties value.
|
|
175
|
+
type (str): The type value.
|
|
176
|
+
"""
|
|
177
|
+
|
|
178
|
+
name: str
|
|
179
|
+
type: str
|
|
180
|
+
id: str | None = None
|
|
181
|
+
parent: str | None = None
|
|
182
|
+
properties: dict[str, Any] | None = None
|
|
183
|
+
parameters: dict[str, Any] | None = None
|
|
184
|
+
|
|
185
|
+
def __getitem__(self, key: str) -> Any:
|
|
186
|
+
"""Build internal getitem.
|
|
187
|
+
|
|
188
|
+
Args:
|
|
189
|
+
key (str): The key value.
|
|
190
|
+
|
|
191
|
+
Returns:
|
|
192
|
+
Any: The result produced by the operation.
|
|
193
|
+
"""
|
|
194
|
+
if self.parameters and key in self.parameters:
|
|
195
|
+
return self.parameters.get(key)
|
|
196
|
+
return self.model_dump().get(key)
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
class ExtrusionParameters(BaseModel):
|
|
200
|
+
"""Parameters for extrusion operations.
|
|
201
|
+
|
|
202
|
+
Attributes:
|
|
203
|
+
auto_select (bool): The auto select value.
|
|
204
|
+
both_directions (bool): The both directions value.
|
|
205
|
+
depth (float): The depth value.
|
|
206
|
+
draft_angle (float): The draft angle value.
|
|
207
|
+
end_condition (str): The end condition value.
|
|
208
|
+
feature_scope (bool): The feature scope value.
|
|
209
|
+
merge_result (bool): The merge result value.
|
|
210
|
+
reverse_direction (bool): The reverse direction value.
|
|
211
|
+
sketch_name (str | None): Explicit sketch to operate on. When set,
|
|
212
|
+
callers (e.g. create_cut_extrude) must select exactly this
|
|
213
|
+
sketch and fail with a clear error if it doesn't exist rather
|
|
214
|
+
than silently falling back to some other sketch.
|
|
215
|
+
thin_feature (bool): The thin feature value.
|
|
216
|
+
thin_thickness (float | None): The thin thickness value.
|
|
217
|
+
up_to_surface (str | None): The up to surface value.
|
|
218
|
+
"""
|
|
219
|
+
|
|
220
|
+
depth: float
|
|
221
|
+
draft_angle: float = 0.0
|
|
222
|
+
reverse_direction: bool = False
|
|
223
|
+
both_directions: bool = False
|
|
224
|
+
thin_feature: bool = False
|
|
225
|
+
thin_thickness: float | None = None
|
|
226
|
+
auto_fillet_corners: bool = False
|
|
227
|
+
fillet_corners_radius: float = 0.0
|
|
228
|
+
end_condition: str = "Blind"
|
|
229
|
+
up_to_surface: str | None = None
|
|
230
|
+
merge_result: bool = True
|
|
231
|
+
feature_scope: bool = False
|
|
232
|
+
auto_select: bool = True
|
|
233
|
+
sketch_name: str | None = None
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
class RevolveParameters(BaseModel):
|
|
237
|
+
"""Parameters for revolve operations.
|
|
238
|
+
|
|
239
|
+
Attributes:
|
|
240
|
+
angle (float): The angle value.
|
|
241
|
+
both_directions (bool): The both directions value.
|
|
242
|
+
merge_result (bool): The merge result value.
|
|
243
|
+
reverse_direction (bool): The reverse direction value.
|
|
244
|
+
thin_feature (bool): The thin feature value.
|
|
245
|
+
thin_thickness (float | None): The thin thickness value.
|
|
246
|
+
"""
|
|
247
|
+
|
|
248
|
+
angle: float
|
|
249
|
+
reverse_direction: bool = False
|
|
250
|
+
both_directions: bool = False
|
|
251
|
+
thin_feature: bool = False
|
|
252
|
+
thin_thickness: float | None = None
|
|
253
|
+
merge_result: bool = True
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
class SweepParameters(BaseModel):
|
|
257
|
+
"""Parameters for sweep operations.
|
|
258
|
+
|
|
259
|
+
Attributes:
|
|
260
|
+
merge_result (bool): The merge result value.
|
|
261
|
+
path (str): The path value.
|
|
262
|
+
twist_along_path (bool): The twist along path value.
|
|
263
|
+
twist_angle (float): The twist angle value.
|
|
264
|
+
"""
|
|
265
|
+
|
|
266
|
+
path: str
|
|
267
|
+
twist_along_path: bool = False
|
|
268
|
+
twist_angle: float = 0.0
|
|
269
|
+
merge_result: bool = True
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
class LoftParameters(BaseModel):
|
|
273
|
+
"""Parameters for loft operations.
|
|
274
|
+
|
|
275
|
+
Attributes:
|
|
276
|
+
end_tangent (str | None): The end tangent value.
|
|
277
|
+
guide_curves (list[str] | None): The guide curves value.
|
|
278
|
+
merge_result (bool): The merge result value.
|
|
279
|
+
profiles (list[str]): The profiles value.
|
|
280
|
+
start_tangent (str | None): The start tangent value.
|
|
281
|
+
"""
|
|
282
|
+
|
|
283
|
+
profiles: list[str]
|
|
284
|
+
guide_curves: list[str] | None = None
|
|
285
|
+
start_tangent: str | None = None
|
|
286
|
+
end_tangent: str | None = None
|
|
287
|
+
merge_result: bool = True
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
class MassProperties(BaseModel):
|
|
291
|
+
"""Mass properties information.
|
|
292
|
+
|
|
293
|
+
Attributes:
|
|
294
|
+
center_of_mass (list[float]): The center of mass value.
|
|
295
|
+
mass (float): The mass value.
|
|
296
|
+
moments_of_inertia (dict[str, float]): The moments of inertia value.
|
|
297
|
+
principal_axes (dict[str, list[float]] | None): The principal axes value.
|
|
298
|
+
surface_area (float): The surface area value.
|
|
299
|
+
volume (float): The volume value.
|
|
300
|
+
"""
|
|
301
|
+
|
|
302
|
+
volume: float
|
|
303
|
+
surface_area: float
|
|
304
|
+
mass: float
|
|
305
|
+
center_of_mass: list[float] # [x, y, z]
|
|
306
|
+
moments_of_inertia: dict[str, float]
|
|
307
|
+
principal_axes: dict[str, list[float]] | None = None
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
class SolidWorksAdapter(ABC):
|
|
311
|
+
"""Base adapter interface for SolidWorks integration.
|
|
312
|
+
|
|
313
|
+
Args:
|
|
314
|
+
config (object | None): Configuration values for the operation. Defaults to None.
|
|
315
|
+
|
|
316
|
+
Attributes:
|
|
317
|
+
_metrics (Any): The metrics value.
|
|
318
|
+
config (Any): The config value.
|
|
319
|
+
config_dict (Any): The config dict value.
|
|
320
|
+
"""
|
|
321
|
+
|
|
322
|
+
def __init__(self, config: object | None = None):
|
|
323
|
+
"""Initialize adapter with configuration.
|
|
324
|
+
|
|
325
|
+
Args:
|
|
326
|
+
config (object | None): Configuration values for the operation. Defaults to None.
|
|
327
|
+
"""
|
|
328
|
+
if config is None:
|
|
329
|
+
normalized_config: dict[str, Any] = {}
|
|
330
|
+
elif isinstance(config, Mapping):
|
|
331
|
+
normalized_config = dict(config)
|
|
332
|
+
elif hasattr(config, "model_dump"):
|
|
333
|
+
normalized_config = dict(config.model_dump())
|
|
334
|
+
else:
|
|
335
|
+
normalized_config = {}
|
|
336
|
+
|
|
337
|
+
# Preserve original config object for compatibility with tests and
|
|
338
|
+
# call sites that compare object identity/equality.
|
|
339
|
+
self.config = config
|
|
340
|
+
# Keep a normalized mapping for adapter internals.
|
|
341
|
+
self.config_dict = normalized_config
|
|
342
|
+
self._metrics = {
|
|
343
|
+
"operations_count": 0,
|
|
344
|
+
"errors_count": 0,
|
|
345
|
+
"average_response_time": 0.0,
|
|
346
|
+
}
|
|
347
|
+
# SolidWorks-as-Code session logging. Set soc_session_id to enable
|
|
348
|
+
# automatic ToolCallRecord writes for every adapter operation.
|
|
349
|
+
self.soc_session_id: str | None = None
|
|
350
|
+
self.soc_db_path: Path | None = None
|
|
351
|
+
|
|
352
|
+
# Connection Management
|
|
353
|
+
@abstractmethod
|
|
354
|
+
async def connect(self) -> None:
|
|
355
|
+
"""Connect to SolidWorks application.
|
|
356
|
+
|
|
357
|
+
Returns:
|
|
358
|
+
None: None.
|
|
359
|
+
"""
|
|
360
|
+
pass
|
|
361
|
+
|
|
362
|
+
@abstractmethod
|
|
363
|
+
async def disconnect(self) -> None:
|
|
364
|
+
"""Disconnect from SolidWorks application.
|
|
365
|
+
|
|
366
|
+
Returns:
|
|
367
|
+
None: None.
|
|
368
|
+
"""
|
|
369
|
+
pass
|
|
370
|
+
|
|
371
|
+
@abstractmethod
|
|
372
|
+
def is_connected(self) -> bool:
|
|
373
|
+
"""Check if connected to SolidWorks.
|
|
374
|
+
|
|
375
|
+
Returns:
|
|
376
|
+
bool: True if connected, otherwise False.
|
|
377
|
+
"""
|
|
378
|
+
pass
|
|
379
|
+
|
|
380
|
+
@abstractmethod
|
|
381
|
+
async def health_check(self) -> AdapterHealth:
|
|
382
|
+
"""Get adapter health status.
|
|
383
|
+
|
|
384
|
+
Returns:
|
|
385
|
+
AdapterHealth: The result produced by the operation.
|
|
386
|
+
"""
|
|
387
|
+
pass
|
|
388
|
+
|
|
389
|
+
# Model Operations
|
|
390
|
+
@abstractmethod
|
|
391
|
+
async def open_model(self, file_path: str) -> AdapterResult[SolidWorksModel]:
|
|
392
|
+
"""Open a SolidWorks model (part, assembly, or drawing).
|
|
393
|
+
|
|
394
|
+
Args:
|
|
395
|
+
file_path (str): Path to the target file.
|
|
396
|
+
|
|
397
|
+
Returns:
|
|
398
|
+
AdapterResult[SolidWorksModel]: The result produced by the operation.
|
|
399
|
+
"""
|
|
400
|
+
pass
|
|
401
|
+
|
|
402
|
+
@abstractmethod
|
|
403
|
+
async def close_model(self, save: bool = False) -> AdapterResult[None]:
|
|
404
|
+
"""Close the current model.
|
|
405
|
+
|
|
406
|
+
Args:
|
|
407
|
+
save (bool): The save value. Defaults to False.
|
|
408
|
+
|
|
409
|
+
Returns:
|
|
410
|
+
AdapterResult[None]: The result produced by the operation.
|
|
411
|
+
"""
|
|
412
|
+
pass
|
|
413
|
+
|
|
414
|
+
async def save_file(self, file_path: str | None = None) -> AdapterResult[Any]:
|
|
415
|
+
"""Save the active model to the existing path or the provided path.
|
|
416
|
+
|
|
417
|
+
Args:
|
|
418
|
+
file_path (str | None): Path to the target file. Defaults to None.
|
|
419
|
+
|
|
420
|
+
Returns:
|
|
421
|
+
AdapterResult[Any]: The result produced by the operation.
|
|
422
|
+
"""
|
|
423
|
+
return AdapterResult(
|
|
424
|
+
status=AdapterResultStatus.ERROR,
|
|
425
|
+
error="save_file is not implemented by this adapter",
|
|
426
|
+
)
|
|
427
|
+
|
|
428
|
+
@abstractmethod
|
|
429
|
+
async def get_model_info(self) -> AdapterResult[dict[str, Any]]:
|
|
430
|
+
"""Get metadata for the active model.
|
|
431
|
+
|
|
432
|
+
Returns:
|
|
433
|
+
AdapterResult[dict[str, Any]]: The result produced by the operation.
|
|
434
|
+
"""
|
|
435
|
+
pass
|
|
436
|
+
|
|
437
|
+
@abstractmethod
|
|
438
|
+
async def list_features(
|
|
439
|
+
self, include_suppressed: bool = False, max_assembly_depth: int = 2
|
|
440
|
+
) -> AdapterResult[list[dict[str, Any]]]:
|
|
441
|
+
"""List model features from the feature tree.
|
|
442
|
+
|
|
443
|
+
For a Part document, returns that document's own feature list,
|
|
444
|
+
unchanged from prior behavior. For an Assembly document, returns a
|
|
445
|
+
single flat list containing the assembly's own top-level features
|
|
446
|
+
plus every resolved component's features, recursing into
|
|
447
|
+
sub-assemblies up to ``max_assembly_depth``. Every descriptor gains
|
|
448
|
+
``component``, ``component_path``, and ``component_parent`` keys:
|
|
449
|
+
``None`` for a document's own features (Part features, or an Assembly's
|
|
450
|
+
top-level features), or the owning component's name/path for a
|
|
451
|
+
component-derived feature. ``component_parent`` is the immediate parent
|
|
452
|
+
component name when the component is nested inside a sub-assembly,
|
|
453
|
+
otherwise ``None``. A component that cannot be resolved (suppressed,
|
|
454
|
+
lightweight-and-unloaded, missing file) is represented by one descriptor
|
|
455
|
+
with ``type: "UnresolvedComponent"`` instead of being silently dropped.
|
|
456
|
+
|
|
457
|
+
Args:
|
|
458
|
+
include_suppressed (bool): The include suppressed value. Defaults to False.
|
|
459
|
+
Applied independently to the assembly's own features and to
|
|
460
|
+
each component's features.
|
|
461
|
+
max_assembly_depth (int): How many levels of sub-assembly to
|
|
462
|
+
recurse into. Defaults to 2. Ignored for Part documents. A
|
|
463
|
+
component beyond the configured depth still appears in the
|
|
464
|
+
result as a single descriptor (name + path), not expanded.
|
|
465
|
+
|
|
466
|
+
Returns:
|
|
467
|
+
AdapterResult[list[dict[str, Any]]]: The result produced by the operation.
|
|
468
|
+
"""
|
|
469
|
+
pass
|
|
470
|
+
|
|
471
|
+
@abstractmethod
|
|
472
|
+
async def list_configurations(self) -> AdapterResult[list[str]]:
|
|
473
|
+
"""List configuration names for the active model.
|
|
474
|
+
|
|
475
|
+
Returns:
|
|
476
|
+
AdapterResult[list[str]]: The result produced by the operation.
|
|
477
|
+
"""
|
|
478
|
+
pass
|
|
479
|
+
|
|
480
|
+
@abstractmethod
|
|
481
|
+
async def create_part(
|
|
482
|
+
self,
|
|
483
|
+
name: str | None = None,
|
|
484
|
+
units: str | None = None,
|
|
485
|
+
template: str | None = None,
|
|
486
|
+
) -> AdapterResult[SolidWorksModel]:
|
|
487
|
+
"""Create a new part document.
|
|
488
|
+
|
|
489
|
+
Args:
|
|
490
|
+
name (str | None): The name value. Defaults to None.
|
|
491
|
+
units (str | None): The units value. Defaults to None.
|
|
492
|
+
template (str | None): Template file path. Defaults to None.
|
|
493
|
+
|
|
494
|
+
Returns:
|
|
495
|
+
AdapterResult[SolidWorksModel]: The result produced by the operation.
|
|
496
|
+
"""
|
|
497
|
+
pass
|
|
498
|
+
|
|
499
|
+
@abstractmethod
|
|
500
|
+
async def create_assembly(
|
|
501
|
+
self, name: str | None = None, template: str | None = None
|
|
502
|
+
) -> AdapterResult[SolidWorksModel]:
|
|
503
|
+
"""Create a new assembly document.
|
|
504
|
+
|
|
505
|
+
Args:
|
|
506
|
+
name (str | None): The name value. Defaults to None.
|
|
507
|
+
template (str | None): Template file path. Defaults to None.
|
|
508
|
+
|
|
509
|
+
Returns:
|
|
510
|
+
AdapterResult[SolidWorksModel]: The result produced by the operation.
|
|
511
|
+
"""
|
|
512
|
+
pass
|
|
513
|
+
|
|
514
|
+
@abstractmethod
|
|
515
|
+
async def create_drawing(
|
|
516
|
+
self, name: str | None = None, template: str | None = None
|
|
517
|
+
) -> AdapterResult[SolidWorksModel]:
|
|
518
|
+
"""Create a new drawing document.
|
|
519
|
+
|
|
520
|
+
Args:
|
|
521
|
+
name (str | None): The name value. Defaults to None.
|
|
522
|
+
template (str | None): Template file path. Defaults to None.
|
|
523
|
+
|
|
524
|
+
Returns:
|
|
525
|
+
AdapterResult[SolidWorksModel]: The result produced by the operation.
|
|
526
|
+
"""
|
|
527
|
+
pass
|
|
528
|
+
|
|
529
|
+
# Feature Operations
|
|
530
|
+
@abstractmethod
|
|
531
|
+
async def create_extrusion(
|
|
532
|
+
self, params: ExtrusionParameters
|
|
533
|
+
) -> AdapterResult[SolidWorksFeature]:
|
|
534
|
+
"""Create an extrusion feature.
|
|
535
|
+
|
|
536
|
+
Args:
|
|
537
|
+
params (ExtrusionParameters): The params value.
|
|
538
|
+
|
|
539
|
+
Returns:
|
|
540
|
+
AdapterResult[SolidWorksFeature]: The result produced by the operation.
|
|
541
|
+
"""
|
|
542
|
+
pass
|
|
543
|
+
|
|
544
|
+
@abstractmethod
|
|
545
|
+
async def create_revolve(
|
|
546
|
+
self, params: RevolveParameters
|
|
547
|
+
) -> AdapterResult[SolidWorksFeature]:
|
|
548
|
+
"""Create a revolve feature.
|
|
549
|
+
|
|
550
|
+
Args:
|
|
551
|
+
params (RevolveParameters): The params value.
|
|
552
|
+
|
|
553
|
+
Returns:
|
|
554
|
+
AdapterResult[SolidWorksFeature]: The result produced by the operation.
|
|
555
|
+
"""
|
|
556
|
+
pass
|
|
557
|
+
|
|
558
|
+
@abstractmethod
|
|
559
|
+
async def create_sweep(
|
|
560
|
+
self, params: SweepParameters
|
|
561
|
+
) -> AdapterResult[SolidWorksFeature]:
|
|
562
|
+
"""Create a sweep feature.
|
|
563
|
+
|
|
564
|
+
Args:
|
|
565
|
+
params (SweepParameters): The params value.
|
|
566
|
+
|
|
567
|
+
Returns:
|
|
568
|
+
AdapterResult[SolidWorksFeature]: The result produced by the operation.
|
|
569
|
+
"""
|
|
570
|
+
pass
|
|
571
|
+
|
|
572
|
+
@abstractmethod
|
|
573
|
+
async def create_loft(
|
|
574
|
+
self, params: LoftParameters
|
|
575
|
+
) -> AdapterResult[SolidWorksFeature]:
|
|
576
|
+
"""Create a loft feature.
|
|
577
|
+
|
|
578
|
+
Args:
|
|
579
|
+
params (LoftParameters): The params value.
|
|
580
|
+
|
|
581
|
+
Returns:
|
|
582
|
+
AdapterResult[SolidWorksFeature]: The result produced by the operation.
|
|
583
|
+
"""
|
|
584
|
+
pass
|
|
585
|
+
|
|
586
|
+
# Sketch Operations
|
|
587
|
+
@abstractmethod
|
|
588
|
+
async def create_sketch(self, plane: str) -> AdapterResult[str]:
|
|
589
|
+
"""Create a new sketch on the specified plane.
|
|
590
|
+
|
|
591
|
+
Args:
|
|
592
|
+
plane (str): The plane value.
|
|
593
|
+
|
|
594
|
+
Returns:
|
|
595
|
+
AdapterResult[str]: The result produced by the operation.
|
|
596
|
+
"""
|
|
597
|
+
pass
|
|
598
|
+
|
|
599
|
+
@abstractmethod
|
|
600
|
+
async def add_line(
|
|
601
|
+
self, x1: float, y1: float, x2: float, y2: float
|
|
602
|
+
) -> AdapterResult[str]:
|
|
603
|
+
"""Add a line to the current sketch.
|
|
604
|
+
|
|
605
|
+
Args:
|
|
606
|
+
x1 (float): The x1 value.
|
|
607
|
+
y1 (float): The y1 value.
|
|
608
|
+
x2 (float): The x2 value.
|
|
609
|
+
y2 (float): The y2 value.
|
|
610
|
+
|
|
611
|
+
Returns:
|
|
612
|
+
AdapterResult[str]: The result produced by the operation.
|
|
613
|
+
"""
|
|
614
|
+
pass
|
|
615
|
+
|
|
616
|
+
@abstractmethod
|
|
617
|
+
async def add_circle(
|
|
618
|
+
self, center_x: float, center_y: float, radius: float
|
|
619
|
+
) -> AdapterResult[str]:
|
|
620
|
+
"""Add a circle to the current sketch.
|
|
621
|
+
|
|
622
|
+
Args:
|
|
623
|
+
center_x (float): The center x value.
|
|
624
|
+
center_y (float): The center y value.
|
|
625
|
+
radius (float): The radius value.
|
|
626
|
+
|
|
627
|
+
Returns:
|
|
628
|
+
AdapterResult[str]: The result produced by the operation.
|
|
629
|
+
"""
|
|
630
|
+
pass
|
|
631
|
+
|
|
632
|
+
@abstractmethod
|
|
633
|
+
async def add_rectangle(
|
|
634
|
+
self, x1: float, y1: float, x2: float, y2: float
|
|
635
|
+
) -> AdapterResult[str]:
|
|
636
|
+
"""Add a rectangle to the current sketch.
|
|
637
|
+
|
|
638
|
+
Args:
|
|
639
|
+
x1 (float): The x1 value.
|
|
640
|
+
y1 (float): The y1 value.
|
|
641
|
+
x2 (float): The x2 value.
|
|
642
|
+
y2 (float): The y2 value.
|
|
643
|
+
|
|
644
|
+
Returns:
|
|
645
|
+
AdapterResult[str]: The result produced by the operation.
|
|
646
|
+
"""
|
|
647
|
+
pass
|
|
648
|
+
|
|
649
|
+
async def add_arc(
|
|
650
|
+
self,
|
|
651
|
+
center_x: float,
|
|
652
|
+
center_y: float,
|
|
653
|
+
start_x: float,
|
|
654
|
+
start_y: float,
|
|
655
|
+
end_x: float,
|
|
656
|
+
end_y: float,
|
|
657
|
+
) -> AdapterResult[str]:
|
|
658
|
+
"""Add an arc to the current sketch.
|
|
659
|
+
|
|
660
|
+
Args:
|
|
661
|
+
center_x (float): The center x value.
|
|
662
|
+
center_y (float): The center y value.
|
|
663
|
+
start_x (float): The start x value.
|
|
664
|
+
start_y (float): The start y value.
|
|
665
|
+
end_x (float): The end x value.
|
|
666
|
+
end_y (float): The end y value.
|
|
667
|
+
|
|
668
|
+
Returns:
|
|
669
|
+
AdapterResult[str]: The result produced by the operation.
|
|
670
|
+
"""
|
|
671
|
+
return AdapterResult(
|
|
672
|
+
status=AdapterResultStatus.ERROR,
|
|
673
|
+
error="add_arc is not implemented by this adapter",
|
|
674
|
+
)
|
|
675
|
+
|
|
676
|
+
async def add_spline(self, points: list[dict[str, float]]) -> AdapterResult[str]:
|
|
677
|
+
"""Add a spline through the provided points.
|
|
678
|
+
|
|
679
|
+
Args:
|
|
680
|
+
points (list[dict[str, float]]): The points value.
|
|
681
|
+
|
|
682
|
+
Returns:
|
|
683
|
+
AdapterResult[str]: The result produced by the operation.
|
|
684
|
+
"""
|
|
685
|
+
return AdapterResult(
|
|
686
|
+
status=AdapterResultStatus.ERROR,
|
|
687
|
+
error="add_spline is not implemented by this adapter",
|
|
688
|
+
)
|
|
689
|
+
|
|
690
|
+
async def add_centerline(
|
|
691
|
+
self, x1: float, y1: float, x2: float, y2: float
|
|
692
|
+
) -> AdapterResult[str]:
|
|
693
|
+
"""Add a centerline to the current sketch.
|
|
694
|
+
|
|
695
|
+
Args:
|
|
696
|
+
x1 (float): The x1 value.
|
|
697
|
+
y1 (float): The y1 value.
|
|
698
|
+
x2 (float): The x2 value.
|
|
699
|
+
y2 (float): The y2 value.
|
|
700
|
+
|
|
701
|
+
Returns:
|
|
702
|
+
AdapterResult[str]: The result produced by the operation.
|
|
703
|
+
"""
|
|
704
|
+
return AdapterResult(
|
|
705
|
+
status=AdapterResultStatus.ERROR,
|
|
706
|
+
error="add_centerline is not implemented by this adapter",
|
|
707
|
+
)
|
|
708
|
+
|
|
709
|
+
async def add_polygon(
|
|
710
|
+
self, center_x: float, center_y: float, radius: float, sides: int
|
|
711
|
+
) -> AdapterResult[str]:
|
|
712
|
+
"""Add a regular polygon to the current sketch.
|
|
713
|
+
|
|
714
|
+
Args:
|
|
715
|
+
center_x (float): The center x value.
|
|
716
|
+
center_y (float): The center y value.
|
|
717
|
+
radius (float): The radius value.
|
|
718
|
+
sides (int): The sides value.
|
|
719
|
+
|
|
720
|
+
Returns:
|
|
721
|
+
AdapterResult[str]: The result produced by the operation.
|
|
722
|
+
"""
|
|
723
|
+
return AdapterResult(
|
|
724
|
+
status=AdapterResultStatus.ERROR,
|
|
725
|
+
error="add_polygon is not implemented by this adapter",
|
|
726
|
+
)
|
|
727
|
+
|
|
728
|
+
async def add_ellipse(
|
|
729
|
+
self,
|
|
730
|
+
center_x: float,
|
|
731
|
+
center_y: float,
|
|
732
|
+
major_axis: float,
|
|
733
|
+
minor_axis: float,
|
|
734
|
+
) -> AdapterResult[str]:
|
|
735
|
+
"""Add an ellipse to the current sketch.
|
|
736
|
+
|
|
737
|
+
Args:
|
|
738
|
+
center_x (float): The center x value.
|
|
739
|
+
center_y (float): The center y value.
|
|
740
|
+
major_axis (float): The major axis value.
|
|
741
|
+
minor_axis (float): The minor axis value.
|
|
742
|
+
|
|
743
|
+
Returns:
|
|
744
|
+
AdapterResult[str]: The result produced by the operation.
|
|
745
|
+
"""
|
|
746
|
+
return AdapterResult(
|
|
747
|
+
status=AdapterResultStatus.ERROR,
|
|
748
|
+
error="add_ellipse is not implemented by this adapter",
|
|
749
|
+
)
|
|
750
|
+
|
|
751
|
+
async def add_sketch_constraint(
|
|
752
|
+
self,
|
|
753
|
+
entity1: str,
|
|
754
|
+
entity2: str | None,
|
|
755
|
+
relation_type: str,
|
|
756
|
+
entity3: str | None = None,
|
|
757
|
+
) -> AdapterResult[str]:
|
|
758
|
+
"""Apply a geometric constraint between sketch entities.
|
|
759
|
+
|
|
760
|
+
Args:
|
|
761
|
+
entity1 (str): The entity1 value.
|
|
762
|
+
entity2 (str | None): The entity2 value.
|
|
763
|
+
relation_type (str): The relation type value.
|
|
764
|
+
entity3 (str | None): Third entity ID — only used by the
|
|
765
|
+
``symmetric`` relation (the centerline of symmetry). All
|
|
766
|
+
other relation types reject a non-null ``entity3``.
|
|
767
|
+
|
|
768
|
+
Returns:
|
|
769
|
+
AdapterResult[str]: The result produced by the operation.
|
|
770
|
+
"""
|
|
771
|
+
return AdapterResult(
|
|
772
|
+
status=AdapterResultStatus.ERROR,
|
|
773
|
+
error="add_sketch_constraint is not implemented by this adapter",
|
|
774
|
+
)
|
|
775
|
+
|
|
776
|
+
async def add_sketch_dimension(
|
|
777
|
+
self,
|
|
778
|
+
entity1: str,
|
|
779
|
+
entity2: str | None,
|
|
780
|
+
dimension_type: str,
|
|
781
|
+
value: float,
|
|
782
|
+
) -> AdapterResult[str]:
|
|
783
|
+
"""Add a sketch dimension.
|
|
784
|
+
|
|
785
|
+
Args:
|
|
786
|
+
entity1 (str): The entity1 value.
|
|
787
|
+
entity2 (str | None): The entity2 value.
|
|
788
|
+
dimension_type (str): The dimension type value.
|
|
789
|
+
value (float): The value value.
|
|
790
|
+
|
|
791
|
+
Returns:
|
|
792
|
+
AdapterResult[str]: The result produced by the operation.
|
|
793
|
+
"""
|
|
794
|
+
return AdapterResult(
|
|
795
|
+
status=AdapterResultStatus.ERROR,
|
|
796
|
+
error="add_sketch_dimension is not implemented by this adapter",
|
|
797
|
+
)
|
|
798
|
+
|
|
799
|
+
async def check_sketch_fully_defined(
|
|
800
|
+
self, sketch_name: str | None = None
|
|
801
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
802
|
+
"""Check whether a sketch is fully defined.
|
|
803
|
+
|
|
804
|
+
Args:
|
|
805
|
+
sketch_name (str | None): Optional sketch name to inspect. Defaults to None.
|
|
806
|
+
|
|
807
|
+
Returns:
|
|
808
|
+
AdapterResult[dict[str, Any]]: Definition status payload.
|
|
809
|
+
"""
|
|
810
|
+
return AdapterResult(
|
|
811
|
+
status=AdapterResultStatus.ERROR,
|
|
812
|
+
error="check_sketch_fully_defined is not implemented by this adapter",
|
|
813
|
+
)
|
|
814
|
+
|
|
815
|
+
async def sketch_linear_pattern(
|
|
816
|
+
self,
|
|
817
|
+
entities: list[str],
|
|
818
|
+
direction_x: float,
|
|
819
|
+
direction_y: float,
|
|
820
|
+
spacing: float,
|
|
821
|
+
count: int,
|
|
822
|
+
) -> AdapterResult[str]:
|
|
823
|
+
"""Create a linear pattern of sketch entities.
|
|
824
|
+
|
|
825
|
+
Args:
|
|
826
|
+
entities (list[str]): The entities value.
|
|
827
|
+
direction_x (float): The direction x value.
|
|
828
|
+
direction_y (float): The direction y value.
|
|
829
|
+
spacing (float): The spacing value.
|
|
830
|
+
count (int): The count value.
|
|
831
|
+
|
|
832
|
+
Returns:
|
|
833
|
+
AdapterResult[str]: The result produced by the operation.
|
|
834
|
+
"""
|
|
835
|
+
return AdapterResult(
|
|
836
|
+
status=AdapterResultStatus.ERROR,
|
|
837
|
+
error="sketch_linear_pattern is not implemented by this adapter",
|
|
838
|
+
)
|
|
839
|
+
|
|
840
|
+
async def sketch_circular_pattern(
|
|
841
|
+
self,
|
|
842
|
+
entities: list[str],
|
|
843
|
+
angle: float,
|
|
844
|
+
count: int,
|
|
845
|
+
) -> AdapterResult[str]:
|
|
846
|
+
"""Create a circular pattern of sketch entities around the sketch origin.
|
|
847
|
+
|
|
848
|
+
The rotation axis is always the sketch origin — SW's
|
|
849
|
+
``CreateCircularSketchStepAndRepeat`` has no pattern-centre
|
|
850
|
+
parameter and derives the axis from the seed's geometry. Place
|
|
851
|
+
the seed entity at the desired radius from the origin.
|
|
852
|
+
|
|
853
|
+
Args:
|
|
854
|
+
entities (list[str]): The entities value.
|
|
855
|
+
angle (float): The angle value.
|
|
856
|
+
count (int): The count value.
|
|
857
|
+
|
|
858
|
+
Returns:
|
|
859
|
+
AdapterResult[str]: The result produced by the operation.
|
|
860
|
+
"""
|
|
861
|
+
return AdapterResult(
|
|
862
|
+
status=AdapterResultStatus.ERROR,
|
|
863
|
+
error="sketch_circular_pattern is not implemented by this adapter",
|
|
864
|
+
)
|
|
865
|
+
|
|
866
|
+
async def sketch_mirror(
|
|
867
|
+
self, entities: list[str], mirror_line: str
|
|
868
|
+
) -> AdapterResult[str]:
|
|
869
|
+
"""Mirror sketch entities about a mirror line.
|
|
870
|
+
|
|
871
|
+
Args:
|
|
872
|
+
entities (list[str]): The entities value.
|
|
873
|
+
mirror_line (str): The mirror line value.
|
|
874
|
+
|
|
875
|
+
Returns:
|
|
876
|
+
AdapterResult[str]: The result produced by the operation.
|
|
877
|
+
"""
|
|
878
|
+
return AdapterResult(
|
|
879
|
+
status=AdapterResultStatus.ERROR,
|
|
880
|
+
error="sketch_mirror is not implemented by this adapter",
|
|
881
|
+
)
|
|
882
|
+
|
|
883
|
+
async def sketch_offset(
|
|
884
|
+
self,
|
|
885
|
+
entities: list[str],
|
|
886
|
+
offset_distance: float,
|
|
887
|
+
reverse_direction: bool,
|
|
888
|
+
) -> AdapterResult[str]:
|
|
889
|
+
"""Offset sketch entities.
|
|
890
|
+
|
|
891
|
+
Args:
|
|
892
|
+
entities (list[str]): The entities value.
|
|
893
|
+
offset_distance (float): The offset distance value.
|
|
894
|
+
reverse_direction (bool): The reverse direction value.
|
|
895
|
+
|
|
896
|
+
Returns:
|
|
897
|
+
AdapterResult[str]: The result produced by the operation.
|
|
898
|
+
"""
|
|
899
|
+
return AdapterResult(
|
|
900
|
+
status=AdapterResultStatus.ERROR,
|
|
901
|
+
error="sketch_offset is not implemented by this adapter",
|
|
902
|
+
)
|
|
903
|
+
|
|
904
|
+
async def add_sketch_circle(
|
|
905
|
+
self,
|
|
906
|
+
center_x: float,
|
|
907
|
+
center_y: float,
|
|
908
|
+
radius: float,
|
|
909
|
+
construction: bool = False,
|
|
910
|
+
) -> AdapterResult[str]:
|
|
911
|
+
"""Alias for add_circle used by some tool flows.
|
|
912
|
+
|
|
913
|
+
Args:
|
|
914
|
+
center_x (float): The center x value.
|
|
915
|
+
center_y (float): The center y value.
|
|
916
|
+
radius (float): The radius value.
|
|
917
|
+
construction (bool): The construction value. Defaults to False.
|
|
918
|
+
|
|
919
|
+
Returns:
|
|
920
|
+
AdapterResult[str]: The result produced by the operation.
|
|
921
|
+
"""
|
|
922
|
+
return await self.add_circle(center_x, center_y, radius)
|
|
923
|
+
|
|
924
|
+
async def create_cut(self, sketch_name: str, depth: float) -> AdapterResult[str]:
|
|
925
|
+
"""Create a cut feature from an existing sketch.
|
|
926
|
+
|
|
927
|
+
Args:
|
|
928
|
+
sketch_name (str): The sketch name value.
|
|
929
|
+
depth (float): The depth value.
|
|
930
|
+
|
|
931
|
+
Returns:
|
|
932
|
+
AdapterResult[str]: The result produced by the operation.
|
|
933
|
+
"""
|
|
934
|
+
return AdapterResult(
|
|
935
|
+
status=AdapterResultStatus.ERROR,
|
|
936
|
+
error="create_cut is not implemented by this adapter",
|
|
937
|
+
)
|
|
938
|
+
|
|
939
|
+
async def create_cut_extrude(
|
|
940
|
+
self, params: ExtrusionParameters
|
|
941
|
+
) -> AdapterResult[Any]:
|
|
942
|
+
"""Create a cut-extrude feature from the active sketch.
|
|
943
|
+
|
|
944
|
+
Cuts material from the current solid body using the active sketch profile.
|
|
945
|
+
Equivalent to SolidWorks Insert > Cut > Extrude.
|
|
946
|
+
|
|
947
|
+
Args:
|
|
948
|
+
params (ExtrusionParameters): Depth and direction parameters.
|
|
949
|
+
|
|
950
|
+
Returns:
|
|
951
|
+
AdapterResult: Feature result or error.
|
|
952
|
+
"""
|
|
953
|
+
return AdapterResult(
|
|
954
|
+
status=AdapterResultStatus.ERROR,
|
|
955
|
+
error="create_cut_extrude is not implemented by this adapter",
|
|
956
|
+
)
|
|
957
|
+
|
|
958
|
+
async def add_fillet(
|
|
959
|
+
self, radius: float, edge_names: list[str]
|
|
960
|
+
) -> AdapterResult[Any]:
|
|
961
|
+
"""Add a fillet feature to selected edges.
|
|
962
|
+
|
|
963
|
+
Rounds the selected edges of the current solid body with the given radius.
|
|
964
|
+
|
|
965
|
+
Args:
|
|
966
|
+
radius (float): Fillet radius in millimeters.
|
|
967
|
+
edge_names (list[str]): List of edge names to fillet.
|
|
968
|
+
|
|
969
|
+
Returns:
|
|
970
|
+
AdapterResult: Feature result or error.
|
|
971
|
+
"""
|
|
972
|
+
return AdapterResult(
|
|
973
|
+
status=AdapterResultStatus.ERROR,
|
|
974
|
+
error="add_fillet is not implemented by this adapter",
|
|
975
|
+
)
|
|
976
|
+
|
|
977
|
+
async def add_chamfer(
|
|
978
|
+
self, distance: float, edge_names: list[str]
|
|
979
|
+
) -> AdapterResult[Any]:
|
|
980
|
+
"""Add an equal-distance chamfer feature to selected edges.
|
|
981
|
+
|
|
982
|
+
Chamfers the selected edges of the current solid body by the given
|
|
983
|
+
distance.
|
|
984
|
+
|
|
985
|
+
Args:
|
|
986
|
+
distance (float): Chamfer distance in millimeters.
|
|
987
|
+
edge_names (list[str]): List of edge names to chamfer.
|
|
988
|
+
|
|
989
|
+
Returns:
|
|
990
|
+
AdapterResult: Feature result or error.
|
|
991
|
+
"""
|
|
992
|
+
return AdapterResult(
|
|
993
|
+
status=AdapterResultStatus.ERROR,
|
|
994
|
+
error="add_chamfer is not implemented by this adapter",
|
|
995
|
+
)
|
|
996
|
+
|
|
997
|
+
async def get_selected_entities(self) -> AdapterResult[list[dict[str, Any]]]:
|
|
998
|
+
"""Report the faces/edges/vertices currently selected in the live UI.
|
|
999
|
+
|
|
1000
|
+
Lets an agent see exactly what the user has clicked on in SolidWorks
|
|
1001
|
+
(e.g. "chamfer THIS face") instead of inferring it from a screenshot.
|
|
1002
|
+
|
|
1003
|
+
Returns:
|
|
1004
|
+
AdapterResult[list[dict[str, Any]]]: One descriptor per selected
|
|
1005
|
+
entity. See the PyWin32 adapter's implementation for the field
|
|
1006
|
+
set (varies by entity type).
|
|
1007
|
+
"""
|
|
1008
|
+
return AdapterResult(
|
|
1009
|
+
status=AdapterResultStatus.ERROR,
|
|
1010
|
+
error="get_selected_entities is not implemented by this adapter",
|
|
1011
|
+
)
|
|
1012
|
+
|
|
1013
|
+
async def select_feature(
|
|
1014
|
+
self, feature_name: str, append: bool = False
|
|
1015
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1016
|
+
"""Select a named feature, sketch, plane or component.
|
|
1017
|
+
|
|
1018
|
+
Args:
|
|
1019
|
+
feature_name (str): The feature name, optionally ``@document``
|
|
1020
|
+
qualified.
|
|
1021
|
+
append (bool): Add to the current selection instead of replacing
|
|
1022
|
+
it. Defaults to False.
|
|
1023
|
+
|
|
1024
|
+
Returns:
|
|
1025
|
+
AdapterResult[dict[str, Any]]: On success ``selected`` (True),
|
|
1026
|
+
``feature_name``, ``selected_name``, ``entity_type`` and
|
|
1027
|
+
``selection_count``. ERROR when nothing could be selected - never
|
|
1028
|
+
SUCCESS with ``selected: False``.
|
|
1029
|
+
"""
|
|
1030
|
+
return AdapterResult(
|
|
1031
|
+
status=AdapterResultStatus.ERROR,
|
|
1032
|
+
error="select_feature is not implemented by this adapter",
|
|
1033
|
+
)
|
|
1034
|
+
|
|
1035
|
+
async def select_face_edges(
|
|
1036
|
+
self,
|
|
1037
|
+
point: list[float] | None = None,
|
|
1038
|
+
side: str | None = None,
|
|
1039
|
+
plane: str | None = None,
|
|
1040
|
+
edge_type: str = "all",
|
|
1041
|
+
append: bool = False,
|
|
1042
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1043
|
+
"""Multi-select every edge bounding one face of the active part.
|
|
1044
|
+
|
|
1045
|
+
Exactly one of ``point``/``side``/``plane`` identifies the face.
|
|
1046
|
+
|
|
1047
|
+
Args:
|
|
1048
|
+
point (list[float] | None): ``[x, y, z]`` in mm on the face.
|
|
1049
|
+
side (str | None): ``+X``..``-Z`` or ``top/bottom/front/back/
|
|
1050
|
+
right/left``; the furthest planar face facing that way.
|
|
1051
|
+
plane (str | None): Reference plane name; the body face(s) lying
|
|
1052
|
+
on it.
|
|
1053
|
+
edge_type (str): ``all``, ``linear`` or ``circular``.
|
|
1054
|
+
append (bool): Add to the current selection. Defaults to False.
|
|
1055
|
+
|
|
1056
|
+
Returns:
|
|
1057
|
+
AdapterResult[dict[str, Any]]: ``face`` (or ``faces``), ``edges``
|
|
1058
|
+
(one descriptor per selected edge) and ``selection_count``.
|
|
1059
|
+
"""
|
|
1060
|
+
return AdapterResult(
|
|
1061
|
+
status=AdapterResultStatus.ERROR,
|
|
1062
|
+
error="select_face_edges is not implemented by this adapter",
|
|
1063
|
+
)
|
|
1064
|
+
|
|
1065
|
+
async def rebuild_model(
|
|
1066
|
+
self, top_level_only: bool = False
|
|
1067
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1068
|
+
"""Force a rebuild and report per-feature rebuild errors.
|
|
1069
|
+
|
|
1070
|
+
Args:
|
|
1071
|
+
top_level_only (bool): Rebuild only the top level of an assembly.
|
|
1072
|
+
Defaults to False (full rebuild).
|
|
1073
|
+
|
|
1074
|
+
Returns:
|
|
1075
|
+
AdapterResult[dict[str, Any]]: ``rebuilt``, ``top_level_only``,
|
|
1076
|
+
``errors`` (one entry per failing feature with ``feature``,
|
|
1077
|
+
``type``, ``code``, ``code_name``, ``severity``, ``description``,
|
|
1078
|
+
``parents``, ``hint``), ``error_count`` and ``warning_count``.
|
|
1079
|
+
ERROR (still carrying ``data``) when any error-severity entry
|
|
1080
|
+
remains.
|
|
1081
|
+
"""
|
|
1082
|
+
return AdapterResult(
|
|
1083
|
+
status=AdapterResultStatus.ERROR,
|
|
1084
|
+
error="rebuild_model is not implemented by this adapter",
|
|
1085
|
+
)
|
|
1086
|
+
|
|
1087
|
+
async def create_reference_plane(
|
|
1088
|
+
self,
|
|
1089
|
+
reference: str,
|
|
1090
|
+
offset: float = 0.0,
|
|
1091
|
+
angle: float = 0.0,
|
|
1092
|
+
flip: bool = False,
|
|
1093
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1094
|
+
"""Create a reference plane offset from, or angled to, an existing plane.
|
|
1095
|
+
|
|
1096
|
+
Args:
|
|
1097
|
+
reference (str): Name of the reference plane or planar face.
|
|
1098
|
+
offset (float): Offset distance in millimetres. Defaults to 0.0.
|
|
1099
|
+
angle (float): Angle in degrees. Defaults to 0.0.
|
|
1100
|
+
flip (bool): Reverse the offset or angle direction. Defaults to False.
|
|
1101
|
+
|
|
1102
|
+
Returns:
|
|
1103
|
+
AdapterResult[dict[str, Any]]: The new plane's name and parameters, or error.
|
|
1104
|
+
"""
|
|
1105
|
+
return AdapterResult(
|
|
1106
|
+
status=AdapterResultStatus.ERROR,
|
|
1107
|
+
error="create_reference_plane is not implemented by this adapter",
|
|
1108
|
+
)
|
|
1109
|
+
|
|
1110
|
+
async def create_axis(self, reference: str) -> AdapterResult[dict[str, Any]]:
|
|
1111
|
+
"""Create a reference axis along a principal direction.
|
|
1112
|
+
|
|
1113
|
+
Args:
|
|
1114
|
+
reference (str): "x", "y" or "z" (case-insensitive, leading +/- stripped).
|
|
1115
|
+
|
|
1116
|
+
Returns:
|
|
1117
|
+
AdapterResult[dict[str, Any]]: The plane pair used and feature counts, or error.
|
|
1118
|
+
"""
|
|
1119
|
+
return AdapterResult(
|
|
1120
|
+
status=AdapterResultStatus.ERROR,
|
|
1121
|
+
error="create_axis is not implemented by this adapter",
|
|
1122
|
+
)
|
|
1123
|
+
|
|
1124
|
+
async def create_reference_point(
|
|
1125
|
+
self,
|
|
1126
|
+
mode: str,
|
|
1127
|
+
x: float,
|
|
1128
|
+
y: float,
|
|
1129
|
+
z: float,
|
|
1130
|
+
distance: float | None = None,
|
|
1131
|
+
percent: float | None = None,
|
|
1132
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1133
|
+
"""Create a reference point on the active part.
|
|
1134
|
+
|
|
1135
|
+
Args:
|
|
1136
|
+
mode (str): "along_curve" or "face_center".
|
|
1137
|
+
x (float): X of a point on the target edge/face, in millimetres.
|
|
1138
|
+
y (float): Y of a point on the target edge/face, in millimetres.
|
|
1139
|
+
z (float): Z of a point on the target edge/face, in millimetres.
|
|
1140
|
+
distance (float | None): For "along_curve", offset from the edge
|
|
1141
|
+
start in millimetres.
|
|
1142
|
+
percent (float | None): For "along_curve", position as 0-100 of
|
|
1143
|
+
the edge length.
|
|
1144
|
+
|
|
1145
|
+
Returns:
|
|
1146
|
+
AdapterResult[dict[str, Any]]: The mode and feature counts, or error.
|
|
1147
|
+
"""
|
|
1148
|
+
return AdapterResult(
|
|
1149
|
+
status=AdapterResultStatus.ERROR,
|
|
1150
|
+
error="create_reference_point is not implemented by this adapter",
|
|
1151
|
+
)
|
|
1152
|
+
|
|
1153
|
+
async def mirror_feature(
|
|
1154
|
+
self,
|
|
1155
|
+
features: list[str],
|
|
1156
|
+
mirror_plane: str,
|
|
1157
|
+
merge: bool = True,
|
|
1158
|
+
mirror_bodies: bool = True,
|
|
1159
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1160
|
+
"""Mirror solid bodies or features about a plane.
|
|
1161
|
+
|
|
1162
|
+
Args:
|
|
1163
|
+
features (list[str]): Body or feature names to mirror.
|
|
1164
|
+
mirror_plane (str): Plane name to mirror about.
|
|
1165
|
+
merge (bool): Merge the mirrored result with the original. Defaults to True.
|
|
1166
|
+
mirror_bodies (bool): Mirror whole bodies rather than features. Defaults to True.
|
|
1167
|
+
|
|
1168
|
+
Returns:
|
|
1169
|
+
AdapterResult[dict[str, Any]]: The mirror feature's name, inputs and volume
|
|
1170
|
+
before/after, or error.
|
|
1171
|
+
"""
|
|
1172
|
+
return AdapterResult(
|
|
1173
|
+
status=AdapterResultStatus.ERROR,
|
|
1174
|
+
error="mirror_feature is not implemented by this adapter",
|
|
1175
|
+
)
|
|
1176
|
+
|
|
1177
|
+
async def pattern_circular(
|
|
1178
|
+
self,
|
|
1179
|
+
features: list[str],
|
|
1180
|
+
axis: str,
|
|
1181
|
+
count: int,
|
|
1182
|
+
angle: float = 360.0,
|
|
1183
|
+
equal_spacing: bool = True,
|
|
1184
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1185
|
+
"""Pattern features around an axis.
|
|
1186
|
+
|
|
1187
|
+
Args:
|
|
1188
|
+
features (list[str]): Names of the features to pattern.
|
|
1189
|
+
axis (str): Name of the axis to rotate about.
|
|
1190
|
+
count (int): Total number of instances including the original.
|
|
1191
|
+
angle (float): Total angle in degrees to spread them over. Defaults to 360.0.
|
|
1192
|
+
equal_spacing (bool): Space instances evenly across ``angle``. Defaults to True.
|
|
1193
|
+
|
|
1194
|
+
Returns:
|
|
1195
|
+
AdapterResult[dict[str, Any]]: What was patterned and the volume
|
|
1196
|
+
before/after, or error.
|
|
1197
|
+
"""
|
|
1198
|
+
return AdapterResult(
|
|
1199
|
+
status=AdapterResultStatus.ERROR,
|
|
1200
|
+
error="pattern_circular is not implemented by this adapter",
|
|
1201
|
+
)
|
|
1202
|
+
|
|
1203
|
+
# Assembly Operations
|
|
1204
|
+
async def insert_component(
|
|
1205
|
+
self, file_path: str, x: float = 0.0, y: float = 0.0, z: float = 0.0
|
|
1206
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1207
|
+
"""Insert a part or sub-assembly into the active assembly.
|
|
1208
|
+
|
|
1209
|
+
Args:
|
|
1210
|
+
file_path (str): Absolute path to the ``.sldprt`` or ``.sldasm``.
|
|
1211
|
+
x (float): X position in millimetres. Defaults to 0.0.
|
|
1212
|
+
y (float): Y position in millimetres. Defaults to 0.0.
|
|
1213
|
+
z (float): Z position in millimetres. Defaults to 0.0.
|
|
1214
|
+
|
|
1215
|
+
Returns:
|
|
1216
|
+
AdapterResult[dict[str, Any]]: Component name and counts, or error.
|
|
1217
|
+
"""
|
|
1218
|
+
return AdapterResult(
|
|
1219
|
+
status=AdapterResultStatus.ERROR,
|
|
1220
|
+
error="insert_component is not implemented by this adapter",
|
|
1221
|
+
)
|
|
1222
|
+
|
|
1223
|
+
async def list_components(self) -> AdapterResult[list[str]]:
|
|
1224
|
+
"""List the top-level components of the active assembly.
|
|
1225
|
+
|
|
1226
|
+
Returns:
|
|
1227
|
+
AdapterResult[list[str]]: Component instance names, or error.
|
|
1228
|
+
"""
|
|
1229
|
+
return AdapterResult(
|
|
1230
|
+
status=AdapterResultStatus.ERROR,
|
|
1231
|
+
error="list_components is not implemented by this adapter",
|
|
1232
|
+
)
|
|
1233
|
+
|
|
1234
|
+
async def get_model_geometry_summary(self) -> AdapterResult[dict[str, Any]]:
|
|
1235
|
+
"""Summarise the active part or assembly without changing it.
|
|
1236
|
+
|
|
1237
|
+
Must not rebuild the model, modify it, or clear the selection, so
|
|
1238
|
+
callers can read it around a feature call. Values the adapter cannot
|
|
1239
|
+
determine are ``None``, never guessed.
|
|
1240
|
+
|
|
1241
|
+
Returns:
|
|
1242
|
+
AdapterResult[dict[str, Any]]: ``document_type`` (``"part"`` or
|
|
1243
|
+
``"assembly"``), ``volume_mm3``, ``bounding_box_mm`` (``min``,
|
|
1244
|
+
``max`` and ``size`` as ``[x, y, z]``), ``bounding_box_method``,
|
|
1245
|
+
``solid_body_count``, and for assemblies ``component_count`` and
|
|
1246
|
+
``mate_count``. Error when there is no active part or assembly.
|
|
1247
|
+
"""
|
|
1248
|
+
return AdapterResult(
|
|
1249
|
+
status=AdapterResultStatus.ERROR,
|
|
1250
|
+
error="get_model_geometry_summary is not implemented by this adapter",
|
|
1251
|
+
)
|
|
1252
|
+
|
|
1253
|
+
async def add_mate(
|
|
1254
|
+
self,
|
|
1255
|
+
component_a: str,
|
|
1256
|
+
component_b: str,
|
|
1257
|
+
entity_a: str = "Front Plane",
|
|
1258
|
+
entity_b: str = "Front Plane",
|
|
1259
|
+
mate_type: str = "coincident",
|
|
1260
|
+
alignment: str = "aligned",
|
|
1261
|
+
distance: float = 0.0,
|
|
1262
|
+
angle: float = 0.0,
|
|
1263
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1264
|
+
"""Mate two components together in the active assembly.
|
|
1265
|
+
|
|
1266
|
+
Args:
|
|
1267
|
+
component_a (str): First component instance name.
|
|
1268
|
+
component_b (str): Second component instance name.
|
|
1269
|
+
entity_a (str): Named feature on the first component. Defaults to
|
|
1270
|
+
"Front Plane".
|
|
1271
|
+
entity_b (str): Named feature on the second component. Defaults to
|
|
1272
|
+
"Front Plane".
|
|
1273
|
+
mate_type (str): Mate type, e.g. ``coincident``. Defaults to
|
|
1274
|
+
"coincident".
|
|
1275
|
+
alignment (str): ``aligned``, ``anti_aligned`` or ``closest``.
|
|
1276
|
+
Defaults to "aligned".
|
|
1277
|
+
distance (float): Distance in millimetres, for a distance mate.
|
|
1278
|
+
Defaults to 0.0.
|
|
1279
|
+
angle (float): Angle in degrees, for an angle mate. Defaults to 0.0.
|
|
1280
|
+
|
|
1281
|
+
Returns:
|
|
1282
|
+
AdapterResult[dict[str, Any]]: Mate details, or error.
|
|
1283
|
+
"""
|
|
1284
|
+
return AdapterResult(
|
|
1285
|
+
status=AdapterResultStatus.ERROR,
|
|
1286
|
+
error="add_mate is not implemented by this adapter",
|
|
1287
|
+
)
|
|
1288
|
+
|
|
1289
|
+
# Drawing Operations
|
|
1290
|
+
async def create_drawing_view(
|
|
1291
|
+
self, payload: Any = None
|
|
1292
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1293
|
+
"""Place a view of a model on the active drawing sheet.
|
|
1294
|
+
|
|
1295
|
+
Args:
|
|
1296
|
+
payload (Any): Tool payload carrying the model path, orientation,
|
|
1297
|
+
position in millimetres and optional view scale.
|
|
1298
|
+
|
|
1299
|
+
Returns:
|
|
1300
|
+
AdapterResult[dict[str, Any]]: The new view's details, or error.
|
|
1301
|
+
"""
|
|
1302
|
+
return AdapterResult(
|
|
1303
|
+
status=AdapterResultStatus.ERROR,
|
|
1304
|
+
error="create_drawing_view is not implemented by this adapter",
|
|
1305
|
+
)
|
|
1306
|
+
|
|
1307
|
+
async def add_drawing_view(
|
|
1308
|
+
self, payload: Any = None
|
|
1309
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1310
|
+
"""Add a view of a model to the active drawing sheet.
|
|
1311
|
+
|
|
1312
|
+
Args:
|
|
1313
|
+
payload (Any): Tool payload carrying the model path, orientation,
|
|
1314
|
+
position in millimetres and optional view scale.
|
|
1315
|
+
|
|
1316
|
+
Returns:
|
|
1317
|
+
AdapterResult[dict[str, Any]]: The new view's details, or error.
|
|
1318
|
+
"""
|
|
1319
|
+
return AdapterResult(
|
|
1320
|
+
status=AdapterResultStatus.ERROR,
|
|
1321
|
+
error="add_drawing_view is not implemented by this adapter",
|
|
1322
|
+
)
|
|
1323
|
+
|
|
1324
|
+
async def create_technical_drawing(
|
|
1325
|
+
self, payload: Any = None
|
|
1326
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1327
|
+
"""Lay out the standard views of a model on the active sheet.
|
|
1328
|
+
|
|
1329
|
+
Args:
|
|
1330
|
+
payload (Any): Tool payload carrying the model path and the
|
|
1331
|
+
projection angle.
|
|
1332
|
+
|
|
1333
|
+
Returns:
|
|
1334
|
+
AdapterResult[dict[str, Any]]: The view names created, or error.
|
|
1335
|
+
"""
|
|
1336
|
+
return AdapterResult(
|
|
1337
|
+
status=AdapterResultStatus.ERROR,
|
|
1338
|
+
error="create_technical_drawing is not implemented by this adapter",
|
|
1339
|
+
)
|
|
1340
|
+
|
|
1341
|
+
async def add_note(self, payload: Any = None) -> AdapterResult[dict[str, Any]]:
|
|
1342
|
+
"""Place a text note on the active drawing sheet.
|
|
1343
|
+
|
|
1344
|
+
Args:
|
|
1345
|
+
payload (Any): Tool payload carrying the note text, its position in
|
|
1346
|
+
millimetres and an optional font size in points.
|
|
1347
|
+
|
|
1348
|
+
Returns:
|
|
1349
|
+
AdapterResult[dict[str, Any]]: The note's details, or error.
|
|
1350
|
+
"""
|
|
1351
|
+
return AdapterResult(
|
|
1352
|
+
status=AdapterResultStatus.ERROR,
|
|
1353
|
+
error="add_note is not implemented by this adapter",
|
|
1354
|
+
)
|
|
1355
|
+
|
|
1356
|
+
async def list_drawing_views(self) -> AdapterResult[list[str]]:
|
|
1357
|
+
"""List the views on the active drawing.
|
|
1358
|
+
|
|
1359
|
+
Returns:
|
|
1360
|
+
AdapterResult[list[str]]: View names, or error.
|
|
1361
|
+
"""
|
|
1362
|
+
return AdapterResult(
|
|
1363
|
+
status=AdapterResultStatus.ERROR,
|
|
1364
|
+
error="list_drawing_views is not implemented by this adapter",
|
|
1365
|
+
)
|
|
1366
|
+
|
|
1367
|
+
async def auto_center_marks(
|
|
1368
|
+
self,
|
|
1369
|
+
view_name: str,
|
|
1370
|
+
mark_holes: bool = True,
|
|
1371
|
+
mark_fillets: bool = False,
|
|
1372
|
+
mark_slots: bool = True,
|
|
1373
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1374
|
+
"""Auto-insert centre marks on circular features in a drawing view.
|
|
1375
|
+
|
|
1376
|
+
Args:
|
|
1377
|
+
view_name (str): Name of a view on the active drawing.
|
|
1378
|
+
mark_holes (bool): Mark holes / bores.
|
|
1379
|
+
mark_fillets (bool): Mark fillets.
|
|
1380
|
+
mark_slots (bool): Mark slots.
|
|
1381
|
+
|
|
1382
|
+
Returns:
|
|
1383
|
+
AdapterResult[dict[str, Any]]: The view and before/after centre-mark
|
|
1384
|
+
counts, or error.
|
|
1385
|
+
"""
|
|
1386
|
+
return AdapterResult(
|
|
1387
|
+
status=AdapterResultStatus.ERROR,
|
|
1388
|
+
error="auto_center_marks is not implemented by this adapter",
|
|
1389
|
+
)
|
|
1390
|
+
|
|
1391
|
+
async def save_body_as_part(
|
|
1392
|
+
self, body_name: str, file_path: str
|
|
1393
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1394
|
+
"""Extract one solid body from the active multibody part to a new file.
|
|
1395
|
+
|
|
1396
|
+
Args:
|
|
1397
|
+
body_name (str): Name of a solid body in the active part.
|
|
1398
|
+
file_path (str): Absolute path for the new ``.sldprt``.
|
|
1399
|
+
|
|
1400
|
+
Returns:
|
|
1401
|
+
AdapterResult[dict[str, Any]]: The body, the written path, and the
|
|
1402
|
+
solid-body names found, or error.
|
|
1403
|
+
"""
|
|
1404
|
+
return AdapterResult(
|
|
1405
|
+
status=AdapterResultStatus.ERROR,
|
|
1406
|
+
error="save_body_as_part is not implemented by this adapter",
|
|
1407
|
+
)
|
|
1408
|
+
|
|
1409
|
+
async def check_interference(
|
|
1410
|
+
self, params: Any = None
|
|
1411
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1412
|
+
"""Check the active assembly for interfering components.
|
|
1413
|
+
|
|
1414
|
+
Args:
|
|
1415
|
+
params (Any): Optional settings; ``coincident``, ``components``.
|
|
1416
|
+
|
|
1417
|
+
Returns:
|
|
1418
|
+
AdapterResult[dict[str, Any]]: Interference details, or error.
|
|
1419
|
+
"""
|
|
1420
|
+
return AdapterResult(
|
|
1421
|
+
status=AdapterResultStatus.ERROR,
|
|
1422
|
+
error="check_interference is not implemented by this adapter",
|
|
1423
|
+
)
|
|
1424
|
+
|
|
1425
|
+
# Feature Editing
|
|
1426
|
+
async def delete_feature(self, name: str) -> AdapterResult[dict[str, Any]]:
|
|
1427
|
+
"""Delete a named feature or sketch from the active model.
|
|
1428
|
+
|
|
1429
|
+
Args:
|
|
1430
|
+
name (str): Feature or sketch name.
|
|
1431
|
+
|
|
1432
|
+
Returns:
|
|
1433
|
+
AdapterResult[dict[str, Any]]: What was deleted, or error.
|
|
1434
|
+
"""
|
|
1435
|
+
return AdapterResult(
|
|
1436
|
+
status=AdapterResultStatus.ERROR,
|
|
1437
|
+
error="delete_feature is not implemented by this adapter",
|
|
1438
|
+
)
|
|
1439
|
+
|
|
1440
|
+
async def suppress_feature(
|
|
1441
|
+
self, name: str, suppress: bool = True
|
|
1442
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1443
|
+
"""Suppress or unsuppress a named feature.
|
|
1444
|
+
|
|
1445
|
+
Args:
|
|
1446
|
+
name (str): Feature name.
|
|
1447
|
+
suppress (bool): True to suppress, False to unsuppress.
|
|
1448
|
+
|
|
1449
|
+
Returns:
|
|
1450
|
+
AdapterResult[dict[str, Any]]: The resulting state, or error.
|
|
1451
|
+
"""
|
|
1452
|
+
return AdapterResult(
|
|
1453
|
+
status=AdapterResultStatus.ERROR,
|
|
1454
|
+
error="suppress_feature is not implemented by this adapter",
|
|
1455
|
+
)
|
|
1456
|
+
|
|
1457
|
+
async def rename_feature(
|
|
1458
|
+
self, old_name: str, new_name: str
|
|
1459
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1460
|
+
"""Rename an existing feature on the feature tree.
|
|
1461
|
+
|
|
1462
|
+
Args:
|
|
1463
|
+
old_name (str): Current feature name.
|
|
1464
|
+
new_name (str): New feature name.
|
|
1465
|
+
|
|
1466
|
+
Returns:
|
|
1467
|
+
AdapterResult[dict[str, Any]]: The old and new names, or error.
|
|
1468
|
+
"""
|
|
1469
|
+
return AdapterResult(
|
|
1470
|
+
status=AdapterResultStatus.ERROR,
|
|
1471
|
+
error="rename_feature is not implemented by this adapter",
|
|
1472
|
+
)
|
|
1473
|
+
|
|
1474
|
+
async def undo(self, count: int = 1) -> AdapterResult[dict[str, Any]]:
|
|
1475
|
+
"""Undo the last operations in the active model.
|
|
1476
|
+
|
|
1477
|
+
Args:
|
|
1478
|
+
count (int): Number of steps to undo.
|
|
1479
|
+
|
|
1480
|
+
Returns:
|
|
1481
|
+
AdapterResult[dict[str, Any]]: Whether the tree changed, or error.
|
|
1482
|
+
"""
|
|
1483
|
+
return AdapterResult(
|
|
1484
|
+
status=AdapterResultStatus.ERROR,
|
|
1485
|
+
error="undo is not implemented by this adapter",
|
|
1486
|
+
)
|
|
1487
|
+
|
|
1488
|
+
async def set_units(self, unit_system: str) -> AdapterResult[dict[str, Any]]:
|
|
1489
|
+
"""Set the active document's linear unit system.
|
|
1490
|
+
|
|
1491
|
+
Args:
|
|
1492
|
+
unit_system (str): One of ``mm``, ``cm``, ``m``, ``in``, ``ft``.
|
|
1493
|
+
|
|
1494
|
+
Returns:
|
|
1495
|
+
AdapterResult[dict[str, Any]]: What was applied, or error.
|
|
1496
|
+
"""
|
|
1497
|
+
return AdapterResult(
|
|
1498
|
+
status=AdapterResultStatus.ERROR,
|
|
1499
|
+
error="set_units is not implemented by this adapter",
|
|
1500
|
+
)
|
|
1501
|
+
|
|
1502
|
+
async def list_open_documents(self) -> AdapterResult[list[dict[str, Any]]]:
|
|
1503
|
+
"""Enumerate every document currently open in SolidWorks.
|
|
1504
|
+
|
|
1505
|
+
Returns:
|
|
1506
|
+
AdapterResult[list[dict[str, Any]]]: One entry per open document
|
|
1507
|
+
(``title``, ``path``, ``type``, ``is_active``), or error.
|
|
1508
|
+
"""
|
|
1509
|
+
return AdapterResult(
|
|
1510
|
+
status=AdapterResultStatus.ERROR,
|
|
1511
|
+
error="list_open_documents is not implemented by this adapter",
|
|
1512
|
+
)
|
|
1513
|
+
|
|
1514
|
+
async def activate_document(
|
|
1515
|
+
self, title_or_path: str
|
|
1516
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1517
|
+
"""Make an already-open document the active one.
|
|
1518
|
+
|
|
1519
|
+
Args:
|
|
1520
|
+
title_or_path (str): Title, full path, or file name of an open
|
|
1521
|
+
document.
|
|
1522
|
+
|
|
1523
|
+
Returns:
|
|
1524
|
+
AdapterResult[dict[str, Any]]: What was activated, or error.
|
|
1525
|
+
"""
|
|
1526
|
+
return AdapterResult(
|
|
1527
|
+
status=AdapterResultStatus.ERROR,
|
|
1528
|
+
error="activate_document is not implemented by this adapter",
|
|
1529
|
+
)
|
|
1530
|
+
|
|
1531
|
+
@abstractmethod
|
|
1532
|
+
async def exit_sketch(self) -> AdapterResult[None]:
|
|
1533
|
+
"""Exit sketch editing mode.
|
|
1534
|
+
|
|
1535
|
+
Returns:
|
|
1536
|
+
AdapterResult[None]: The result produced by the operation.
|
|
1537
|
+
"""
|
|
1538
|
+
pass
|
|
1539
|
+
|
|
1540
|
+
# Analysis Operations
|
|
1541
|
+
@abstractmethod
|
|
1542
|
+
async def get_mass_properties(self) -> AdapterResult[MassProperties]:
|
|
1543
|
+
"""Get mass properties of the current model.
|
|
1544
|
+
|
|
1545
|
+
Returns:
|
|
1546
|
+
AdapterResult[MassProperties]: The result produced by the operation.
|
|
1547
|
+
"""
|
|
1548
|
+
pass
|
|
1549
|
+
|
|
1550
|
+
# Export Operations
|
|
1551
|
+
@abstractmethod
|
|
1552
|
+
async def export_image(self, payload: dict) -> AdapterResult[dict]:
|
|
1553
|
+
"""Export a viewport screenshot (PNG/JPG) of the current model.
|
|
1554
|
+
|
|
1555
|
+
Payload keys: file_path (str): Absolute output path. width (int): Image width in pixels.
|
|
1556
|
+
height (int): Image height in pixels. view_orientation (str): One of "isometric",
|
|
1557
|
+
"front", "top", "right", "back", "bottom", "current".
|
|
1558
|
+
|
|
1559
|
+
Args:
|
|
1560
|
+
payload (dict): The payload value.
|
|
1561
|
+
|
|
1562
|
+
Returns:
|
|
1563
|
+
AdapterResult[dict]: The result produced by the operation.
|
|
1564
|
+
"""
|
|
1565
|
+
pass
|
|
1566
|
+
|
|
1567
|
+
@abstractmethod
|
|
1568
|
+
async def export_file(
|
|
1569
|
+
self, file_path: str, format_type: str
|
|
1570
|
+
) -> AdapterResult[None]:
|
|
1571
|
+
"""Export the current model to a file.
|
|
1572
|
+
|
|
1573
|
+
Args:
|
|
1574
|
+
file_path (str): Path to the target file.
|
|
1575
|
+
format_type (str): The format type value.
|
|
1576
|
+
|
|
1577
|
+
Returns:
|
|
1578
|
+
AdapterResult[None]: The result produced by the operation.
|
|
1579
|
+
"""
|
|
1580
|
+
pass
|
|
1581
|
+
|
|
1582
|
+
# Dimension Operations
|
|
1583
|
+
@abstractmethod
|
|
1584
|
+
async def get_dimension(self, name: str) -> AdapterResult[float]:
|
|
1585
|
+
"""Get the value of a dimension.
|
|
1586
|
+
|
|
1587
|
+
Args:
|
|
1588
|
+
name (str): The name value.
|
|
1589
|
+
|
|
1590
|
+
Returns:
|
|
1591
|
+
AdapterResult[float]: The result produced by the operation.
|
|
1592
|
+
"""
|
|
1593
|
+
pass
|
|
1594
|
+
|
|
1595
|
+
@abstractmethod
|
|
1596
|
+
async def set_dimension(self, name: str, value: float) -> AdapterResult[None]:
|
|
1597
|
+
"""Set the value of a dimension.
|
|
1598
|
+
|
|
1599
|
+
Args:
|
|
1600
|
+
name (str): The name value.
|
|
1601
|
+
value (float): The value value.
|
|
1602
|
+
|
|
1603
|
+
Returns:
|
|
1604
|
+
AdapterResult[None]: The result produced by the operation.
|
|
1605
|
+
"""
|
|
1606
|
+
pass
|
|
1607
|
+
|
|
1608
|
+
# Utility Methods
|
|
1609
|
+
def update_metrics(self, operation_time: float, success: bool) -> None:
|
|
1610
|
+
"""Update adapter metrics.
|
|
1611
|
+
|
|
1612
|
+
Args:
|
|
1613
|
+
operation_time (float): The operation time value.
|
|
1614
|
+
success (bool): The success value.
|
|
1615
|
+
|
|
1616
|
+
Returns:
|
|
1617
|
+
None: None.
|
|
1618
|
+
"""
|
|
1619
|
+
self._metrics["operations_count"] += 1
|
|
1620
|
+
if not success:
|
|
1621
|
+
self._metrics["errors_count"] += 1
|
|
1622
|
+
|
|
1623
|
+
# Update average response time
|
|
1624
|
+
current_avg = self._metrics["average_response_time"]
|
|
1625
|
+
count = self._metrics["operations_count"]
|
|
1626
|
+
self._metrics["average_response_time"] = (
|
|
1627
|
+
current_avg * (count - 1) + operation_time
|
|
1628
|
+
) / count
|
|
1629
|
+
|
|
1630
|
+
def get_metrics(self) -> dict[str, Any]:
|
|
1631
|
+
"""Get adapter metrics.
|
|
1632
|
+
|
|
1633
|
+
Returns:
|
|
1634
|
+
dict[str, Any]: A dictionary containing the resulting values.
|
|
1635
|
+
"""
|
|
1636
|
+
return self._metrics.copy()
|
|
1637
|
+
|
|
1638
|
+
# --- Engineering-data and drawing-documentation methods ---
|
|
1639
|
+
|
|
1640
|
+
async def list_model_dimensions(
|
|
1641
|
+
self,
|
|
1642
|
+
feature_name: str | None = None,
|
|
1643
|
+
) -> AdapterResult[list[dict[str, Any]]]:
|
|
1644
|
+
"""List every dimension in the active part or assembly.
|
|
1645
|
+
|
|
1646
|
+
Returns:
|
|
1647
|
+
AdapterResult[list[dict[str, Any]]]: Error unless the adapter implements it.
|
|
1648
|
+
"""
|
|
1649
|
+
return AdapterResult(
|
|
1650
|
+
status=AdapterResultStatus.ERROR,
|
|
1651
|
+
error="list_model_dimensions is not implemented by this adapter",
|
|
1652
|
+
)
|
|
1653
|
+
|
|
1654
|
+
async def measure_entities(
|
|
1655
|
+
self,
|
|
1656
|
+
entities: list[str],
|
|
1657
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1658
|
+
"""Measure one or two selected entities.
|
|
1659
|
+
|
|
1660
|
+
Returns:
|
|
1661
|
+
AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
|
|
1662
|
+
"""
|
|
1663
|
+
return AdapterResult(
|
|
1664
|
+
status=AdapterResultStatus.ERROR,
|
|
1665
|
+
error="measure_entities is not implemented by this adapter",
|
|
1666
|
+
)
|
|
1667
|
+
|
|
1668
|
+
async def get_material(
|
|
1669
|
+
self,
|
|
1670
|
+
configuration: str | None = None,
|
|
1671
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1672
|
+
"""Read the material assigned to the active part.
|
|
1673
|
+
|
|
1674
|
+
Returns:
|
|
1675
|
+
AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
|
|
1676
|
+
"""
|
|
1677
|
+
return AdapterResult(
|
|
1678
|
+
status=AdapterResultStatus.ERROR,
|
|
1679
|
+
error="get_material is not implemented by this adapter",
|
|
1680
|
+
)
|
|
1681
|
+
|
|
1682
|
+
async def set_material(
|
|
1683
|
+
self,
|
|
1684
|
+
material_name: str,
|
|
1685
|
+
database: str | None = None,
|
|
1686
|
+
configuration: str | None = None,
|
|
1687
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1688
|
+
"""Assign a material to the active part.
|
|
1689
|
+
|
|
1690
|
+
Returns:
|
|
1691
|
+
AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
|
|
1692
|
+
"""
|
|
1693
|
+
return AdapterResult(
|
|
1694
|
+
status=AdapterResultStatus.ERROR,
|
|
1695
|
+
error="set_material is not implemented by this adapter",
|
|
1696
|
+
)
|
|
1697
|
+
|
|
1698
|
+
async def list_available_materials(
|
|
1699
|
+
self,
|
|
1700
|
+
search: str | None = None,
|
|
1701
|
+
) -> AdapterResult[list[dict[str, str]]]:
|
|
1702
|
+
"""List materials from the configured material libraries.
|
|
1703
|
+
|
|
1704
|
+
Returns:
|
|
1705
|
+
AdapterResult[list[dict[str, str]]]: Error unless the adapter implements it.
|
|
1706
|
+
"""
|
|
1707
|
+
return AdapterResult(
|
|
1708
|
+
status=AdapterResultStatus.ERROR,
|
|
1709
|
+
error="list_available_materials is not implemented by this adapter",
|
|
1710
|
+
)
|
|
1711
|
+
|
|
1712
|
+
async def get_custom_properties(
|
|
1713
|
+
self,
|
|
1714
|
+
configuration: str | None = None,
|
|
1715
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1716
|
+
"""Read the custom properties of the active document.
|
|
1717
|
+
|
|
1718
|
+
Returns:
|
|
1719
|
+
AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
|
|
1720
|
+
"""
|
|
1721
|
+
return AdapterResult(
|
|
1722
|
+
status=AdapterResultStatus.ERROR,
|
|
1723
|
+
error="get_custom_properties is not implemented by this adapter",
|
|
1724
|
+
)
|
|
1725
|
+
|
|
1726
|
+
async def set_custom_property(
|
|
1727
|
+
self,
|
|
1728
|
+
name: str,
|
|
1729
|
+
value: str,
|
|
1730
|
+
configuration: str | None = None,
|
|
1731
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1732
|
+
"""Create or overwrite one custom property.
|
|
1733
|
+
|
|
1734
|
+
Returns:
|
|
1735
|
+
AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
|
|
1736
|
+
"""
|
|
1737
|
+
return AdapterResult(
|
|
1738
|
+
status=AdapterResultStatus.ERROR,
|
|
1739
|
+
error="set_custom_property is not implemented by this adapter",
|
|
1740
|
+
)
|
|
1741
|
+
|
|
1742
|
+
async def export_flat_pattern(
|
|
1743
|
+
self,
|
|
1744
|
+
file_path: str,
|
|
1745
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1746
|
+
"""Export the active sheet-metal part's flat pattern.
|
|
1747
|
+
|
|
1748
|
+
Returns:
|
|
1749
|
+
AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
|
|
1750
|
+
"""
|
|
1751
|
+
return AdapterResult(
|
|
1752
|
+
status=AdapterResultStatus.ERROR,
|
|
1753
|
+
error="export_flat_pattern is not implemented by this adapter",
|
|
1754
|
+
)
|
|
1755
|
+
|
|
1756
|
+
async def insert_model_dimensions(
|
|
1757
|
+
self,
|
|
1758
|
+
view_name: str | None = None,
|
|
1759
|
+
include_hole_wizard: bool = True,
|
|
1760
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1761
|
+
"""Bring model dimensions into drawing views.
|
|
1762
|
+
|
|
1763
|
+
Returns:
|
|
1764
|
+
AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
|
|
1765
|
+
"""
|
|
1766
|
+
return AdapterResult(
|
|
1767
|
+
status=AdapterResultStatus.ERROR,
|
|
1768
|
+
error="insert_model_dimensions is not implemented by this adapter",
|
|
1769
|
+
)
|
|
1770
|
+
|
|
1771
|
+
async def arrange_dimensions(
|
|
1772
|
+
self,
|
|
1773
|
+
view_name: str | None = None,
|
|
1774
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1775
|
+
"""Move drawing dimensions so none overlaps, then verify.
|
|
1776
|
+
|
|
1777
|
+
Returns:
|
|
1778
|
+
AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
|
|
1779
|
+
"""
|
|
1780
|
+
return AdapterResult(
|
|
1781
|
+
status=AdapterResultStatus.ERROR,
|
|
1782
|
+
error="arrange_dimensions is not implemented by this adapter",
|
|
1783
|
+
)
|
|
1784
|
+
|
|
1785
|
+
async def insert_bom_table(
|
|
1786
|
+
self,
|
|
1787
|
+
view_name: str,
|
|
1788
|
+
template_path: str | None = None,
|
|
1789
|
+
bom_type: str = "top_level_only",
|
|
1790
|
+
x_mm: float | None = None,
|
|
1791
|
+
y_mm: float | None = None,
|
|
1792
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1793
|
+
"""Insert a BOM table anchored to an assembly drawing view.
|
|
1794
|
+
|
|
1795
|
+
Returns:
|
|
1796
|
+
AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
|
|
1797
|
+
"""
|
|
1798
|
+
return AdapterResult(
|
|
1799
|
+
status=AdapterResultStatus.ERROR,
|
|
1800
|
+
error="insert_bom_table is not implemented by this adapter",
|
|
1801
|
+
)
|
|
1802
|
+
|
|
1803
|
+
async def set_sheet_scale(
|
|
1804
|
+
self,
|
|
1805
|
+
numerator: float,
|
|
1806
|
+
denominator: float,
|
|
1807
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1808
|
+
"""Set the active drawing sheet's scale.
|
|
1809
|
+
|
|
1810
|
+
Returns:
|
|
1811
|
+
AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
|
|
1812
|
+
"""
|
|
1813
|
+
return AdapterResult(
|
|
1814
|
+
status=AdapterResultStatus.ERROR,
|
|
1815
|
+
error="set_sheet_scale is not implemented by this adapter",
|
|
1816
|
+
)
|
|
1817
|
+
|
|
1818
|
+
async def add_gtol(
|
|
1819
|
+
self,
|
|
1820
|
+
characteristic: str,
|
|
1821
|
+
tolerance: float,
|
|
1822
|
+
x_mm: float,
|
|
1823
|
+
y_mm: float,
|
|
1824
|
+
diameter_zone: bool = False,
|
|
1825
|
+
material_condition: str = "none",
|
|
1826
|
+
datums: list[str] | None = None,
|
|
1827
|
+
attach_at_mm: tuple[float, float] | None = None,
|
|
1828
|
+
dimension: tuple[str, str] | None = None,
|
|
1829
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1830
|
+
"""Add a GD&T feature control frame to the active drawing.
|
|
1831
|
+
|
|
1832
|
+
Returns:
|
|
1833
|
+
AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
|
|
1834
|
+
"""
|
|
1835
|
+
return AdapterResult(
|
|
1836
|
+
status=AdapterResultStatus.ERROR,
|
|
1837
|
+
error="add_gtol is not implemented by this adapter",
|
|
1838
|
+
)
|
|
1839
|
+
|
|
1840
|
+
async def add_datum_tag(
|
|
1841
|
+
self,
|
|
1842
|
+
label: str,
|
|
1843
|
+
attach_at_mm: tuple[float, float],
|
|
1844
|
+
x_mm: float,
|
|
1845
|
+
y_mm: float,
|
|
1846
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1847
|
+
"""Add a datum feature symbol on a drawing edge.
|
|
1848
|
+
|
|
1849
|
+
Returns:
|
|
1850
|
+
AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
|
|
1851
|
+
"""
|
|
1852
|
+
return AdapterResult(
|
|
1853
|
+
status=AdapterResultStatus.ERROR,
|
|
1854
|
+
error="add_datum_tag is not implemented by this adapter",
|
|
1855
|
+
)
|
|
1856
|
+
|
|
1857
|
+
async def create_standard_drawing(
|
|
1858
|
+
self,
|
|
1859
|
+
model_path: str,
|
|
1860
|
+
output_dir: str | None = None,
|
|
1861
|
+
title: str | None = None,
|
|
1862
|
+
subtitle: str | None = None,
|
|
1863
|
+
drawing_number: str | None = None,
|
|
1864
|
+
author: str = "",
|
|
1865
|
+
revision: str = "A",
|
|
1866
|
+
company: str = "",
|
|
1867
|
+
drawn_date: str | None = None,
|
|
1868
|
+
notes: list[str] | None = None,
|
|
1869
|
+
include_isometric: bool = True,
|
|
1870
|
+
write_model_properties: bool = True,
|
|
1871
|
+
title_block_text_height_mm: float | None = None,
|
|
1872
|
+
include_bom: bool = False,
|
|
1873
|
+
) -> AdapterResult[dict[str, Any]]:
|
|
1874
|
+
"""Create a complete standard A3 drawing.
|
|
1875
|
+
|
|
1876
|
+
Returns:
|
|
1877
|
+
AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
|
|
1878
|
+
"""
|
|
1879
|
+
return AdapterResult(
|
|
1880
|
+
status=AdapterResultStatus.ERROR,
|
|
1881
|
+
error="create_standard_drawing is not implemented by this adapter",
|
|
1882
|
+
)
|