본문으로 건너뛰기

GetGeometryStatistics

적용 버전: VIZWide3D 3.0

모델 형상 통계 반환 (mesh / triangle 개수)

Parameters​

NameTypeDescription
[fileKey=null]String파일 Key. 미지정 시 열려있는 모델 전체 합계.

Returns​

TypeDescription
Object통계 객체. 모델이 없으면 null
| 필드 | 의미 |
|---|---|
| totalTriangleCount | 모델 전체 삼각형 수 (미다운로드 형상 포함) |
| residentTriangleCount | 현재 로드된 삼각형 수 |
| totalTriangleCountComplete | false 면 totalTriangleCount 가 실제보다 작다(AddChildFileData 등록 모델). 이때는 residentTriangleCount 를 쓴다 |
| bodyNodeCount | 형상(BODY 노드) 개수. 구조 로드 후 정확하다 |
| meshBlockCount | 현재 로드된 형상 블록 수 (수시로 변한다) |
| meshFileCount | 형상 파일 수 (다운로드 단위) |
| meshObjectCount | 현재 로드된 형상 조각 수 |
| meshFileDownloadedCount | 한 번이라도 다운로드된 형상 파일 수 |
| meshFileResidentCount | 현재 로드된 형상 파일 수 |
| meshFileMissingTriangleInfoCount | 삼각형 정보가 없는 형상 파일 수 |
| isFullyResident | 모든 형상 파일 로드 여부. true 일 때만 residentTriangleCount 가 모델 전체와 같다 |
| isStructureLoaded | 구조 로드 완료 여부. false 면 bodyNodeCount 는 잠정값 |
| fileCount | 집계에 포함된 모델 파일 수 |

Example​

import VIZCore3DModule from "./VIZCore3D/VIZCore3D.js";

let main = document.createElement('div');
main.className = "VIZWeb_Main";

let view = document.createElement('div');
view.id = "view"
view.className = "VIZCore3D";
main.appendChild(view);

document.body.appendChild(main);
const vizcore = new VIZCore3DModule(view);

let onInitialize = function () {
const fileKey = "example"
const url = "./model/toycar/vizw/toycar_wh.vizw";

let onload = (e) => {
//구조 로드 시점부터 형상 개수 조회 가능
if (e.kind !== vizcore.Enum.ImportFiledataKind.Structure) return;

let stat = vizcore.Model.GetGeometryStatistics();
console.log(stat);

//모델 전체 삼각형 수 (미다운로드 포함)
if (stat.totalTriangleCountComplete)
console.log("삼각형: " + stat.totalTriangleCount.toLocaleString());
else
console.log("삼각형(로드분): " + stat.residentTriangleCount.toLocaleString());

//mesh 개수 - 세 가지 단위
console.log("형상(BODY): " + stat.bodyNodeCount.toLocaleString());
console.log("형상 블록: " + stat.meshBlockCount.toLocaleString());
console.log("mesh 파일: " + stat.meshFileCount.toLocaleString());
};

let onerror = function () {
console.log("onerror");
};

//모델 열기
vizcore.Model.OpenFile(fileKey, url, onload, onerror);
};

let vizcoreParam = {
event: {
onInit: onInitialize,
}
};

vizcore.Init(vizcoreParam);