SapObject.SapModel.LoadCases.Delete
Function Delete(ByVal Name As String) As Long
Name
The name of an existing load case.
The function deletes the specified load case.
The function returns zero if the load case is successfully deleted, otherwise it returns a nonzero value.
The load case is not deleted and the function returns an error if the load case is assigned to an analysis case or if it is the only defined load case.
Sub DeleteLoadCase()
'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)
'delete analysis case
'Note: ret
in the above line returns 1, indicating an error.
'This is the case because the load case DEAD is assigned
to
'analysis case DEAD. This is also the case because the
load
'case DEAD is the only load case defined.
ret = SapModel.LoadCases.Delete("DEAD")
'Note: ret
in the above line returns 1, indicating an error. This is the case because
the load case DEAD is assigned to analysis case DEAD. This is also the
case because the load case DEAD is the only load case defined.
'close Sap2000
SapObject.ApplicationExit False
Set SapModel = Nothing
Set SapObject = Nothing
End Sub
Initial release in version 11.00.