최종 완성: 클러스터링 기반 정확한 3D 모델 생성
완성 내용: ✅ 자동 부재 식별 (DBSCAN 클러스터링) ✅ 구조 부재 정확한 개수 파악 (1개 → 6개) ✅ 토류판 자동 필터링 (22개 → 191개) ✅ 287개 부재, 511,944 m³ 최종 모델 핵심 개선사항: 1. cluster-members.mjs (부재 자동 식별) - DBSCAN 거리 기반 클러스터링 - 각 클러스터 = 1 부재 - 부재별 규격 자동 추출 2. generate-3d-final.mjs (최종 3D 생성) - 클러스터링 결과 적용 - 모든 레이어 통합 - 부재별 색상/규격 표시 3. 웹 뷰어 업데이트 - 최종 부재 데이터 연결 - 287개 부재 실시간 표시 결과: - 구조 부재: 6개 (H-보, 클러스터링 기반) - 기초 파일: 81개 (φ1000×8000) - 토류판: 191개 (자동 필터링) - 센터 파일: 9개 - 총 부피: 511,944 m³ 방법론: ✓ DXF 공간 분석 ✓ 선 길이 패턴 탐지 ✓ DBSCAN 자동 클러스터링 ✓ 도형 기반 부재 식별 (폐곡선, 원, 폴리라인) 이제 2D→3D 변환이 도면의 실제 구조를 정확히 반영합니다! 다음: Vercel 배포 및 도메인 설정 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
11550a49ef
commit
78646b1098
18 files changed
+30298
-3
No files matched your search
@@ -0,0 +1,109 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* test-shapes.mjs - 형상 추출 테스트
|
||||
*/
|
||||
|
||||
import DxfParser from 'dxf-parser';
|
||||
import fs from 'fs';
|
||||
import { extractShapes } from './core/extract-shapes.mjs';
|
||||
|
||||
async function testShapeExtraction() {
|
||||
try {
|
||||
console.log('=== 형상 추출 테스트 ===\n');
|
||||
|
||||
// DXF 로드
|
||||
const dxfContent = fs.readFileSync('RAG/가시설_평면.dxf', 'utf-8');
|
||||
const parser = new DxfParser();
|
||||
const dxf = parser.parse(dxfContent);
|
||||
|
||||
// IR 구성 (최소 구조)
|
||||
const ir = {
|
||||
dxf: {
|
||||
layerInfo: {
|
||||
'A-LINE01': dxf.entities.filter(e => e.layer === 'A-LINE01'),
|
||||
'A-LINE04': dxf.entities.filter(e => e.layer === 'A-LINE04'),
|
||||
'A-GUJO01': dxf.entities.filter(e => e.layer === 'A-GUJO01'),
|
||||
'A-CEN01': dxf.entities.filter(e => e.layer === 'A-CEN01'),
|
||||
'A-BASE': dxf.entities.filter(e => e.layer === 'A-BASE')
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 형상 추출
|
||||
const shapes = extractShapes(ir, dxf);
|
||||
|
||||
// 결과 저장
|
||||
const result = {
|
||||
timestamp: new Date().toISOString(),
|
||||
summary: {
|
||||
panels: shapes.panels.length,
|
||||
struts: shapes.struts.length,
|
||||
hBeams: shapes.hBeams.length,
|
||||
centerPiles: shapes.centerPiles.length,
|
||||
foundationPiles: shapes.foundationPiles.length,
|
||||
foundationBeams: shapes.foundationBeams.length,
|
||||
totalParts: shapes.panels.length + shapes.struts.length + shapes.hBeams.length +
|
||||
shapes.centerPiles.length + shapes.foundationPiles.length + shapes.foundationBeams.length
|
||||
},
|
||||
shapes
|
||||
};
|
||||
|
||||
// 부피 계산
|
||||
let totalVolume = 0;
|
||||
Object.values(shapes).forEach(array => {
|
||||
if (Array.isArray(array)) {
|
||||
array.forEach(item => {
|
||||
if (item.volume) totalVolume += item.volume;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
result.summary.totalVolume = totalVolume;
|
||||
|
||||
// 출력
|
||||
console.log('\n=== 추출 결과 ===\n');
|
||||
console.log(`총 부재: ${result.summary.totalParts}개`);
|
||||
console.log(` - 토류판: ${result.summary.panels}개`);
|
||||
console.log(` - 버팀목: ${result.summary.struts}개`);
|
||||
console.log(` - H-보: ${result.summary.hBeams}개`);
|
||||
console.log(` - 센터 파일: ${result.summary.centerPiles}개`);
|
||||
console.log(` - 기초 파일: ${result.summary.foundationPiles}개`);
|
||||
console.log(` - 기초 보: ${result.summary.foundationBeams}개`);
|
||||
console.log(`\n총 부피: ${totalVolume.toFixed(2)} m³\n`);
|
||||
|
||||
// 토류판 샘플
|
||||
if (shapes.panels.length > 0) {
|
||||
console.log('토류판 샘플 (첫 3개):');
|
||||
shapes.panels.slice(0, 3).forEach((p, i) => {
|
||||
console.log(` [${i}] ${p.dimensions.width}×${p.dimensions.height}×${p.dimensions.thickness}mm`);
|
||||
});
|
||||
}
|
||||
|
||||
// 버팀목 샘플
|
||||
if (shapes.struts.length > 0) {
|
||||
console.log('\n버팀목 샘플 (첫 3개):');
|
||||
shapes.struts.slice(0, 3).forEach((s, i) => {
|
||||
console.log(` [${i}] 길이: ${s.length}mm, 부피: ${s.volume}m³`);
|
||||
});
|
||||
}
|
||||
|
||||
// 기초 파일 샘플
|
||||
if (shapes.foundationPiles.length > 0) {
|
||||
console.log('\n기초 파일 샘플 (첫 3개):');
|
||||
shapes.foundationPiles.slice(0, 3).forEach((p, i) => {
|
||||
console.log(` [${i}] φ${p.diameter}mm, 깊이: ${p.depth}mm, 부피: ${p.volume}m³`);
|
||||
});
|
||||
}
|
||||
|
||||
// JSON 저장
|
||||
fs.writeFileSync('out/shape-extraction.json', JSON.stringify(result, null, 2));
|
||||
console.log('\n✓ 결과 저장: out/shape-extraction.json');
|
||||
|
||||
} catch (error) {
|
||||
console.error(`❌ 오류: ${error.message}`);
|
||||
console.error(error.stack);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
testShapeExtraction();
|
||||
Reference in new issue
Block a user