my question is showing my very limited of vba programming but I have to ask. It is related to a previously posted query:
While looping throught the Respponse Simulation (the solutions) (or the RSEvent) I would like to check which event is active. The following function (property) should do it but I can't figure out how to set it up
Public Property ActiveEvent As RSEvent Get Set
Any help in expanding my very limited vba knowledge is welcome
Solved! Go to Solution.
Option Strict Off
Sub Main (ByVal args() As String)
Dim theSession As Session = Session.GetSession()
Dim workSimPart As CAE.SimPart = CType(theSession.Parts.BaseWork, CAE.SimPart)
Dim displaySimPart As CAE.SimPart = CType(theSession.Parts.BaseDisplay, CAE.SimPart)
'Change it as accordingly.
Dim solution1 As CAE.ResponseSimulation.Solution = CType(workSimPart.Simulation.ResponseSimulationMan
Dim simSimulation1 As CAE.SimSimulation = CType(workSimPart.FindObject("Simulation"), CAE.SimSimulation)
'Make this response solution active.
Dim rSEvent1 As CAE.ResponseSimulation.RSEvent
'Gets the active event.
rSEvent1 = solution1.ActiveEvent
Dim rSEvent2 As CAE.ResponseSimulation.RSEvent
rSEvent2 = solution1.CloneEvent(rSEvent1, Nothing)
'Sets the active event.
solution1.ActiveEvent = rSEvent1
thansk for that. The test below seems to work
Dim strRSSolName as String = "RespSim1" 'user Input Dim pathAFUFile as String Dim RespSimSolFound As CAE.ResponseSimulation.Solution Dim RespSimEventFound As CAE.ResponseSimulation.RSEvent Dim rSEvent1 As CAE.ResponseSimulation.RSEvent Dim theSimPart As CAE.SimPart = CType(theSession.Parts.BaseWork, CAE.SimPart) Dim theRespSimManager As NXOpen.CAE.ResponseSimulation.Manager = theSimPart.Simulation.ResponseSimulationManager Dim AllRespSimSolutions As CAE.ResponseSimulation.Solution() = theRespSimManager.Solutions.ToArray() 'Search for active event For Each myRespSimCol As CAE.ResponseSimulation.Solution In AllRespSimSolutions If myRespSimCol.GetSolutionName = strRSSolName Then RespSimSolFound = myRespSimCol 'Gets the active event. RespSimEventFound = RespSimSolFound.ActiveEvent theLW.WriteLine("the active event is: " & RespSimEventFound.GetEventName) Exit For End if End Function