CanvasObject Object

The CanvasObject object represents a 3D Canvas Object.

General GetID
  GetName
  SetName
  GetType
  Clear
  AddObject
  Transform
  InverseTransform
  GetBoundingBox
  WriteScriptOperationLayer
  Reduce
  Optimize
  GetCustomFieldValue
  SetCustomFieldValue
Faces CreateFace
  GetFaceCount
  GetFace
  DeleteFace
Points AddOptimizedPoint
  GetPointCount
  GetPoint
  SetPoint
Normals AddOptimizedNormal
  GetNormalCount
  GetNormal
  SetNormal
  GenerateNormals
  GetCreaseFactor
  SetCreaseFactor
Bones GetBoneCount
  GetBone
Materials and Textures GetMaterialCount
  GetMaterial
  SetObjectMaterial
  GetFaceMaterialIndex
Hierarchy GetParentGroup

 

GetID

Gets the unique identifier for the object.

Syntax

object.GetID() As Variant

GetName

Gets the name of the object.

Syntax

object.GetName() As Variant

SetName

Sets the name of the object.

Syntax

object.SetName(Name As Variant)

Remarks

An object must be made a child of a group using the AddObject method before it can be named.

Reduce

Reduces the number of points in the object using Direct3D's mesh simplification function. Note that this will result in object being triangulated.

Syntax

object.Reduce(Level as Variant)

Remarks

Level is the percentage of points you would like to retain in the object. For example a level of 50 would retain 50% of the original points in the object.

Optimize

Optimizes the object to remove unused points, duplicate points, and faces with two or fewer points.

Syntax

object.Optimize()

GetType

Gets the object type.

Syntax

object.GetType() As Variant

Remarks

0 = 3D Canvas Object
1 = 3D Canvas Skin
2 = 3D Canvas Placeholder

Clear

Clears the contents of the object.

Syntax

object.Clear()

AddObject

Adds a CanvasObject object to the object.

Syntax

object.AddObject(Object As Variant)

Transform

Transforms the object from model coordinates to world coordinates.

Syntax

object.Transform()

InverseTransform

Transforms the object from world coordinates to model coordinates.

Syntax

object.InverseTransform()

GetBoundingBox

Gets the object's bounding box.

Syntax

object.GetBoundingBox(MinX As Variant,
MinY As Variant,
MinZ As Variant,
MaxX As Variant,
MaxY As Variant,
MaxZ
As Variant)

WriteScriptOperationLayer

Writes a Script Operation Layer for the object.

Syntax

object.WriteScriptOperationLayer()

Remarks

After you make any change to an object you must use this method to notify 3D Canvas that the change should be saved the next time 3D Canvas saves the document.

This method does not need to be done after changes made while animating.

CreateFace

Creates a CanvasFace object and adds it to the object.

Syntax

object.CreateFace() As CanvasFace

GetFaceCount

Gets the number of CanvasFace objects in the object.

Syntax

object.GetFaceCount() As Variant

GetFace

Gets the specified CanvasFace object.

Syntax

object.GetFace(Index As Variant) As CanvasFace

DeleteFace

Deletes the specified CanvasFace from the object.

Syntax

object.DeleteFace(Index As Variant)

GetPointCount

Gets the number of points in the object.

Syntax

object.GetPointCount() As Variant

GetPoint

Gets the specified point.

Syntax

object.GetPoint(Index As Variant,
X As Variant,
Y As Variant,
Z
As Variant)

SetPoint

Sets the specified point.

Syntax

object.SetPoint(Index As Variant,
X As Variant,
Y As Variant,
Z
As Variant)

AddOptimizedPoint

Adds a point to the object and returns its index. If an identical point is found the index of the existing point is returned.

Syntax

object.AddOptimizedPoint(X As Variant,
Y As Variant,
Z
As Variant) as Variant

AddOptimizedNormal

Adds a normal to the object and returns its index. If an identical normal is found the index of the existing normal is returned.

Syntax

object.AddOptimizedNormal(X As Variant,
Y As Variant,
Z
As Variant) as Variant

GetUVCount

Gets the number of UVs in the object.

Syntax

object.GetUVCount() As Variant

GetUV

Gets the specified UV.

Syntax

object.GetUV(Index As Variant,
U As Variant,
V As Variant
)

SetUV

Sets the specified UV.

Syntax

object.SetUV(Index As Variant,
U As Variant,
V As Variant
)

AddOptimizedUV

Adds a uv to the object and returns its index. If an identical uv is found the index of the existing uv is returned.

Syntax

object.AddOptimizedUV(U As Variant,
V As Variant
) as Variant

GenerateNormals

Generates normals for the object.

Syntax

object.GenerateNormals(CreaseAngle As Variant)

Remarks

The crease angle is in Radians. pi Radians = 180 degrees.

GetCreaseFactor

Gets the crease factor for the object.

Syntax

object.GetCreaseFactor() As Variant

Remarks

This is a value from 0 to 100. When 3D Canvas generates creasing it considers 100 to mean pi Radians (180 degrees).

SetCreaseFactor

Sets the crease factor for the object.

Syntax

object.SetCreaseFactor(CreaseFactor As Variant)

Remarks

This is a value from 0 to 100. When 3D Canvas generates creasing it considers 100 to mean pi Radians (180 degrees).

GetNormalCount

Gets the number of normals in the object.

Syntax

object.GetNormalCount() As Variant

GetNormal

Gets the specified normal.

Syntax

object.GetNormal(Index As Variant,
X As Variant,
Y As Variant,
Z
As Variant)

SetNormal

Sets the specified normal.

Syntax

object.SetNormal(Index As Variant,
X As Variant,
Y As Variant,
Z
As Variant)

GetBoneCount

Gets the number of bones that affect this object.

Syntax

object.GetBoneCount() As Variant

GetBone

Gets the specified CanvasBone object.

Syntax

object.GetBone(Index As Variant) As CanvasBone

GetMaterialCount

Gets the number of materials used by this object.

Syntax

object.GetMaterialCount() As Variant

GetMaterial

Gets the specified CanvasMaterial object.

Syntax

object.GetMaterial(Index As Variant) As CanvasMaterial

SetObjectMaterial

Sets a material for the object.

Syntax

object.SetMaterial(Material As Variant)

Remarks

This material will be applied to each face that makes up the object.

GetFaceMaterialIndex

Gets an index to the material that has been applied to a face.

Syntax

object.GetFaceMaterialIndex(FaceIndex As Variant) As Variant

Remarks

Use this in conjunction with GetMaterial to retrieve the specific material applied to a face.

GetParentGroup

Gets the CanvasGroup that is the parent group of the object.

Syntax

object.GetParentGroup() As CanvasGroup

GetCustomField

Gets the value of a custom field.

Syntax

object.GetCustomFieldValue(FieldID as Variant) As Variant

Remarks

The FieldID can be determined using GetObjectCustomFieldID of the CanvasApplication object.

SetCustomField

Sets the value of a custom field.

Syntax

object.SetCustomFieldValue(FieldID as Variant, FieldValue As Variant)

Remarks

The FieldID can be determined using GetObjectCustomFieldID of the CanvasApplication object.