SubComponent.AddElement

Description

Adds an element to the SubComponent using its index. All subelements can be added except isolines and isopoints (because those are not indexable subelements). That means that if you want to add a Vertex to a cluster of type siVertexCluster (from the ClusterTypes enum) you call AddElement with the index of the Vertex in the Geometry.

C# Syntax

SubComponent.AddElement( Object in_Elem );

Scripting Syntax

SubComponent.AddElement( Element );

Parameters

Parameter Type Description
Element Variant Index of the element that we want to add to the SubComponent element.

Examples

VBScript Example

'
' 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.