To all,
I have a macro which aim to extract the results 'BeamElementForce' for a given element in a Response Simulation (Event = transient). I am getting there but I am thinking about catching errors. At the moment I want to "catch" the fact that for the following user supplied data;
1. Response Simulation specified =Exists
2. Event specified = Exists
3. Element specified = Exists
there is no result 'BeamElementForce' available. In other words it's all good until the last step when the macro needs to extract the data
I have pasted an extract of the code I have developed so far (might not be pretty but it works!)
Maybe there a way of using a "Catch...try" where the code tries to create the response function as it might fail (as teh output does nto exits) [RSEvent1.EvaluateElementalFunctionResponse(elementalFunctionEvaluationSetting1) ]
Any suggestion welcome.
Thanks in advance
JXB
'----------------------------------------------------
Dim RespSimSolFound As CAE.ResponseSimulation.Solution = CType(ChooseOneItem("Solution to analyze", workSimPart.Simulation.ResponseSimulationManager.Solutions.ToArray()), CAE.ResponseSimulation.Solution)
For Each RSEvent1 As CAE.ResponseSimulation.RSEvent In RespSimSolFound.GetEvents()
theSession.DataManager.LoadFile("pathAFUFile"& RSEvent1.GetEventName & ".afu")
theLW.WriteLine("Processing Event: " & RSEvent1.GetEventName)
elementalFunctionEvaluationSettingBuilder1.ResultType = CAE.ResponseSimulation.EvaluationResultType.BeamElementForce
Select Case LoopID
Case 1
theLW.WriteLine("--Loop ID: " & LoopID.ToString & " Selecting AX force")
elementalFunctionEvaluationSettingBuilder1.DataComponent = CAE.ResponseSimulation.DirectionDataComponent.Ax
Case 2
theLW.WriteLine("--Loop ID: " & LoopID.ToString & " Selecting SY force")
elementalFunctionEvaluationSettingBuilder1.DataComponent = CAE.ResponseSimulation.DirectionDataComponent.Sy
Case 3
theLW.WriteLine("--Loop ID: " & LoopID.ToString & " Selecting SZ force")
elementalFunctionEvaluationSettingBuilder1.DataComponent = CAE.ResponseSimulation.DirectionDataComponent.Sz
End Select
elementalFunctionEvaluationSettingBuilder1.SetDestinationElements(destinationElements1)
Dim nXObject1 As NXObject
nXObject1 = elementalFunctionEvaluationSettingBuilder1.Commit()
Dim elementalFunctionEvaluationSetting1 As CAE.ResponseSimulation.ElementalFunctionEvaluationSetting = CType(nXObject1, CAE.ResponseSimulation.ElementalFunctionEvaluationSetting)
RSEvent1.EvaluateElementalFunctionResponse(elementalFunctionEvaluationSetting1)
Next RSEvent1