Public Member Functions
Primitive Class Reference

Detailed Description

Represents the primitive object of a X3DObject, a primitive is the basic form that is the building block of modeling and animation.

Primitive can be created with X3DObject.GetActivePrimitive.

See also:
PolygonMesh,Vertex, CVertexRefArray
Example:
        using namespace XSI;
        Application app;
        Model root = app.GetActiveSceneRoot();

        X3DObject myCube;
        root.AddGeometry( L"Cube", L"MeshSurface",L"myMesh",myCube);

        PolygonMesh myMesh(myCube.GetActivePrimitive().GetGeometry());
        CVertexRefArray vertices(myMesh.GetVertices());

        LONG lCount = vertices.GetCount();
        for (LONG i=0; i<lCount; i++ )
        {
            Vertex vertex(vertices.GetItem(i));

            CVertexRefArray neighbors(vertex.GetNeighborVertices(1));
            app.LogMessage(L"Number of neighbor vertices for Vertex " +
                    CValue(i).GetAsText() + L": " +
                    CValue(neighbors.GetCount()).GetAsText() );
        }

#include <xsi_primitive.h>

Inheritance diagram for Primitive:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  Primitive ()
  ~Primitive ()
  Primitive (const CRef &in_ref)
  Primitive (const Primitive &in_obj)
bool  IsA (siClassID in_ClassID) const
siClassID  GetClassID () const
Primitive operator= (const Primitive &in_obj)
Primitive operator= (const CRef &in_ref)
Geometry  GetGeometry (double in_time=DBL_MAX) const
Geometry  GetGeometry (double in_time, siConstructionMode in_mode) const
CRefArray  GetICETrees () const

Constructor & Destructor Documentation

Primitive ( )

Default constructor.

~Primitive ( )

Default destructor.

Primitive ( const CRef in_ref )

Constructor.

Parameters:
in_ref constant reference object.
Primitive ( const Primitive in_obj )

Copy constructor.

Parameters:
in_obj constant class object.

Member Function Documentation

bool IsA ( siClassID  in_ClassID ) const [virtual]

Returns true if a given class type is compatible with this API class.

Parameters:
in_ClassID class type.
Returns:
true if the class is compatible, false otherwise.

Reimplemented from ProjectItem.

Reimplemented in HairPrimitive, and ParticleCloudPrimitive.

siClassID GetClassID ( ) const [virtual]

Returns the type of the API class.

Returns:
The class type.

Reimplemented from ProjectItem.

Reimplemented in HairPrimitive, and ParticleCloudPrimitive.

Primitive& operator= ( const Primitive in_obj )

Creates an object from another object. The newly created object is set to empty if the input object is not compatible.

Parameters:
in_obj constant class object.
Returns:
The new Primitive object.
Primitive& operator= ( const CRef in_ref )

Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.

Parameters:
in_ref constant class object.
Returns:
The new Primitive object.

Reimplemented from ProjectItem.

Reimplemented in HairPrimitive, and ParticleCloudPrimitive.

Geometry GetGeometry ( double  in_time = DBL_MAX ) const

Returns a Geometry object containing the objects geometry

Parameters:
in_time Time (in frames) at which to get property. The default value is DBL_MAX (representing the current time).
Returns:
The object's Geometry.
Geometry GetGeometry ( double  in_time,
siConstructionMode  in_mode 
) const

Returns a snapshot of the Geometry at the specified time.

Parameters:
in_time Time (in frames) at which to get property. Use DBL_MAX to specify the current time.
Note:
This argument is ignored inside operators.
Parameters:
in_mode The construction mode is used to access a version of the geometry with specific deforms. The geometry positions you get depends on the mode you passed in.

Valid construction modes include:

  • siConstructionModeModeling: Gets the original geometry positions. This mode is typically used in export applications where geometry, shape and envelope positions are exported separately.
  • siConstructionModePrimaryShape: Combines the geometry positions with the shape deformation.
  • siConstructionModeSecondaryShape: Combines the geometry positions with the shape deformation, the envelope deformation and the deforms installed above the envelope such as the move point operators. This mode is typically used for plotting the final results of shape and envelope deformation.
  • siConstructionModeAnimation: Combines the geometry positions with the shape and envelope deformation altogether.
  • siConstructionModeDefault: Uses the current construction mode set in XSI.
Note:
This argument is ignored inside operators.
Returns:
The object's Geometry.
See also:
siConstructionMode
Example:
Demonstrates how to access the original point positions and then the shape and envelope deformations
        Application app;
        Model root = app.GetActiveSceneRoot();

        X3DObject myCube;
        root.AddGeometry( L"Cube", L"MeshSurface",L"myMesh",myCube);

        Primitive cubePrimitive = myCube.GetActivePrimitive();

        CValue retval;
        CValueArray args(19);
        args[0] = myCube.GetFullName() + L".pnt[0]";
        args[1] = 10;
        args[2] = 10;
        args[3] = 10;
        args[17] = siConstructionModeAnimation;

        app.ExecuteCommand(L"Translate",args,retval );

        Geometry modelGeometry = cubePrimitive.GetGeometry(0,siConstructionModeModeling);
        Point modelPoint1 = modelGeometry.GetPoints()[0];
        app.LogMessage( L"modelPoint1: " + CString(modelPoint1.GetPosition()) );

        Geometry shapeGeometry = cubePrimitive.GetGeometry(0,siConstructionModeAnimation);
        Point shapePoint1 = shapeGeometry.GetPoints()[0];
        app.LogMessage( L"shapePoint1: " + CString(shapePoint1.GetPosition()) );
CRefArray GetICETrees ( ) const

Returns all ICETree objects that write to this primitive.

Returns:
Array of references to the ICETree objects.
See also:
ApplyOp, ApplyICEOp, ApplyICETemplate
Since:
7.0
Example:
This example demonstrates how to get the ICETree object(s) from the primitive.
        void CreatePrim( const CString& in_presetobj, const CString& in_geometrytype, const CString& in_name, const CString& in_parent );
        void ApplyOp( const CString& in_presetobj, CString& io_connectionset, const CValue& in_connecttype, siOperationMode io_immediatemode, CValue& out_outputobjs, const CValue& in_constructionmode );

        // Create agrid primitive and apply a ICETree on it
        CreatePrim( L"Grid", L"MeshSurface", L"", L"" );

        CString strObj(L"grid");
        CValue retVal;
        ApplyOp( L"ICETree", strObj, 0, siPersistentOperation, retVal, 0 );

        // Get the X3DObject grid from the selection and iterate over the ICETrees
        Selection selection = xsi.GetSelection();
        X3DObject x3DGrid = selection[ 0 ];
        CRefArray trees = x3DGrid.GetActivePrimitive().GetICETrees();
        for (LONG i=0; i<trees.GetCount(); i++)
        {
            ICETree t = tress[i];
            xsi.LogMessage( t.GetClassIDName() );
        }

The documentation for this class was generated from the following file: