CSShape Object

The CSShape Object represents a 3DCrafter Shape.

General GetID
  GetName
  SetName
  Clear
  AddShape
  Transform
  InverseTransform
  GetBoundingBox
  Reduce
  Optimize
  GetCustomFieldValue
  SetCustomFieldValue
Faces CreateFace
  GetFaceCount
  GetFace
  DeleteFace
Points AddOptimizedPointXYZ
  GetPointCount
  GetPointXYZ
  SetPointXYZ
Normals AddOptimizedNormalXYZ
  GetNormalCount
  GetNormalXYZ
  SetNormalXYZ
  Crease
  Crease2
  GetCreasingFactor
  SetCreasingFactor
Bones GetBoneCount
  GetBone
Materials and Textures GetMaterialCount
  GetMaterial
  ApplyMaterial
  GetFaceMaterialID
Hierarchy GetParentGroup
Selection GetSelectionCount
  GetSelectionItem
  GetSelectionSubItem
  GetSelectionType

 

GetID

Gets the unique identifier for the shape.

Syntax

shape.GetID() As Variant

GetName

Gets the name of the shape.

Syntax

shape.GetName() As Variant

SetName

Sets the name of the shape.

Syntax

shape.SetName(Name As Variant)

Reduce

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

Syntax

shape.Reduce(Level as Variant)

Remarks

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

Optimize

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

Syntax

shape.Optimize()

Clear

Clears the contents of the shape.

Syntax

shape.Clear()

AddShape

Adds a CSShape shape to the shape.

Syntax

shape.AddShape(Shape As Variant)

Transform

Transforms the shape from model coordinates to world coordinates.

Syntax

shape.Transform()

InverseTransform

Transforms the shape from world coordinates to model coordinates.

Syntax

shape.InverseTransform()

GetBoundingBox

Gets the shape's bounding box.

Syntax

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

CreateFace

Creates a CSFace shape and adds it to the shape.

Syntax

shape.CreateFace() As CSFace

GetFaceCount

Gets the number of CSFace shapes in the shape.

Syntax

shape.GetFaceCount() As Variant

GetFace

Gets the specified CSFace shape.

Syntax

shape.GetFace(FaceID As Variant) As CSFace

DeleteFace

Deletes the specified CSFace from the shape.

Syntax

shape.DeleteFace(FaceID As Variant)

GetPointCount

Gets the number of points in the shape.

Syntax

shape.GetPointCount() As Variant

GetPointXYZ

Gets the specified point.

Syntax

shape.GetPointXYZ(PointID As Variant,
X As Variant,
Y As Variant,
Z
As Variant)

SetPointXYZ

Sets the specified point.

Syntax

shape.SetPointXYZ(PointID As Variant,
X As Variant,
Y As Variant,
Z
As Variant)

AddOptimizedPointXYZ

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

Syntax

shape.AddOptimizedPointXYZ(X As Variant,
Y As Variant,
Z
As Variant) as Variant

AddOptimizedNormalXYZ

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

Syntax

shape.AddOptimizedNormalXYZ(X As Variant,
Y As Variant,
Z
As Variant) as Variant

GetTextureCoordinateCount

Gets the number of texture coordinates in the shape.

Syntax

shape.GetTextureCoordinateCount() As Variant

GetTextureCoordinateUV

Gets the specified texture coordinate.

Syntax

shape.GetTextureCoordinateUV(UVID As Variant,
U As Variant,
V As Variant
)

SetTextureCoordinateUV

Sets the specified texture coordinate.

Syntax

shape.SetTextureCoordinateUV(UVID As Variant,
U As Variant,
V As Variant
)

AddOptimizedTextureCoordinateUV

Adds a texture coordinate to the shape and returns its index. If an identical texture coordinate is found the index of the existing texture coordinate is returned.

Syntax

shape.AddOptimizedTextureCoordinateUV(U As Variant,
V As Variant
) as Variant

Crease

Generates default creasing (normals) for the shape.

Syntax

shape.Crease

Crease2

Generates creasing (normals) for the shape based on the crease angle provided.

Syntax

shape.Crease2(CreasingAngle As Variant)

Remarks

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

 

GetCreasingFactor

Gets the creasing factor for the shape.

Syntax

shape.GetCreasingFactor() As Variant

Remarks

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

SetCreasingFactor

Sets the creasing factor for the shape.

Syntax

shape.SetCreasingFactor(CreasingFactor As Variant)

Remarks

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

GetNormalCount

Gets the number of normals in the shape.

Syntax

shape.GetNormalCount() As Variant

GetNormalXYZ

Gets the specified normal.

Syntax

shape.GetNormalXYZ(NormalID As Variant,
X As Variant,
Y As Variant,
Z
As Variant)

SetNormalXYZ

Sets the specified normal.

Syntax

shape.SetNormalXYZ(NormalID As Variant,
X As Variant,
Y As Variant,
Z
As Variant)

GetBoneCount

Gets the number of CSGroup shapes in the scene that behave as bones and affect the shape.

Syntax

shape.GetBoneCount() As Variant

Remarks

In 3DCrafter bones are separate shapes, but in the 3DCrafter API bones are simply groups that have been enabled to affect points as they are moved.

GetBone

Gets the specified CSGroup shape that behaves as a bone affecting the shape.

Syntax

shape.GetBone(BoneID As Variant) As CSGroup

Remarks

In 3DCrafter bones are separate shapes, but in the 3DCrafter API bones are simply groups that have been enabled to affect points as they are moved.

GetMaterialCount

Gets the number of materials used by this shape.

Syntax

shape.GetMaterialCount() As Variant

GetMaterial

Gets the specified CSMaterial shape.

Syntax

shape.GetMaterial(MaterialID As Variant) As CSMaterial

ApplyMaterial

Sets a material for the shape.

Syntax

shape.ApplyMaterial(Material As Variant)

Remarks

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

GetFaceMaterialID

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

Syntax

shape.GetFaceMaterialID(FaceID As Variant) As Variant

Remarks

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

GetParentGroup

Gets the CSGroup that is the parent group of the shape.

Syntax

shape.GetParentGroup() As CSGroup

GetCustomField

Gets the value of a custom field.

Syntax

shape.GetCustomFieldValue(FieldID as Variant) As Variant

Remarks

The FieldID can be determined using GetShapeCustomFieldID of the CSScene shape.

SetCustomField

Sets the value of a custom field.

Syntax

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

Remarks

The FieldID can be determined using GetShapeCustomFieldID of the CSScene shape.

GetSelectionCount

Gets the number of selected items (points/edges/faces) in the shape.

Syntax

shape.GetActiveFaceCount() As Variant

GetSelectionItem

Gets the ID of the selected item.

Syntax

shape.GetSelectionItem(Index As Variant) As Variant

Remarks

The selection item will be either a point, edge or face. The type is given by GetSelectionType. For edges, this will be the face the edge belongs to.

GetSelectionSubItem

Gets the ID of the selected sub-item.

Syntax

shape.GetSelectionSubItem(Index As Variant) As Variant

Remarks

This is used only when the GetSelectionType returns a type of Edge (3). It will be the starting point of the selected edge within the face identified by GetSelectionItem.

Note that when an edge is selected, the matching reversed edge is not selected.

GetSelectionType

Gets the type of the selection.

Syntax

shape.GetSelectionType() As Variant

Remarks

1 = Face
2 = Point
3 = Edge