This commit is contained in:
2026-04-21 15:22:22 +08:00
parent 70cbc456d7
commit 77c4885a40
3 changed files with 114 additions and 55 deletions
+16 -10
View File
@@ -80,7 +80,7 @@ class HTMLGenerator:
<strong style="color: #333;">制造要求</strong>
</div>
<div class="metric">
<span class="metric-label">型腔材料:</span>
<span class="metric-label">模仁材料:</span>
<span class="metric-value">{manufacturing_info.get("mold_material", "N/A")}</span>
</div>
<div class="metric">
@@ -176,7 +176,7 @@ class HTMLGenerator:
<button onclick="resetView()">重置视图</button>
<button onclick="toggleWireframe()">切换线框</button>
<button onclick="toggleProduct()">显示/隐藏产品</button>
<button onclick="toggleMold()">显示/隐藏模具</button>
<button onclick="toggleMold()">显示/隐藏A/B板</button>
<button onclick="toggleParting()">显示/隐藏分型面</button>
<button onclick="togglePointcloud()">显示/隐藏点云</button>
<button id="splitBtn" onclick="splitMold()" style="background:#FF5722;color:#fff;font-weight:bold;">分模拆分</button>
@@ -278,7 +278,7 @@ class HTMLGenerator:
scene.add(productMesh);
}}
// 创建型腔(上半模 - 蓝色)
// 创建A板/定模(蓝色,分型面以上)
// 尝试从后端数据获取实际几何,否则使用简化Box
if (cavityData && cavityData.mold_cavities && cavityData.mold_cavities.cavity && cavityData.mold_cavities.cavity.vertices) {{
const cavityVerts = cavityData.mold_cavities.cavity.vertices;
@@ -324,7 +324,7 @@ class HTMLGenerator:
createSimpleCavity(width, height, depth);
}}
// 创建型芯(下半模 - 橙色)
// 创建B板/动模(橙色,分型面以下)
if (cavityData && cavityData.mold_cavities && cavityData.mold_cavities.core && cavityData.mold_cavities.core.vertices) {{
const coreVerts = cavityData.mold_cavities.core.vertices;
const coreFaces = cavityData.mold_cavities.core.faces;
@@ -389,9 +389,11 @@ class HTMLGenerator:
}}
}}
// 创建简化型腔(备用)
// 创建简化型腔/A板(定模,分型面以上)— 备用
function createSimpleCavity(width, height, depth) {{
const cavityGeometry = new THREE.BoxGeometry(width * 1.2, height * 0.4, depth * 1.2);
// A板:分型面(Z中心)以上的上半模
const halfHeight = height / 2;
const cavityGeometry = new THREE.BoxGeometry(width * 1.2, depth * 1.2, halfHeight + 10);
const cavityMaterial = new THREE.MeshPhongMaterial({{
color: 0x2196F3,
transparent: true,
@@ -400,7 +402,8 @@ class HTMLGenerator:
}});
cavityMesh = new THREE.Mesh(cavityGeometry, cavityMaterial);
cavityMesh.position.set(0, height * 0.7, 0);
// Z轴开模:A板放在分型面以上
cavityMesh.position.set(0, 0, halfHeight / 2 + 5);
scene.add(cavityMesh);
const cavityWireframe = new THREE.WireframeGeometry(cavityGeometry);
@@ -412,9 +415,11 @@ class HTMLGenerator:
cavityMesh.add(cavityLine);
}}
// 创建简化型芯(备用)
// 创建简化型芯/B板(动模,分型面以下)— 备用
function createSimpleCore(width, height, depth) {{
const coreGeometry = new THREE.BoxGeometry(width * 1.2, height * 0.4, depth * 1.2);
// B板:分型面(Z中心)以下的下半模
const halfHeight = height / 2;
const coreGeometry = new THREE.BoxGeometry(width * 1.2, depth * 1.2, halfHeight + 10);
const coreMaterial = new THREE.MeshPhongMaterial({{
color: 0xFF9800,
transparent: true,
@@ -423,7 +428,8 @@ class HTMLGenerator:
}});
coreMesh = new THREE.Mesh(coreGeometry, coreMaterial);
coreMesh.position.set(0, -height * 0.7, 0);
// Z轴开模:B板放在分型面以下
coreMesh.position.set(0, 0, -halfHeight / 2 - 5);
scene.add(coreMesh);
const coreWireframe = new THREE.WireframeGeometry(coreGeometry);