Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I created a spectral case with points using the Robot API, and the Case.Records.Count shows the correct number of points. However, when I try to retrieve the points using Spectrum.Points.Count, it always returns 0. How can I correctly access the points of an existing spectrum via the API?
Code:
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 SeismicCase As RobotSimpleCase
Dim SeismicParams As RobotSpectralAnalysisParams
Dim Spectrum As RobotSpectralAnalysisSpectrum
' Set up the Robot Structure Cases
Set RobotServerCas = robApp.Project.Structure.cases
' Find the first seismic case
Dim i As Integer
For i = 1 To RobotServerCas.GetAll().Count
Dim robotCase As IRobotCase
Set robotCase = RobotServerCas.Get(i)
If robotCase.Nature = I_CN_SEISMIC Then
Set SeismicCase = robotCase
Exit For
End If
Next i
' Validate if a seismic case was found
If SeismicCase Is Nothing Then
MsgBox "Error: Could not find a seismic case.", vbCritical, "Error"
Exit Sub
End If
' Get the analysis parameters and spectrum
Set SeismicParams = SeismicCase.GetAnalysisParams()
Set Spectrum = SeismicParams.Spectrum
' Check the point count
Dim PointCount As Long
PointCount = Spectrum.Points.Count
Any help would be appreciated!
Solved! Go to Solution.