dsh-engineering-ui 0.0.0-stage → 1.5.1
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.
- package/LICENSE +21 -0
- package/README.md +772 -3
- package/engineering/plugins/dsh-engineering-ui/cordis.patch.yml +5 -0
- package/engineering/plugins/dsh-engineering-ui/icon.svg +14 -0
- package/engineering/plugins/dsh-engineering-ui/lib/client.js +8257 -0
- package/engineering/plugins/dsh-engineering-ui/lib/defense-sign.js +1552 -0
- package/engineering/plugins/dsh-engineering-ui/lib/index.js +5634 -0
- package/engineering/plugins/dsh-engineering-ui/lib/job-wait-guard.js +236 -0
- package/engineering/plugins/dsh-engineering-ui/lib/mem-guard.js +331 -0
- package/engineering/plugins/dsh-engineering-ui/lib/webots.js +114 -0
- package/engineering/plugins/dsh-engineering-ui/locale/en.json +6 -0
- package/engineering/plugins/dsh-engineering-ui/locale/zh.json +6 -0
- package/engineering/plugins/dsh-engineering-ui/preset-engineering.patch.yml +601 -0
- package/engineering/skills/assembly-orchestration/SKILL.md +651 -0
- package/engineering/skills/cad-workflow/SKILL.md +132 -0
- package/engineering/skills/mode-selection/SKILL.md +660 -0
- package/engineering/skills/physics-in-loop/SKILL.md +238 -0
- package/engineering/skills/physics-in-loop/references/feadocs.md +142 -0
- package/engineering/skills/solidworks-bridge/SKILL.md +445 -0
- package/engineering/skills/sw-design/SKILL.md +112 -0
- package/engineering/skills/sw-design/references/autocad-workflow.md +81 -0
- package/engineering/skills/sw-design/references/gbt-drafting.md +71 -0
- package/engineering/skills/sw-to-cad/SKILL.md +121 -0
- package/engineering/skills/webots-simulation/SKILL.md +58 -0
- package/engineering/tools/LICENSE.Auto-SolidWorks +21 -0
- package/engineering/tools/_plugin_paths.py +93 -0
- package/engineering/tools/_root.py +330 -0
- package/engineering/tools/_store.py +446 -0
- package/engineering/tools/ac_bridge.py +459 -0
- package/engineering/tools/ac_rules.json +21 -0
- package/engineering/tools/ac_validate.py +699 -0
- package/engineering/tools/ask_user.py +887 -0
- package/engineering/tools/build_arm1.py +46 -0
- package/engineering/tools/build_assembly.py +94 -0
- package/engineering/tools/build_base.py +57 -0
- package/engineering/tools/build_housing.py +70 -0
- package/engineering/tools/build_structural.py +43 -0
- package/engineering/tools/build_transmission.py +69 -0
- package/engineering/tools/cadx.lsp +128 -0
- package/engineering/tools/choice_contract.py +61 -0
- package/engineering/tools/conn_state.py +1671 -0
- package/engineering/tools/defense_gate.py +3374 -0
- package/engineering/tools/drawing_input.py +314 -0
- package/engineering/tools/env_check.py +467 -0
- package/engineering/tools/examples/build_axis.py +142 -0
- package/engineering/tools/examples/build_cup.py +56 -0
- package/engineering/tools/examples/build_plate.py +58 -0
- package/engineering/tools/examples/build_sphere.py +30 -0
- package/engineering/tools/examples/build_transition_duct.py +381 -0
- package/engineering/tools/gate_integrity.py +401 -0
- package/engineering/tools/mode2_flow.py +3589 -0
- package/engineering/tools/mode_checker.py +77 -0
- package/engineering/tools/mode_gate.py +8013 -0
- package/engineering/tools/part_registry.py +4266 -0
- package/engineering/tools/physics/__init__.py +50 -0
- package/engineering/tools/physics/_compat.py +12 -0
- package/engineering/tools/physics/design_state.py +142 -0
- package/engineering/tools/physics/domain_validator.py +751 -0
- package/engineering/tools/physics/fatigue.py +489 -0
- package/engineering/tools/physics/fea_solver.py +1163 -0
- package/engineering/tools/physics/feapy_solver.py +314 -0
- package/engineering/tools/physics/gb_materials.json +1228 -0
- package/engineering/tools/physics/geometry_gate.py +337 -0
- package/engineering/tools/physics/load_case.py +951 -0
- package/engineering/tools/physics/material_db.py +874 -0
- package/engineering/tools/physics/mesh_adapter.py +321 -0
- package/engineering/tools/physics/refine_rules.py +272 -0
- package/engineering/tools/physics/rules/gb_base_rules.json +377 -0
- package/engineering/tools/physics/rules/gb_drafting_rules.json +57 -0
- package/engineering/tools/physics/rules/gb_electrical_rules.json +25 -0
- package/engineering/tools/physics/rules/gb_fasteners_rules.json +73 -0
- package/engineering/tools/physics/rules/gb_housing_rules.json +41 -0
- package/engineering/tools/physics/rules/gb_manufacturing_rules.json +25 -0
- package/engineering/tools/physics/rules/gb_material_verify_rules.json +72 -0
- package/engineering/tools/physics/rules/gb_materials_rules.json +377 -0
- package/engineering/tools/physics/rules/gb_safety_rules.json +89 -0
- package/engineering/tools/physics/rules/gb_springs_rules.json +41 -0
- package/engineering/tools/physics/rules/gb_standards_registry.json +1646 -0
- package/engineering/tools/physics/rules/gb_structural_rules.json +201 -0
- package/engineering/tools/physics/rules/gb_surface_rules.json +25 -0
- package/engineering/tools/physics/rules/gb_transmission_rules.json +233 -0
- package/engineering/tools/physics/rules/housing_rules.json +48 -0
- package/engineering/tools/physics/rules/manifest.json +54 -0
- package/engineering/tools/physics/rules/mold_rules.json +48 -0
- package/engineering/tools/physics/rules/structural_rules.json +56 -0
- package/engineering/tools/physics/rules/transmission_rules.json +48 -0
- package/engineering/tools/physics/simulation_report.py +829 -0
- package/engineering/tools/physics_bridge.py +2685 -0
- package/engineering/tools/profile-manifest.ps1 +72 -0
- package/engineering/tools/run_regression.py +109 -0
- package/engineering/tools/settings.py +419 -0
- package/engineering/tools/solidworks-modeling.md +519 -0
- package/engineering/tools/sw_bridge.py +8215 -0
- package/engineering/tools/sw_guard.py +1066 -0
- package/engineering/tools/sw_surface.py +87 -0
- package/engineering/tools/swapi.py +14766 -0
- package/engineering/tools/verify_sync.py +218 -0
- package/engineering/tools/visual_check.py +2589 -0
- package/engineering/tools/webots_env.py +121 -0
- package/engineering/tools/webots_mcp/__init__.py +3 -0
- package/engineering/tools/webots_mcp/__main__.py +3 -0
- package/engineering/tools/webots_mcp/assembly.py +391 -0
- package/engineering/tools/webots_mcp/bootstrap.py +55 -0
- package/engineering/tools/webots_mcp/controller_worker.py +124 -0
- package/engineering/tools/webots_mcp/evidence.py +288 -0
- package/engineering/tools/webots_mcp/fake_worker.py +69 -0
- package/engineering/tools/webots_mcp/fault_resources.py +121 -0
- package/engineering/tools/webots_mcp/host.py +45 -0
- package/engineering/tools/webots_mcp/ledger.py +73 -0
- package/engineering/tools/webots_mcp/owned_job.py +70 -0
- package/engineering/tools/webots_mcp/physical_gate.py +187 -0
- package/engineering/tools/webots_mcp/physics.py +152 -0
- package/engineering/tools/webots_mcp/pipeline.py +108 -0
- package/engineering/tools/webots_mcp/recipes.py +129 -0
- package/engineering/tools/webots_mcp/repair.py +132 -0
- package/engineering/tools/webots_mcp/repair_trial.py +375 -0
- package/engineering/tools/webots_mcp/runtime.py +311 -0
- package/engineering/tools/webots_mcp/server.py +217 -0
- package/engineering/tools/webots_mcp/sw_export.py +509 -0
- package/engineering/tools/webots_mcp/transport.py +156 -0
- package/engineering/tools/workflow_gate.py +6134 -0
- package/package.json +66 -6
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"""原生放样曲面扩展;保留原有 SWModel 实现。"""
|
|
2
|
+
import math
|
|
3
|
+
import os
|
|
4
|
+
import win32com.client
|
|
5
|
+
|
|
6
|
+
from swapi import MM, SWModel, _com_get, _feature_type_name, _is_sketch_feature
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def saved_duct_geometry_matches(sw, path, geometry_sha256):
|
|
10
|
+
"""核对已保存的单配置风管曲面及文件摘要。"""
|
|
11
|
+
from gate_integrity import _sha256
|
|
12
|
+
doc = sw.GetOpenDocumentByName(path)
|
|
13
|
+
model = win32com.client.CastTo(doc, "IModelDoc2")
|
|
14
|
+
part = win32com.client.CastTo(doc, "IPartDoc")
|
|
15
|
+
solids, sheets = part.GetBodies2(0, False), part.GetBodies2(1, False)
|
|
16
|
+
loft = win32com.client.CastTo(part.FeatureByName("DSH_Duct_Surface"), "IFeature")
|
|
17
|
+
return (
|
|
18
|
+
os.path.normcase(os.path.realpath(model.GetPathName())) ==
|
|
19
|
+
os.path.normcase(os.path.realpath(path))
|
|
20
|
+
and not model.GetSaveFlag() and model.GetType() == 1
|
|
21
|
+
and model.GetConfigurationCount() == 1
|
|
22
|
+
and (solids is None or isinstance(solids, (tuple, list)) and len(solids) == 0)
|
|
23
|
+
and isinstance(sheets, (tuple, list)) and len(sheets) == 1
|
|
24
|
+
and loft is not None and loft.GetTypeName2() == "BlendRefSurface"
|
|
25
|
+
and isinstance(geometry_sha256, str) and bool(geometry_sha256)
|
|
26
|
+
and _sha256(path) == geometry_sha256)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class SurfaceModel(SWModel):
|
|
30
|
+
def ellipse(self, cx, cy, width_mm, height_mm):
|
|
31
|
+
"""在当前草图创建水平长轴椭圆;宽、高均为全轴长度(mm)。"""
|
|
32
|
+
cx, cy, w, h = map(float, (cx, cy, width_mm, height_mm))
|
|
33
|
+
if not all(map(math.isfinite, (cx, cy, w, h))) or not w > h > 0:
|
|
34
|
+
raise ValueError("椭圆需要有限坐标,并满足 宽 > 高 > 0(毫米)")
|
|
35
|
+
self._ensure_sketch_active()
|
|
36
|
+
self._ensure_area_context()
|
|
37
|
+
x, y = cx * MM, (cy + self._surface_sketch_offset) * MM
|
|
38
|
+
segment = self.skm.CreateEllipse(x, y, 0, x + w * MM / 2, y, 0,
|
|
39
|
+
x, y + h * MM / 2, 0)
|
|
40
|
+
if segment is None:
|
|
41
|
+
raise RuntimeError("SolidWorks 未创建椭圆")
|
|
42
|
+
self._sketch_area_mm2 += math.pi * w * h / 4
|
|
43
|
+
return segment
|
|
44
|
+
|
|
45
|
+
def loft_surface(self, sketch_names):
|
|
46
|
+
"""按顺序连接已退出编辑的截面草图,返回新建的原生放样曲面特征。"""
|
|
47
|
+
if not isinstance(sketch_names, (tuple, list)) or len(sketch_names) < 2:
|
|
48
|
+
raise ValueError("放样至少需要两个有序草图名")
|
|
49
|
+
if any(not isinstance(n, str) or not n.strip() for n in sketch_names):
|
|
50
|
+
raise ValueError("截面必须使用特征树中的草图名")
|
|
51
|
+
if len({n.casefold() for n in sketch_names}) != len(sketch_names):
|
|
52
|
+
raise ValueError("同一草图不能重复用作截面")
|
|
53
|
+
if self.skm.ActiveSketch is not None:
|
|
54
|
+
raise RuntimeError("请先退出截面草图,再创建放样")
|
|
55
|
+
|
|
56
|
+
def surface_lofts():
|
|
57
|
+
return {f.Name: f for f in self.fm.GetFeatures(True) or ()
|
|
58
|
+
if _feature_type_name(f) == "BlendRefSurface"}
|
|
59
|
+
|
|
60
|
+
previous = surface_lofts().keys()
|
|
61
|
+
part = win32com.client.CastTo(self.model, "IPartDoc")
|
|
62
|
+
self.model.ClearSelection2(True)
|
|
63
|
+
try:
|
|
64
|
+
for i, name in enumerate(sketch_names):
|
|
65
|
+
feature = part.FeatureByName(name)
|
|
66
|
+
if not _is_sketch_feature(feature) or not feature.Select2(i > 0, 1):
|
|
67
|
+
raise RuntimeError("无法选中放样截面草图:" + name)
|
|
68
|
+
if self.model.SelectionManager.GetSelectedObjectCount2(1) != len(sketch_names):
|
|
69
|
+
raise RuntimeError("SolidWorks 选中的截面数量不符")
|
|
70
|
+
# Port of Auto-SolidWorks NativeFeatures.cs at 1bf68f4 (LICENSE.Auto-SolidWorks).
|
|
71
|
+
self.model.InsertLoftRefSurface2(False, False, False, 1.0, 0, 0)
|
|
72
|
+
if not self.model.ForceRebuild3(False):
|
|
73
|
+
raise RuntimeError("放样后模型无法重建;请检查截面")
|
|
74
|
+
lofts = surface_lofts()
|
|
75
|
+
created = lofts.keys() - previous
|
|
76
|
+
if len(created) != 1:
|
|
77
|
+
raise RuntimeError("未找到唯一的新放样曲面特征;请检查截面顺序和形状")
|
|
78
|
+
loft = lofts[created.pop()]
|
|
79
|
+
faces = _com_get(loft, "GetFaces")
|
|
80
|
+
if not faces or any(face.GetBody().GetType() != 1 for face in faces):
|
|
81
|
+
raise RuntimeError("放样特征没有生成可用的曲面体")
|
|
82
|
+
self._consumed_sketches.update(sketch_names)
|
|
83
|
+
if self._active_sketch_name in sketch_names:
|
|
84
|
+
self._mark_sketch_consumed()
|
|
85
|
+
return loft
|
|
86
|
+
finally:
|
|
87
|
+
self.model.ClearSelection2(True)
|