Pregunta:
¿Cómo puedo crear excentricidades de barras en RS-COM?
Respuesta:
La siguiente macro de VBA muestra la creación de dos excentricidades de barra. El código fuente se puede encontrar en Descargas.
' ----------------------------------------------- -------------------------------------------------- -
Sub SetEccs ()
' ----------------------------------------------- -------------------------------------------------- -
Modelo atenuado Como modelo RSTAB8
Atenuar datos como IModelData
Dim ecc (1) Como RSTAB8.MemberEccentricity
' Obtener la interfaz para el modelo
Establecer modelo = GetObject (, "RSTAB8.Model")
' Bloquear la licencia COM y el acceso al programa
model.GetApplication.LockLicense
On Error GoTo e
' Obtener la interfaz para los datos del modelo
Set data = model.GetModelData
'Define eccentricity 1
ecc(0).No = 1
ecc(0).ReferenceSystem = LocalSystemType
ecc(0).Start.X = 0.01
ecc(0).Start.Y = 0.02
ecc(0).Start.Z = 0.03
ecc(0).End.X = -0.01
ecc(0).End.Y = -0.02
ecc(0).End.Z = -0.03
ecc(0).Comment = "eccentricity 1"
'Define eccentricity 2
ecc(1).No = 2
ecc(1).ReferenceSystem = GlobalSystemType
ecc(1).Start.X = -0.07
ecc(1).Start.Y = -0.08
ecc(1).Start.Z = -0.09
ecc(1).End.X = 0.07
ecc(1).End.Y = 0.08
ecc(1).End.Z = 0.09
ecc(1).Comment = "eccentricity 2"
'Transfer member eccentricities
data.PrepareModification
data.SetMemberEccentricities ecc
e: data.FinishModification
If Err.Number 0 Then MsgBox Err.Description, , Err.Source
Set data = Nothing
' COM licence is unlocked, program access possible again
model.GetApplication.UnlockLicense
Set model = Nothing
End Sub