SapObject.SapModel.ConstraintDef.Count
Function Count(Optional ConstraintType As eConstraintType) As Long
ConstraintType
This optional value is one of the following items in the eConstraintType enumeration.
CONSTRAINT_BODY = 1
CONSTRAINT_DIAPHRAGM = 2
CONSTRAINT_PLATE = 3
CONSTRAINT_ROD = 4
CONSTRAINT_BEAM = 5
CONSTRAINT_EQUAL = 6
CONSTRAINT_LOCAL = 7
CONSTRAINT_WELD = 8
CONSTRAINT_LINE = 13
If the ConstraintType item is specified, the function returns the number of defined constraints of the specified type. Otherwise it returns the total number of defined constraints without regard for type.
Sub CountConstraints()
'dimension variables
Dim SapObject As Sap2000.SapObject
Dim SapModel As cSapModel
Dim ret as Long
'create Sap2000 object
Set SapObject = New SAP2000.SapObject
'start Sap2000 application
SapObject.ApplicationStart
'create SapModel object
Set SapModel = SapObject.SapModel
'initialize model
ret = SapModel.InitializeNewModel
'create model from template
ret = SapModel.File.New2DFrame(PortalFrame,
3, 124, 3, 200)
'return number of defined constraints
ret = SapModel.ConstraintDef.Count
'close Sap2000
SapObject.ApplicationExit False
Set SapModel = Nothing
Set SapObject = Nothing
End Sub
Initial release in version 11.00.