본문으로 건너뛰기

FromFile

FileKey 에 해당하는 전체 노드 정보 반환.

적용 버전: VIZWide3D 4.0

접근 경로: vizcore.Object3D.FromFile

Parameters​

NameType필수기본값Description
fileKeyString필수File Key

Returns​

TypeDescription
Promise<Object[]>노드 정보 배열 (없으면 빈 배열). 필드는 FromID 참고

Example​

// 적용 버전: VIZWide3D 4.0
import { VIZCore3D } from './VIZCore3D/VIZCore3D.js';

let vizcore = new VIZCore3D('view');

const onConfiguration = () => {
};

// VIZCore3D 초기화 완료 이벤트
const onInitialize = async () => {
console.log('[VIZCore3D] : Initialize!');

const fileKey = "example";
const url = "./model/toycar/vizw/toycar_wh.vizw";

const onload = async (e) => {
//해당파일 다운로드 성공
console.log('onload::', e);

// 구조 파일을 받은 뒤 실행 (onload 는 파일 종류마다 불린다)
if (e.kind === vizcore.Enum.ImportFiledataKind.Structure) {
let nodes = await vizcore.Object3D.FromFile(fileKey);
console.log(nodes);
}
};

const onerror = () => {
//해당파일 다운로드 실패
console.log('onerror');
};

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

const vizcoreParam = {
event: {
onInit: onInitialize,
onConfiguration: onConfiguration,
}
};

vizcore.Init(vizcoreParam);