คําถามที่พบบ่อย
คําถามที่พบบ่อย
ฉันจะติดตั้ง @aspose/3d ได้อย่างไร?
ติดตั้งจาก npm. Node.js 18 หรือภายหลังจําเป็นต้อง:
asposefoss/3d is not yet published — build from source until it ships. See the project README for build instructions.ตรวจสอบการติดตั้ง:
import { Scene } from '@aspose/3d';
const scene = new Scene();
console.log('@aspose/3d ready');TypeScript ประเภทการกําหนดจะถูกเชื่อมโยงกับแพคเกจ ไม่มีแยก @types/ การบรรจุภัณฑ์จําเป็น.
รูปแบบไฟล์ใดที่ได้รับการสนับสนุน?
| รูปแบบ | การนําเข้า | การส่งออก |
|---|---|---|
| OBJ | ใช่ | ใช่ |
| กลตฟ | ใช่ | ใช่ |
| FBX | ไม่ * | ไม่ * |
| STL | ใช่ | ใช่ |
| 3MF | ใช่ | ใช่ |
| COLLADA | ใช่ | ใช่ |
ฉันจะโหลดไฟล์ 3D ได้อย่างไร?
สร้าง A Scene และโทร scene.open():
import { Scene } from '@aspose/3d';
import { ObjLoadOptions } from '@aspose/3d/formats/obj';
const scene = new Scene();
scene.open('model.obj', new ObjLoadOptions());สําหรับรูปแบบที่ไม่ต้องการตัวเลือกพิเศษลืมข้อตกลงที่สอง:
const scene = new Scene();
scene.open('model.glb');scene.open() เป็น asynchronous หรือไม่?
ไม่ใช่. scene.open() และ scene.openFromBuffer() เป็นโทรซิงโครน หากคุณต้องการไม่บล็อก I/O, ลําดับพวกเขาภายใน Node.js ทํางานสายหรือล็อคกับ setImmediate.
ฉันจะบันทึกไว้ใน GLTF / GLB ได้อย่างไร?
โทรศัพท์ scene.save() ด้วยเส้นทางไฟล์ รูปแบบจะถูกตรวจจับโดยอัตโนมัติจากการขยาย:
scene.save('output.glb'); // binary glTF
scene.save('output.gltf'); // JSON glTF
scene.save('output.obj'); // OBJ
scene.save('output.stl'); // STL
ฉันจะโหลดจาก Buffer (ในหน่วยความจํา) ได้อย่างไร?
ใช้ scene.openFromBuffer():
import * as fs from 'fs';
import { Scene } from '@aspose/3d';
import { ObjLoadOptions } from '@aspose/3d/formats/obj';
const buffer = fs.readFileSync('model.obj');
const scene = new Scene();
scene.openFromBuffer(buffer, new ObjLoadOptions());ข้อผิดพลาด: ไม่สามารถหาโมดูล ‘@aspose/3d/formats/obj’
นี่ต้องใช้ Node.js 12.7+ การส่งออกแพคเกจ ความละเอียด ให้แน่ใจว่าคุณอยู่ใน Noda.js 18+ สําหรับ TypeScript, set "moduleResolution": "node16" หรือ "bundler" ใน tsconfig.json:
{
"compilerOptions": {
"moduleResolution": "node16",
"target": "ES2020"
}
}ประเภทของ node.entity คืออะไร?
node.entity เป็นพิมพ์อย่างกว้างขวาง เพื่อเข้าถึงคุณสมบัติเฉพาะของเมซาตรวจสอบความปรากฏตัวของพวกเขาด้วย 'controlPoints' in node.entity หรือใช้ Mesh ประเภทจาก @aspose/3d/entities:
import { Mesh } from '@aspose/3d/entities';
if (node.entity instanceof Mesh) {
const mesh = node.entity;
console.log(mesh.controlPoints.length);
}การทํางานของห้องสมุดในเบราว์เซอร์หรือไม่?
บีบอิสระได้รับการออกแบบมาสําหรับ Node.js การสนับสนุนเบราว์เซอร์ขึ้นอยู่กับการกําหนดค่าแพคเกจและระบบไฟล์ API ที่ถูกแทนที่ด้วยตัวเลือกในหน่วยความจํา.
บีบอิสระมีความปลอดภัยหรือไม่?
ทุกคน Scene วัตถุเป็นอิสระ ใช้แยกต่างหาก Scene ตัวอย่างจากแถว Node.js ที่แยกจะปลอดภัยจนกว่าคุณไม่แบ่งปันสถานการณ์เดียวผ่านแถบโดยไม่ต้องซิงค์ภายนอก.
รุ่น Node.js จะสนับสนุนอะไรได้?
Node.js 18, 20 และ 22 ได้รับการสนับสนุนอย่างเป็นทางการ TypeScript 5.0+ ที่แนะนํา.
@aspose/3d สนับสนุนการเคลื่อนไหวหรือไม่?
ใช่ ระบบการเคลื่อนไหวรวมถึง AnimationClip, AnimationChannel, และ Keyframe รอบประเภทที่สามารถเข้าถึงได้จาก @aspose/3d/animation.