SapObject.SapModel.InitializeNewModel
Function InitializeNewModel(Optional ByVal Units As eUnits = kip_in_F) As Long
Units
This is the database units for the new model. All data is internally stored in the model in these units. The units are one of the following items in the eUnits enumeration:
lb_in_F = 1
lb_ft_F = 2
kip_in_F = 3
kip_ft_F = 4
kN_mm_C = 5
kN_m_C = 6
kgf_mm_C = 7
kgf_m_C = 8
N_mm_C = 9
N_m_C = 10
Ton_mm_C = 11
Ton_m_C = 12
kN_cm_C = 13
kgf_cm_C = 14
N_cm_C = 15
Ton_cm_C = 16
This function clears the previous model and initializes the program for a new model. If it is later needed, you should save your previous model prior to calling this function.
After calling the InitializeNewModel function, it is not necessary to also call the ApplicationStart function because the functionality of the ApplicationStart function is included in the InitializeNewModel function.
The function returns zero if a new model is successfully initialized, otherwise it returns a nonzero value.
Sub InitializeNewModel()
'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(kip_ft_F)
'create model from template
ret = SapModel.File.New2DFrame(ConcentricBraced,
3, 12, 3, 30)
'save model
ret = SapModel.File.Save("C:\SapAPI\MyFirstSapModel.sdb")
'initialize new model
SapModel.InitializeNewModel(kN_m_C)
'create model from template
ret = SapModel.File.New3DFrame(FlatPlate,
2, 4, 2, 10, 4, 10, False, , , , 2, 2)
'save model
ret = SapModel.File.Save("C:\SapAPI\MySecondSapModel.sdb")
'close Sap2000
SapObject.ApplicationExit False
Set SapModel = Nothing
Set SapObject = Nothing
End Sub
Initial release in version 11.00.