Entity

Example

Example Entity klasse is de abstracte basisklasse voor objecten die kunnen worden gekoppeld aan een Node in de Aspose.3D-scènegrafiek. Concrete subklassen omvatten Mesh, Camera, Light, en Geometry. Entity biedt toegang tot de hiërarchie van bovenliggende knooppunten en maakt de getExcluded() methode voor zichtbaarheidbeheer.

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

Subklassen: Geometry -> Mesh, Camera, Light, en anderen.

Example

Entity is een abstracte basisklasse en wordt niet direct geïnstantieerd. Gebruik een concrete subklasse zoals Mesh.

Example

NameTypeAccessDescription
parentNodeNodeReadGets the parent node.
parentNodesArrayList<Node>ReadGets the parent nodes.
excludedbooleanReadGets the excluded.
boundingBoxBoundingBoxReadGets the bounding box.
sceneSceneReadGets the scene.
nameStringReadGets the name.
propertiesPropertyCollectionReadGets the properties.

Example

SignatureDescription
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()NodeConstructor 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()booleanThe Boolean operator used in the operation to create the result mesh.
setExcluded(value: boolean)Sets the excluded value.
getBoundingBox()BoundingBoxThe first operand of the Boolean operator.
SceneObject()Boolean operator allows you to apply Boolean operation on two IMeshConvertible instances.
getScene()SceneConstructor of BooleanOperator.
A3DObject()Parameterized Cylinder. It can also be used to represent a cone when one of radiusTop/radiusBottom is zero.
getName()StringThe segments of the curve.
setName(name: String)Constructs a CircleShape profile with specified radius.
getProperties()PropertyCollectionInitializes a new instance of Cylinder class.
findProperty(name: String)PropertyInitializes a new instance of the Bone class.
getProperty(name: String)ObjectGets the transform matrix of the node in current pose.
setProperty(name: String, value: Object)Gets the width segments.
removeProperty(name: String)booleanGets flip coordinate system of control points/normal during importing/exporting.

Example

Inspecteer de entiteitsstatus na het laden van een scène:

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());
    }
}

Zie ook

 Nederlands