Entity
Example
Example Entity class là lớp cơ sở trừu tượng cho các đối tượng có thể được gắn vào một Node trong đồ thị cảnh Aspose.3D. Các lớp con cụ thể bao gồm Mesh, Camera, Light, và Geometry. Entity cung cấp quyền truy cập vào cây phân cấp nút cha và phơi bày getExcluded() phương thức để kiểm soát hiển thị.
import com.aspose.threed.Scene;
import com.aspose.threed.*;
Scene scene = Scene.fromFile("model.obj");
for (Node node : scene.getRootNode().getChildNodes()) {
Entity entity = node.getEntity();
if (entity != null) {
if (!entity.getExcluded()) {
Node parent = entity.getParentNode();
System.out.println("Active entity '" + entity.getName()
+ "', parent: " + (parent != null ? parent.getName() : "None"));
}
}
}Example
A3DObject -> SceneObject -> Entity
Các lớp con: Geometry -> Mesh, Camera, Light, và các lớp khác.
Example
Entity là một lớp cơ sở trừu tượng và không được khởi tạo trực tiếp. Sử dụng một lớp con cụ thể như Mesh.
Example
| Name | Type | Access | Description |
|---|---|---|---|
parentNode | Node | Read | Gets the parent node. |
parentNodes | ArrayList<Node> | Read | Gets the parent nodes. |
excluded | boolean | Read | Gets the excluded. |
boundingBox | BoundingBox | Read | Gets the bounding box. |
scene | Scene | Read | Gets the scene. |
name | String | Read | Gets the name. |
properties | PropertyCollection | Read | Gets the properties. |
Example
| Signature | Description |
|---|---|
Entity() | NURBS curve is a curve represented by NURBS(Non-uniform rational basis spline), A NURBS curve is defined by its getOrder(), a set of weighted Geometry.getControlPoints() and a getKnotVectors() The w component in control point is used as control point’s weight, whatever it is a CurveDimension.TWO_DIMENSIONAL or CurveDimension.THREE_DIMENSIONAL |
Entity(name: String) | Creates a new Entity with the given name |
getParentNode() → Node | Constructor of instance. |
setParentNode(value: Node) | The Boolean operator used in the operation to create the result mesh. |
getParentNodes() → ArrayList<Node> | Protected constructor to allow derived classes to set name. |
getExcluded() → boolean | The Boolean operator used in the operation to create the result mesh. |
setExcluded(value: boolean) | Sets the excluded value. |
getBoundingBox() → BoundingBox | The first operand of the Boolean operator. |
SceneObject() | Boolean operator allows you to apply Boolean operation on two IMeshConvertible instances. |
getScene() → Scene | Constructor of BooleanOperator. |
A3DObject() | Parameterized Cylinder. It can also be used to represent a cone when one of radiusTop/radiusBottom is zero. |
getName() → String | The segments of the curve. |
setName(name: String) | Constructs a CircleShape profile with specified radius. |
getProperties() → PropertyCollection | Initializes a new instance of Cylinder class. |
findProperty(name: String) → Property | Initializes a new instance of the Bone class. |
getProperty(name: String) → Object | Gets the transform matrix of the node in current pose. |
setProperty(name: String, value: Object) | Gets the width segments. |
removeProperty(name: String) → boolean | Gets flip coordinate system of control points/normal during importing/exporting. |
Example
Kiểm tra trạng thái thực thể sau khi tải một cảnh:
import com.aspose.threed.Scene;
import com.aspose.threed.Node;
import com.aspose.threed.Entity;
import com.aspose.threed.*;
Scene scene = Scene.fromFile("model.stl");
for (Node node : scene.getRootNode().getChildNodes()) {
Entity entity = node.getEntity();
if (entity == null) continue;
System.out.println("Entity: " + (entity.getName().isEmpty() ? "(unnamed)" : entity.getName()));
System.out.println(" Type: " + entity.getClass().getSimpleName());
System.out.println(" Excluded: " + entity.getExcluded());
System.out.println(" Parent node: "
+ (entity.getParentNode() != null ? entity.getParentNode().getName() : "None"));
if (entity instanceof Mesh) {
Mesh mesh = (Mesh) entity;
System.out.println(" Vertices: " + mesh.getControlPoints().size());
System.out.println(" Polygons: " + mesh.getPolygonCount());
}
}