Showing results for 
Search instead for 
Do you mean 
Reply

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

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

 

JXB

 

'----------------------------------------------------
Dim RespSimSolFound As CAE.ResponseSimulation.Solution

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

theSession.DataManager.LoadFile(pathAFUFile)

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

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

 

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)
1 REPLY

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

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

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

 

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


Try

 RSEventToProcess.EvaluateElementalFunctionResponse(ElmlFnEvalSetting1)
 
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

 Regards

 

JXB

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)