use of variable type NormalMode?

To all

I am looking at extracting the modal properties from a response simulation. According to the doc this is done via the function

CAE.ResponseSimulation.ModalProperties.GetNormalModes
Public Function GetNormalModes As NormalMode()

However no matter how I try to define my return variable, NX does not reconise the variable type: NormalMode. Could someone tell my what I am doing wrong ?

I have set up my test as follows

Function GetEffectiveMass()

Dim theSimPart As CAE.SimPart = theSession.Parts.BaseWork
Dim thesimulation As CAE.SimSimulation = theSimPart.Simulation()
Dim theActiveRespSim As CAE.ResponseSimulation.Solution

Dim sRespSimSolName As String = "myRespSim1"
theActiveRespSim = CType(theSimPart.Simulation.ResponseSimulationManager.Solutions.FindObject(sRespSimSolName), CAE.ResponseSimulation.Solution)
thesimulation.ResponseSimulationManager.Solutions.ActiveSolution = theActiveRespSim
'CAE.ResponseSimulation.ModalProperties

Dim arrNmodes() As NormalMode = CAE.ResponseSimulation.ModalProperties.GetNormalModes
'Get the GetXMass(), GetYMass(), GetZMass() for each mode
For Each theNmode As NormalMode In arrNmodes
Dim dXmass As Double = theNmode.GetXmass()
Dim dYmass As Double = theNmode.GetYmass()
Dim dZmass As Double = theNmode.GetZmass()

REM TheLW.WriteLine("Xmass is: " & dXMass.ToString)
REM TheLW.WriteLine("Ymass is: " & dXMass.ToString)
REM TheLW.WriteLine("Zmass is: " & dXMass.ToString)
Next theNMode

End Function

Thanks
Regards

You probably need to tell the compiler what namespace the "NormalMode" type lives in. Try declaring the variable with the full name (similar to what you did for the "theSimulation" and "theActiveRespSim" variables):

Dim arrNmodes() as CAE.ResponseSimulation.NormalMode = ...

Thanks. Never thought of that and just tried
I am getting the (compile) error: Reference to a non-shared member requires an object reference

Thanks
Regards

Which line of code does the error message indicate as causing the problem?

Edit: nevermind, I think I see the problem. In the following line:

Dim arrNmodes() As NormalMode = CAE.ResponseSimulation.ModalProperties.GetNormalModes

You will need to call the ".GetNormalModes" method of a specific response simulation object; something like:

Dim arrNmodes() As NormalMode = someResponseSimulation.ModalProperties.GetNormalModes

it seems that Nx does not like the variable definition as given in the doc.
if one just define Dim arrNmodes() As NormalMode then one gets variable not defined
if one tries Dim arrNmodes() as CAE.ResponseSimulation.NormalMode then one gets Reference to a non-shared member requires an object reference

I have "extended" the test to try to get the modal properties GetModalProperties() and one has the same issue. I struggle to understand the doc

Dim theSimPart As CAE.SimPart = theSession.Parts.BaseWork
Dim theRespSimManager As CAE.ResponseSimulation.Manager = theSimPart.Simulation.ResponseSimulationManager
Dim thesimulation As CAE.SimSimulation = theSimPart.Simulation()

Dim sRespSimSolName As String = "myRespSim1"
Dim theActiveRespSim As CAE.ResponseSimulation.Solution

theActiveRespSim = CType(theRespSimManager.Solutions.FindObject(sRespSimSolName), CAE.ResponseSimulation.Solution)
thesimulation.ResponseSimulationManager.Solutions.ActiveSolution = theActiveRespSim

Dim arrNmodes() As CAE.ResponseSimulation.NormalMode = theActiveRespSim.ModalProperties.GetNormalModes
'Get the GetXMass(), GetYMass(), GetZMass() for each mode
For Each theNmode As CAE.ResponseSimulation.NormalMode In arrNmodes
Dim dXmass As Double = theNmode.GetXmass()
Dim dYmass As Double = theNmode.GetYmass()
Dim dZmass As Double = theNmode.GetZmass()

TheLW.WriteLine("Xmass is: " & dXMass.ToString)
TheLW.WriteLine("Ymass is: " & dXMass.ToString)
TheLW.WriteLine("Zmass is: " & dXMass.ToString)
Next theNMode

'get modal properties
Dim theModalProperties As ModalProperties = theActiveRespSim.GetModalProperties()

Thanks
Regards

Just realised that the code provided in my previous response was not "properly" tested (as I may have forgotten to save before a new test). Having just done so I am now getting the (compile) error: ModalProperties is not a member of CAE.ResponsSimulation.Solution which must be linked to the fact that I am trying to access the data using
theActiveRespSim.ModalProperties.GetNormalModes where theActiveRespSim is a CAE.ResponseSimulation.Solution

The doc states that ModalProperties represents the modal presentation of a response analysis meta solution. I suspect this refer to the 'SOL103 response simulation' (solution) selected when setting up the response simulation but I just cannot make sense on how to access the solution "attached" to the resp sim

Thanks
Regards