Message 1 of 5
API Spectral Eccentricity Access
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm working on automating spectrum entry in Robot Structural Analysis. Below is the complete code I’ve written to help our community in the future.
Recently, in the latest RSA version, a new feature was added to seismic cases (eccentricity, as shown in the image). However, I couldn’t find a way to access this feature via the API.
Does anyone know if it has been implemented in the API? If not, how can we contact the development team to request its implementation?
Thank you!
Sub GenerateSpectralCases2()
' Declare and initialize the Robot application variable
Dim robApp As IRobotApplication
Set robApp = New RobotApplication
' Declare variables for Robot case and parameters
Dim RobotServerCas As RobotCaseServer
Dim SpectralParams As RobotSpectralAnalysisParams
Dim SpectralParamsSpectrum As RobotSpectralAnalysisSpectrum
Dim SpectrumPoints As Collection
' Get the collection of load cases
Dim SpectralCase As RobotSimpleCase
Set RobotServerCas = robApp.Project.Structure.Cases
' Get the first free number for spectrum cases
Dim SpectrumCaseFreeNumber As Long
SpectrumCaseFreeNumber = RobotServerCas.FreeNumber
'Amplification Factor
Dim xFactor As Integer
Dim yFactor As Integer
Dim zFactor As Integer
xFactor = 1
yFactor = 1
zFactor = 1
' Initialize the points collection
Set SpectrumPoints = New Collection
' Populate the points collection (example: 10 points)
SpectrumPoints.Add Array(0.1, 0.02)
SpectrumPoints.Add Array(0.2, 0.04)
SpectrumPoints.Add Array(0.3, 0.06)
SpectrumPoints.Add Array(0.4, 0.08)
SpectrumPoints.Add Array(0.5, 0.1)
SpectrumPoints.Add Array(0.6, 0.18)
SpectrumPoints.Add Array(0.7, 0.06)
SpectrumPoints.Add Array(0.8, 0.04)
SpectrumPoints.Add Array(0.9, 0.02)
SpectrumPoints.Add Array(1#, 0.01)
' ---- Create Spectral Case for X Direction ----
Set SpectralCase = RobotServerCas.CreateSimple(SpectrumCaseFreeNumber, "Spectrale Dir. masses X", I_CN_SEISMIC, I_CAT_DYNAMIC_SPECTRAL)
Set SpectralParams = SpectralCase.GetAnalysisParams
Set SpectralParamsSpectrum = SpectralParams.Spectrum
' Clear existing points and add new points from the collection
Call AddPointsToSpectrum(SpectralParamsSpectrum, SpectrumPoints)
' Set additional spectrum parameters
SpectralParams.Spectrum.name = "SpectrumRPA24-X" 'Name the case "we could do it in the creation"
SpectralParams.Spectrum.Damping = 0.1 'Apply Dumping "l'Amortissement"
SpectralParams.Spectrum.AbscissaXAxis = I_SAAXAT_PERIOD ' Set X-axis type (Period)
SpectralParams.Spectrum.OrdinateYAxis = I_SAOYAT_ACCELERATION ' Set Y-axis type (Acceleration)
SpectralParams.ExcitationDir.X = 9.81 * xFactor ' Apply the direction of the force
SpectralParams.ExcitationDir.Y = 0
SpectralParams.ExcitationDir.Z = 0
' Apply the Spectrale Parameters to the case
SpectralCase.SetAnalysisParams SpectralParams
' ---- Create Spectral Case for Z Direction ----
Set SpectralCase = RobotServerCas.CreateSimple(SpectrumCaseFreeNumber + 1, "Spectrale Dir. masses Y", I_CN_SEISMIC, I_CAT_DYNAMIC_SPECTRAL)
Set SpectralParams = SpectralCase.GetAnalysisParams
Set SpectralParamsSpectrum = SpectralParams.Spectrum
' Clear existing points and add new points from the collection
Call AddPointsToSpectrum(SpectralParamsSpectrum, SpectrumPoints)
' Set additional spectrum parameters
SpectralParamsSpectrum.name = "SpectrumRPA24-Y"
SpectralParams.ExcitationDir.X = 0
SpectralParams.ExcitationDir.Y = 9.81 * yFactor '
SpectralParams.ExcitationDir.Z = 0
' Apply the Spectrale Parameters to the case
SpectralCase.SetAnalysisParams SpectralParams
' ---- Create Spectral Case for Z Direction ---- "If needed"
Set SpectralCase = RobotServerCas.CreateSimple(SpectrumCaseFreeNumber + 2, "Spectrale Dir. masses Z", I_CN_SEISMIC, I_CAT_DYNAMIC_SPECTRAL)
Set SpectralParams = SpectralCase.GetAnalysisParams
Set SpectralParamsSpectrum = SpectralParams.Spectrum
' Clear existing points and add new points from the collection
Call AddPointsToSpectrum(SpectralParamsSpectrum, SpectrumPoints)
' Set additional spectrum parameters
SpectralParamsSpectrum.name = "SpectrumRPA24-Z"
SpectralParams.ExcitationDir.X = 0
SpectralParams.ExcitationDir.Y = 0
SpectralParams.ExcitationDir.Z = 9.81 * zFactor
' Apply the Spectrale Parameters to the case
SpectralCase.SetAnalysisParams SpectralParams
' ---- Notify the user ----
MsgBox "Spectral cases created successfully!", vbInformation, "Success"
End Sub