Showing results for 
Search instead for 
Did you mean: 

Dealing with no 'BeamElementForce' for an element (in an Resp. Sim.)

Gears Phenom Gears Phenom
Gears Phenom

To all,


I have a macro which aim to extract the result '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 the output does nto exits)


[RSEvent1.EvaluateElementalFunctionResponse(elementalFunctionEvaluationSetting1) ]


Any suggestion welcome in helping to expand my (NX) vba knowledge


Thanks in advance




Dim RespSimSolFound As CAE.ResponseSimulation.Solution

For Each RSEvent1 As CAE.ResponseSimulation.RSEvent In RespSimSolFound.GetEvents()


elementalFunctionEvaluationSettingBuilder1.ResultType = CAE.ResponseSimulation.EvaluationResultType.BeamElementForce

Select Case LoopID

Case 1
 elementalFunctionEvaluationSettingBuilder1.DataComponent = CAE.ResponseSimulation.DirectionDataComponent.Ax

Case 2
 elementalFunctionEvaluationSettingBuilder1.DataComponent = CAE.ResponseSimulation.DirectionDataComponent.Sy

Case 3
 elementalFunctionEvaluationSettingBuilder1.DataComponent = CAE.ResponseSimulation.DirectionDataComponent.Sz

End Select


Dim nXObject1 As NXObject
nXObject1 = elementalFunctionEvaluationSettingBuilder1.Commit()
Dim elementalFunctionEvaluationSetting1 As CAE.ResponseSimulation.ElementalFunctionEvaluationSetting = CType(nXObject1, CAE.ResponseSimulation.ElementalFunctionEvaluationSetting)

Next RSEvent1


Production: NX.CAE, NX.CAE
Development: VB.NET (amateur level !)

Re: Dealing with no 'BeamElementForce' for an element (in an Resp. Sim.)

Gears Phenom Gears Phenom
Gears Phenom

just managed to come back to my problem (got distracted by real work!)

Looks like a simple 'Try..Catch' loop does the job


Dim nXObject1 As NXObject
nXObject1 = ElmFnEvalSettingBuilder1.Commit()			
Dim ElmlFnEvalSetting1 As CAE.ResponseSimulation.ElementalFunctionEvaluationSetting = CType(nXObject1, CAE.ResponseSimulation.ElementalFunctionEvaluationSetting)


Catch ex As Exception
 theLW.WriteLine("--No results exist for the Element ID specified.")

 'Dim Msg as String = "--No results exist for element ID: " & theFEElm.Label
 'Dim Title as String = "The Title here"
 'MsgBox(Msg, vbOKOnly + vbCritical, Title)
 'theNXMessageBox.Show(Title, NXMessageBox.DialogType.Error, ex.ToString)

 Return FinalDataEmpty
End Try




Production: NX.CAE, NX.CAE
Development: VB.NET (amateur level !)