'
' This example demonstrates how to add an element by index number.
' It also shows what happens when you try to add an element that
' is already part of the SubComponent and what happens when you
' try to add an element using an invalid index number.
'
NewScene , false
set oObject = Application.ActiveSceneRoot.AddGeometry( "Cube", "MeshSurface", "MyCube" )
set oSubComponent = oObject.ActivePrimitive.Geometry.CreateSubComponent( siVertexCluster, Array(3,4,5) )
Application.LogMessage oSubComponent
' Add the vertex at index 6 to the subcomponent
oSubComponent.AddElement 6
Application.LogMessage oSubComponent
' No change to the SubComponent since the vertex at index 4 is already part of it
oSubComponent.AddElement 4
Application.LogMessage oSubComponent
' No change to the SubComponent since index 55 is not a valid vertex index
On Error Resume Next
oSubComponent.AddElement 55
Application.LogMessage Err.Description
On Error GoTo 0
' Expected results:
'INFO : MyCube.pnt[3-5]
'INFO : MyCube.pnt[3-6]
'INFO : MyCube.pnt[3-6]
'INFO : 2028 - Invalid argument specified. |