solidworks-mcp-python 2.1.0__py3-none-any.whl → 2.2.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.
Files changed (40) hide show
  1. solidworks_mcp/adapters/base.py +166 -2
  2. solidworks_mcp/adapters/circuit_breaker.py +91 -0
  3. solidworks_mcp/adapters/connection_pool.py +91 -0
  4. solidworks_mcp/adapters/mock_adapter.py +215 -3
  5. solidworks_mcp/adapters/pywin32_adapter.py +34 -14
  6. solidworks_mcp/adapters/solidworks/__init__.py +2 -0
  7. solidworks_mcp/adapters/solidworks/assembly.py +536 -0
  8. solidworks_mcp/adapters/solidworks/com_utils.py +23 -0
  9. solidworks_mcp/adapters/solidworks/compat.py +104 -0
  10. solidworks_mcp/adapters/solidworks/default_entities.py +219 -0
  11. solidworks_mcp/adapters/solidworks/dimension_layout.py +129 -3
  12. solidworks_mcp/adapters/solidworks/documentation.py +6 -0
  13. solidworks_mcp/adapters/solidworks/drawing_pack.py +52 -1
  14. solidworks_mcp/adapters/solidworks/drawing_standard.py +122 -59
  15. solidworks_mcp/adapters/solidworks/equations.py +62 -16
  16. solidworks_mcp/adapters/solidworks/face_selection.py +9 -2
  17. solidworks_mcp/adapters/solidworks/features.py +125 -21
  18. solidworks_mcp/adapters/solidworks/io.py +210 -29
  19. solidworks_mcp/adapters/solidworks/part_features.py +136 -22
  20. solidworks_mcp/adapters/solidworks/sketch.py +171 -92
  21. solidworks_mcp/selftest/areas.py +9 -4
  22. solidworks_mcp/selftest/cli.py +5 -0
  23. solidworks_mcp/selftest/report.py +8 -0
  24. solidworks_mcp/tools/__init__.py +2 -0
  25. solidworks_mcp/tools/assembly.py +343 -0
  26. solidworks_mcp/tools/drawing.py +64 -7
  27. solidworks_mcp/tools/error_classifier.py +8 -0
  28. solidworks_mcp/tools/export.py +5 -5
  29. solidworks_mcp/tools/file_management.py +35 -10
  30. solidworks_mcp/tools/modeling.py +86 -35
  31. solidworks_mcp/tools/sketching.py +16 -4
  32. solidworks_mcp/tools/support_levels.py +7 -0
  33. solidworks_mcp/tools/tool_hints.py +7 -0
  34. solidworks_mcp/tools/toolsets.py +1 -0
  35. solidworks_mcp/version.py +1 -1
  36. {solidworks_mcp_python-2.1.0.dist-info → solidworks_mcp_python-2.2.0.dist-info}/METADATA +3 -3
  37. {solidworks_mcp_python-2.1.0.dist-info → solidworks_mcp_python-2.2.0.dist-info}/RECORD +40 -36
  38. {solidworks_mcp_python-2.1.0.dist-info → solidworks_mcp_python-2.2.0.dist-info}/WHEEL +0 -0
  39. {solidworks_mcp_python-2.1.0.dist-info → solidworks_mcp_python-2.2.0.dist-info}/entry_points.txt +0 -0
  40. {solidworks_mcp_python-2.1.0.dist-info → solidworks_mcp_python-2.2.0.dist-info}/licenses/LICENSE +0 -0
@@ -248,8 +248,9 @@ class RevolveParameters(BaseModel):
248
248
  thin_thickness (float | None): The thin thickness value.
249
249
  sketch_name (str | None): The sketch to revolve, by its tree name;
250
250
  ``None`` for the sketch closed last.
251
- axis_entity (str | None): A reference axis to revolve about, by its
252
- tree name; ``None`` for the sketch's own centreline.
251
+ axis_entity (str | None): The axis to revolve about: a sketch line's
252
+ id (``add_centerline``) or a reference axis by its tree name;
253
+ ``None`` for the sketch's own centreline.
253
254
  """
254
255
 
255
256
  angle: float
@@ -434,6 +435,21 @@ class SolidWorksAdapter(ABC):
434
435
  error="save_file is not implemented by this adapter",
435
436
  )
436
437
 
438
+ # Added in 2.2.0 (#276).
439
+ async def save_copy(self, file_path: str) -> AdapterResult[dict[str, Any]]:
440
+ """Write a copy of the active document and keep the original open.
441
+
442
+ Args:
443
+ file_path (str): Where to write the copy.
444
+
445
+ Returns:
446
+ AdapterResult[dict[str, Any]]: The result produced by the operation.
447
+ """
448
+ return AdapterResult(
449
+ status=AdapterResultStatus.ERROR,
450
+ error="save_copy is not implemented by this adapter",
451
+ )
452
+
437
453
  async def create_base_flange(
438
454
  self,
439
455
  thickness: float,
@@ -1023,6 +1039,154 @@ class SolidWorksAdapter(ABC):
1023
1039
  error="set_construction_geometry is not implemented by this adapter",
1024
1040
  )
1025
1041
 
1042
+ async def create_exploded_view(
1043
+ self, steps: list[dict[str, Any]] | None = None
1044
+ ) -> AdapterResult[dict[str, Any]]:
1045
+ """Explode the active assembly, automatically or step by step, and show it.
1046
+
1047
+ Args:
1048
+ steps (list[dict[str, Any]] | None): ``components``, ``direction``, ``distance``, ``reverse``; none explodes it automatically.
1049
+
1050
+ Returns:
1051
+ AdapterResult[dict[str, Any]]: The result produced by the operation.
1052
+ """
1053
+ return AdapterResult(
1054
+ status=AdapterResultStatus.ERROR,
1055
+ error="create_exploded_view is not implemented by this adapter",
1056
+ )
1057
+
1058
+ async def set_exploded_view(self, exploded: bool) -> AdapterResult[dict[str, Any]]:
1059
+ """Show the assembly's exploded view, or collapse it.
1060
+
1061
+ Args:
1062
+ exploded (bool): ``True`` explodes, ``False`` collapses.
1063
+
1064
+ Returns:
1065
+ AdapterResult[dict[str, Any]]: The result produced by the operation.
1066
+ """
1067
+ return AdapterResult(
1068
+ status=AdapterResultStatus.ERROR,
1069
+ error="set_exploded_view is not implemented by this adapter",
1070
+ )
1071
+
1072
+ async def pattern_components(
1073
+ self,
1074
+ components: list[str],
1075
+ axis: str,
1076
+ count: int,
1077
+ kind: str = "linear",
1078
+ spacing: float | None = None,
1079
+ angle: float | None = None,
1080
+ ) -> AdapterResult[dict[str, Any]]:
1081
+ """Repeat components along or around a reference axis.
1082
+
1083
+ Args:
1084
+ components (list[str]): The seed components' instance names.
1085
+ axis (str): A reference axis's name.
1086
+ count (int): Instances, the seeds included.
1087
+ kind (str): ``linear`` or ``circular``.
1088
+ spacing (float | None): Linear spacing, mm.
1089
+ angle (float | None): Circular angle, degrees.
1090
+
1091
+ Returns:
1092
+ AdapterResult[dict[str, Any]]: The result produced by the operation.
1093
+ """
1094
+ return AdapterResult(
1095
+ status=AdapterResultStatus.ERROR,
1096
+ error="pattern_components is not implemented by this adapter",
1097
+ )
1098
+
1099
+ async def mirror_components(
1100
+ self, components: list[str], plane: str
1101
+ ) -> AdapterResult[dict[str, Any]]:
1102
+ """Mirror components about a plane, as instances of the same parts.
1103
+
1104
+ Args:
1105
+ components (list[str]): Instance names.
1106
+ plane (str): The plane's name.
1107
+
1108
+ Returns:
1109
+ AdapterResult[dict[str, Any]]: The result produced by the operation.
1110
+ """
1111
+ return AdapterResult(
1112
+ status=AdapterResultStatus.ERROR,
1113
+ error="mirror_components is not implemented by this adapter",
1114
+ )
1115
+
1116
+ async def replace_component(
1117
+ self, component: str, file_path: str, all_instances: bool = False
1118
+ ) -> AdapterResult[dict[str, Any]]:
1119
+ """Swap a component for another part or assembly file.
1120
+
1121
+ Args:
1122
+ component (str): The instance name.
1123
+ file_path (str): The part or assembly to put in its place.
1124
+ all_instances (bool): Replace every instance of the same file.
1125
+
1126
+ Returns:
1127
+ AdapterResult[dict[str, Any]]: The result produced by the operation.
1128
+ """
1129
+ return AdapterResult(
1130
+ status=AdapterResultStatus.ERROR,
1131
+ error="replace_component is not implemented by this adapter",
1132
+ )
1133
+
1134
+ # Forwarded by both wrappers since 2.2.0 (#267).
1135
+ async def pack_and_go_assembly(
1136
+ self, source_path: str, target_dir: str
1137
+ ) -> AdapterResult[dict[str, Any]]:
1138
+ """Copy an assembly and every file it uses into one folder.
1139
+
1140
+ Args:
1141
+ source_path (str): The ``.sldasm`` file.
1142
+ target_dir (str): The folder to copy into.
1143
+
1144
+ Returns:
1145
+ AdapterResult[dict[str, Any]]: The result produced by the operation.
1146
+ """
1147
+ return AdapterResult(
1148
+ status=AdapterResultStatus.ERROR,
1149
+ error="pack_and_go_assembly is not implemented by this adapter",
1150
+ )
1151
+
1152
+ async def set_component_appearance(
1153
+ self,
1154
+ component: str,
1155
+ visible: bool | None = None,
1156
+ transparent: bool | None = None,
1157
+ ) -> AdapterResult[dict[str, Any]]:
1158
+ """Hide or show a component, and make it transparent or opaque.
1159
+
1160
+ Args:
1161
+ component (str): The instance name.
1162
+ visible (bool | None): Show (``True``) or hide (``False``).
1163
+ transparent (bool | None): Transparent or opaque.
1164
+
1165
+ Returns:
1166
+ AdapterResult[dict[str, Any]]: The result produced by the operation.
1167
+ """
1168
+ return AdapterResult(
1169
+ status=AdapterResultStatus.ERROR,
1170
+ error="set_component_appearance is not implemented by this adapter",
1171
+ )
1172
+
1173
+ async def add_balloons(
1174
+ self, view_name: str, layout: str = "square"
1175
+ ) -> AdapterResult[dict[str, Any]]:
1176
+ """Number a drawing view's parts with balloons, one per part.
1177
+
1178
+ Args:
1179
+ view_name (str): The drawing view.
1180
+ layout (str): ``square``, ``circle``, ``top``, ``bottom``, ``left`` or ``right``.
1181
+
1182
+ Returns:
1183
+ AdapterResult[dict[str, Any]]: The result produced by the operation.
1184
+ """
1185
+ return AdapterResult(
1186
+ status=AdapterResultStatus.ERROR,
1187
+ error="add_balloons is not implemented by this adapter",
1188
+ )
1189
+
1026
1190
  async def add_sketch_constraint(
1027
1191
  self,
1028
1192
  entity1: str,
@@ -513,6 +513,15 @@ class CircuitBreakerAdapter(SolidWorksAdapter):
513
513
  input_dict={"file_path": file_path},
514
514
  )
515
515
 
516
+ # Added in 2.2.0 (#276).
517
+ async def save_copy(self, file_path: str) -> AdapterResult[dict[str, Any]]:
518
+ """Write a copy and keep the original open, through circuit breaker."""
519
+ return await self._execute_with_circuit_breaker(
520
+ "save_copy",
521
+ lambda: self.adapter.save_copy(file_path),
522
+ input_dict={"file_path": file_path},
523
+ )
524
+
516
525
  async def create_base_flange(
517
526
  self,
518
527
  thickness: float,
@@ -1565,6 +1574,88 @@ class CircuitBreakerAdapter(SolidWorksAdapter):
1565
1574
  lambda: self.adapter.set_construction_geometry(entities, construction),
1566
1575
  )
1567
1576
 
1577
+ async def create_exploded_view(
1578
+ self, steps: list[dict[str, Any]] | None = None
1579
+ ) -> AdapterResult[dict[str, Any]]:
1580
+ """Explode the active assembly, automatically or step by step, and show it, through circuit breaker."""
1581
+ return await self._execute_with_circuit_breaker(
1582
+ "create_exploded_view", lambda: self.adapter.create_exploded_view(steps)
1583
+ )
1584
+
1585
+ async def set_exploded_view(self, exploded: bool) -> AdapterResult[dict[str, Any]]:
1586
+ """Show the assembly's exploded view, or collapse it, through circuit breaker."""
1587
+ return await self._execute_with_circuit_breaker(
1588
+ "set_exploded_view", lambda: self.adapter.set_exploded_view(exploded)
1589
+ )
1590
+
1591
+ async def pattern_components(
1592
+ self,
1593
+ components: list[str],
1594
+ axis: str,
1595
+ count: int,
1596
+ kind: str = "linear",
1597
+ spacing: float | None = None,
1598
+ angle: float | None = None,
1599
+ ) -> AdapterResult[dict[str, Any]]:
1600
+ """Repeat components along or around a reference axis, through circuit breaker."""
1601
+ return await self._execute_with_circuit_breaker(
1602
+ "pattern_components",
1603
+ lambda: self.adapter.pattern_components(
1604
+ components, axis, count, kind, spacing, angle
1605
+ ),
1606
+ )
1607
+
1608
+ async def mirror_components(
1609
+ self, components: list[str], plane: str
1610
+ ) -> AdapterResult[dict[str, Any]]:
1611
+ """Mirror components about a plane, as instances of the same parts, through circuit breaker."""
1612
+ return await self._execute_with_circuit_breaker(
1613
+ "mirror_components",
1614
+ lambda: self.adapter.mirror_components(components, plane),
1615
+ )
1616
+
1617
+ async def replace_component(
1618
+ self, component: str, file_path: str, all_instances: bool = False
1619
+ ) -> AdapterResult[dict[str, Any]]:
1620
+ """Swap a component for another part or assembly file, through circuit breaker."""
1621
+ return await self._execute_with_circuit_breaker(
1622
+ "replace_component",
1623
+ lambda: self.adapter.replace_component(component, file_path, all_instances),
1624
+ )
1625
+
1626
+ # Forwarded since 2.2.0 (#267: it raised AttributeError before reaching
1627
+ # SolidWorks).
1628
+ async def pack_and_go_assembly(
1629
+ self, source_path: str, target_dir: str
1630
+ ) -> AdapterResult[dict[str, Any]]:
1631
+ """Copy an assembly and its files into one folder, through circuit breaker."""
1632
+ return await self._execute_with_circuit_breaker(
1633
+ "pack_and_go_assembly",
1634
+ lambda: self.adapter.pack_and_go_assembly(source_path, target_dir),
1635
+ )
1636
+
1637
+ async def set_component_appearance(
1638
+ self,
1639
+ component: str,
1640
+ visible: bool | None = None,
1641
+ transparent: bool | None = None,
1642
+ ) -> AdapterResult[dict[str, Any]]:
1643
+ """Hide or show a component, and make it transparent or opaque, through circuit breaker."""
1644
+ return await self._execute_with_circuit_breaker(
1645
+ "set_component_appearance",
1646
+ lambda: self.adapter.set_component_appearance(
1647
+ component, visible, transparent
1648
+ ),
1649
+ )
1650
+
1651
+ async def add_balloons(
1652
+ self, view_name: str, layout: str = "square"
1653
+ ) -> AdapterResult[dict[str, Any]]:
1654
+ """Number a drawing view's parts with balloons, one per part, through circuit breaker."""
1655
+ return await self._execute_with_circuit_breaker(
1656
+ "add_balloons", lambda: self.adapter.add_balloons(view_name, layout)
1657
+ )
1658
+
1568
1659
  async def sketch_linear_pattern(
1569
1660
  self,
1570
1661
  entities: list[str],
@@ -535,6 +535,13 @@ class ConnectionPoolAdapter(SolidWorksAdapter):
535
535
  "save_file", lambda adapter: adapter.save_file(file_path)
536
536
  )
537
537
 
538
+ # Added in 2.2.0 (#276).
539
+ async def save_copy(self, file_path: str) -> AdapterResult[dict[str, Any]]:
540
+ """Write a copy and keep the original open, using pool."""
541
+ return await self._execute_with_pool(
542
+ "save_copy", lambda adapter: adapter.save_copy(file_path)
543
+ )
544
+
538
545
  async def create_base_flange(
539
546
  self,
540
547
  thickness: float,
@@ -1415,6 +1422,90 @@ class ConnectionPoolAdapter(SolidWorksAdapter):
1415
1422
  lambda adapter: adapter.set_construction_geometry(entities, construction),
1416
1423
  )
1417
1424
 
1425
+ async def create_exploded_view(
1426
+ self, steps: list[dict[str, Any]] | None = None
1427
+ ) -> AdapterResult[dict[str, Any]]:
1428
+ """Explode the active assembly, automatically or step by step, and show it, using pool."""
1429
+ return await self._execute_with_pool(
1430
+ "create_exploded_view", lambda adapter: adapter.create_exploded_view(steps)
1431
+ )
1432
+
1433
+ async def set_exploded_view(self, exploded: bool) -> AdapterResult[dict[str, Any]]:
1434
+ """Show the assembly's exploded view, or collapse it, using pool."""
1435
+ return await self._execute_with_pool(
1436
+ "set_exploded_view", lambda adapter: adapter.set_exploded_view(exploded)
1437
+ )
1438
+
1439
+ async def pattern_components(
1440
+ self,
1441
+ components: list[str],
1442
+ axis: str,
1443
+ count: int,
1444
+ kind: str = "linear",
1445
+ spacing: float | None = None,
1446
+ angle: float | None = None,
1447
+ ) -> AdapterResult[dict[str, Any]]:
1448
+ """Repeat components along or around a reference axis, using pool."""
1449
+ return await self._execute_with_pool(
1450
+ "pattern_components",
1451
+ lambda adapter: adapter.pattern_components(
1452
+ components, axis, count, kind, spacing, angle
1453
+ ),
1454
+ )
1455
+
1456
+ async def mirror_components(
1457
+ self, components: list[str], plane: str
1458
+ ) -> AdapterResult[dict[str, Any]]:
1459
+ """Mirror components about a plane, as instances of the same parts, using pool."""
1460
+ return await self._execute_with_pool(
1461
+ "mirror_components",
1462
+ lambda adapter: adapter.mirror_components(components, plane),
1463
+ )
1464
+
1465
+ async def replace_component(
1466
+ self, component: str, file_path: str, all_instances: bool = False
1467
+ ) -> AdapterResult[dict[str, Any]]:
1468
+ """Swap a component for another part or assembly file, using pool."""
1469
+ return await self._execute_with_pool(
1470
+ "replace_component",
1471
+ lambda adapter: adapter.replace_component(
1472
+ component, file_path, all_instances
1473
+ ),
1474
+ )
1475
+
1476
+ # Forwarded since 2.2.0 (#267: it raised AttributeError before reaching
1477
+ # SolidWorks).
1478
+ async def pack_and_go_assembly(
1479
+ self, source_path: str, target_dir: str
1480
+ ) -> AdapterResult[dict[str, Any]]:
1481
+ """Copy an assembly and its files into one folder, using pool."""
1482
+ return await self._execute_with_pool(
1483
+ "pack_and_go_assembly",
1484
+ lambda adapter: adapter.pack_and_go_assembly(source_path, target_dir),
1485
+ )
1486
+
1487
+ async def set_component_appearance(
1488
+ self,
1489
+ component: str,
1490
+ visible: bool | None = None,
1491
+ transparent: bool | None = None,
1492
+ ) -> AdapterResult[dict[str, Any]]:
1493
+ """Hide or show a component, and make it transparent or opaque, using pool."""
1494
+ return await self._execute_with_pool(
1495
+ "set_component_appearance",
1496
+ lambda adapter: adapter.set_component_appearance(
1497
+ component, visible, transparent
1498
+ ),
1499
+ )
1500
+
1501
+ async def add_balloons(
1502
+ self, view_name: str, layout: str = "square"
1503
+ ) -> AdapterResult[dict[str, Any]]:
1504
+ """Number a drawing view's parts with balloons, one per part, using pool."""
1505
+ return await self._execute_with_pool(
1506
+ "add_balloons", lambda adapter: adapter.add_balloons(view_name, layout)
1507
+ )
1508
+
1418
1509
  async def sketch_linear_pattern(
1419
1510
  self,
1420
1511
  entities: list[str],
@@ -1438,11 +1438,15 @@ class MockSolidWorksAdapter(
1438
1438
  if isinstance(sketch, AdapterResult):
1439
1439
  return sketch
1440
1440
  axis = getattr(params, "axis_entity", None)
1441
- if axis and axis not in self._axes:
1441
+ # A sketch line's id is an axis since 2.2.0, as on the real adapter.
1442
+ if axis and axis not in self._axes and axis not in self._sketch_entity_ids:
1442
1443
  return AdapterResult(
1443
1444
  status=AdapterResultStatus.ERROR,
1444
- error=f"Axis '{axis}' is not a reference axis in the "
1445
- "model. Create one with create_axis.",
1445
+ error=f"Axis '{axis}' is neither a sketch line's id (from "
1446
+ "add_centerline or add_line) nor a reference axis in the model. "
1447
+ "Give the id add_centerline returned, create an axis with "
1448
+ "create_axis, or leave axis_entity out to use the sketch's "
1449
+ "centreline.",
1446
1450
  )
1447
1451
 
1448
1452
  await asyncio.sleep(self._delays["feature_operation"])
@@ -1733,6 +1737,30 @@ class MockSolidWorksAdapter(
1733
1737
  execution_time=0.02,
1734
1738
  )
1735
1739
 
1740
+ # Added in 2.2.0 (#276).
1741
+ async def save_copy(self, file_path: str) -> AdapterResult[dict[str, Any]]:
1742
+ """Mock writing a copy; the open document keeps its path.
1743
+
1744
+ Args:
1745
+ file_path (str): Where the copy goes.
1746
+
1747
+ Returns:
1748
+ AdapterResult[dict[str, Any]]: The copy's path and the open one.
1749
+ """
1750
+ if not self._current_model:
1751
+ return AdapterResult(
1752
+ status=AdapterResultStatus.ERROR, error="No active model"
1753
+ )
1754
+ self._operation_count += 1
1755
+ return AdapterResult(
1756
+ status=AdapterResultStatus.SUCCESS,
1757
+ data={
1758
+ "file_path": file_path,
1759
+ "current_path": self._current_model.path,
1760
+ "kept_original": True,
1761
+ },
1762
+ )
1763
+
1736
1764
  async def add_line(
1737
1765
  self, x1: float, y1: float, x2: float, y2: float
1738
1766
  ) -> AdapterResult[str]:
@@ -2196,6 +2224,190 @@ class MockSolidWorksAdapter(
2196
2224
  },
2197
2225
  )
2198
2226
 
2227
+ def _no_assembly(self, operation: str) -> AdapterResult[Any] | None:
2228
+ """The wrong-document error, or ``None`` with an assembly open."""
2229
+ if self._current_model and self._current_model.type == "Assembly":
2230
+ return None
2231
+ return AdapterResult(
2232
+ status=AdapterResultStatus.ERROR,
2233
+ error=f"{operation} requires an assembly document",
2234
+ )
2235
+
2236
+ async def create_exploded_view(
2237
+ self, steps: list[dict[str, Any]] | None = None
2238
+ ) -> AdapterResult[dict[str, Any]]:
2239
+ """Mock exploding the assembly: one view, the steps counted.
2240
+
2241
+ Args:
2242
+ steps (list[dict[str, Any]] | None): The explode steps.
2243
+
2244
+ Returns:
2245
+ AdapterResult[dict[str, Any]]: ``view``, ``steps`` and ``automatic``.
2246
+ """
2247
+ if error := self._no_assembly("create_exploded_view"):
2248
+ return error
2249
+ self._exploded = True
2250
+ self._operation_count += 1
2251
+ return AdapterResult(
2252
+ status=AdapterResultStatus.SUCCESS,
2253
+ data={
2254
+ "view": "ExplView1",
2255
+ "steps": len(steps or []),
2256
+ "automatic": not steps,
2257
+ },
2258
+ )
2259
+
2260
+ async def set_exploded_view(self, exploded: bool) -> AdapterResult[dict[str, Any]]:
2261
+ """Mock showing or collapsing the exploded view.
2262
+
2263
+ Args:
2264
+ exploded (bool): Explode or collapse.
2265
+
2266
+ Returns:
2267
+ AdapterResult[dict[str, Any]]: ``view`` and ``exploded``.
2268
+ """
2269
+ if error := self._no_assembly("set_exploded_view"):
2270
+ return error
2271
+ if not getattr(self, "_exploded", False):
2272
+ return AdapterResult(
2273
+ status=AdapterResultStatus.ERROR,
2274
+ error="No exploded view found in the active configuration",
2275
+ )
2276
+ return AdapterResult(
2277
+ status=AdapterResultStatus.SUCCESS,
2278
+ data={"view": "ExplView1", "exploded": exploded},
2279
+ )
2280
+
2281
+ async def pattern_components(
2282
+ self,
2283
+ components: list[str],
2284
+ axis: str,
2285
+ count: int,
2286
+ kind: str = "linear",
2287
+ spacing: float | None = None,
2288
+ angle: float | None = None,
2289
+ ) -> AdapterResult[dict[str, Any]]:
2290
+ """Mock a component pattern: (count - 1) new instances per seed.
2291
+
2292
+ Args:
2293
+ components (list[str]): The seeds.
2294
+ axis (str): The axis.
2295
+ count (int): Instances, seeds included.
2296
+ kind (str): ``linear`` or ``circular``.
2297
+ spacing (float | None): Linear spacing, mm.
2298
+ angle (float | None): Circular angle, degrees.
2299
+
2300
+ Returns:
2301
+ AdapterResult[dict[str, Any]]: ``feature`` and ``added``.
2302
+ """
2303
+ if error := self._no_assembly("pattern_components"):
2304
+ return error
2305
+ added = [f"{c}-copy{i}" for c in components for i in range(1, count)]
2306
+ self._operation_count += 1
2307
+ return AdapterResult(
2308
+ status=AdapterResultStatus.SUCCESS,
2309
+ data={"feature": "LocalLPattern1", "added": added},
2310
+ )
2311
+
2312
+ async def mirror_components(
2313
+ self, components: list[str], plane: str
2314
+ ) -> AdapterResult[dict[str, Any]]:
2315
+ """Mock mirroring: one new instance per component.
2316
+
2317
+ Args:
2318
+ components (list[str]): The components.
2319
+ plane (str): The plane.
2320
+
2321
+ Returns:
2322
+ AdapterResult[dict[str, Any]]: ``plane`` and ``added``.
2323
+ """
2324
+ if error := self._no_assembly("mirror_components"):
2325
+ return error
2326
+ self._operation_count += 1
2327
+ return AdapterResult(
2328
+ status=AdapterResultStatus.SUCCESS,
2329
+ data={"plane": plane, "added": [f"{c}-mirror" for c in components]},
2330
+ )
2331
+
2332
+ async def replace_component(
2333
+ self, component: str, file_path: str, all_instances: bool = False
2334
+ ) -> AdapterResult[dict[str, Any]]:
2335
+ """Mock replacing: the component now uses ``file_path``.
2336
+
2337
+ Args:
2338
+ component (str): The instance.
2339
+ file_path (str): The new file.
2340
+ all_instances (bool): Every instance.
2341
+
2342
+ Returns:
2343
+ AdapterResult[dict[str, Any]]: ``component``, ``file_path``,
2344
+ ``replaced``.
2345
+ """
2346
+ if error := self._no_assembly("replace_component"):
2347
+ return error
2348
+ self._operation_count += 1
2349
+ return AdapterResult(
2350
+ status=AdapterResultStatus.SUCCESS,
2351
+ data={
2352
+ "component": component,
2353
+ "file_path": file_path,
2354
+ "replaced": {component: file_path},
2355
+ },
2356
+ )
2357
+
2358
+ async def set_component_appearance(
2359
+ self,
2360
+ component: str,
2361
+ visible: bool | None = None,
2362
+ transparent: bool | None = None,
2363
+ ) -> AdapterResult[dict[str, Any]]:
2364
+ """Mock hiding, showing and transparency: the states as asked.
2365
+
2366
+ Args:
2367
+ component (str): The instance.
2368
+ visible (bool | None): Show or hide.
2369
+ transparent (bool | None): Transparent or opaque.
2370
+
2371
+ Returns:
2372
+ AdapterResult[dict[str, Any]]: ``visible`` and ``transparent``.
2373
+ """
2374
+ if error := self._no_assembly("set_component_state"):
2375
+ return error
2376
+ return AdapterResult(
2377
+ status=AdapterResultStatus.SUCCESS,
2378
+ data={
2379
+ "visible": True if visible is None else visible,
2380
+ "transparent": transparent,
2381
+ },
2382
+ )
2383
+
2384
+ async def add_balloons(
2385
+ self, view_name: str, layout: str = "square"
2386
+ ) -> AdapterResult[dict[str, Any]]:
2387
+ """Mock balloons: three, numbered 1 to 3.
2388
+
2389
+ Args:
2390
+ view_name (str): The view.
2391
+ layout (str): The layout.
2392
+
2393
+ Returns:
2394
+ AdapterResult[dict[str, Any]]: ``view``, ``layout``, ``count``, ``items``.
2395
+ """
2396
+ if not self._current_model or self._current_model.type != "Drawing":
2397
+ return AdapterResult(
2398
+ status=AdapterResultStatus.ERROR,
2399
+ error="add_balloons requires a drawing document",
2400
+ )
2401
+ return AdapterResult(
2402
+ status=AdapterResultStatus.SUCCESS,
2403
+ data={
2404
+ "view": view_name,
2405
+ "layout": layout,
2406
+ "count": 3,
2407
+ "items": ["1", "2", "3"],
2408
+ },
2409
+ )
2410
+
2199
2411
  async def add_polygon(
2200
2412
  self,
2201
2413
  center_x: float,