Cancel
Showing results for 
Search instead for 
Did you mean: 

To watch the value of an Nx expression parameter externaly

Creator
Creator

Hello,

Is there a way to get the value of an expression parameter when it is changed? I have a measurement object and it has a related parameter that contains the measurement value. External program should get the value of measurement when it is changed. Journals does not seem appropriate because Ansys Workbench optimisation cycle drives Nx.

Thanks in advance

 

3 REPLIES

Re: To watch the value of an Nx expression parameter externaly

Valued Contributor
Valued Contributor

You can set the measurement through coding and get the measurement.

here is the code.

 

Dim nullNXObject As NXObject = Nothing
Dim measureDistanceBuilder1 As MeasureDistanceBuilder
measureDistanceBuilder1 = workPart.MeasureManager.CreateMeasureDistanceBuilder(nullNXObject)
measureDistanceBuilder1.Mtype = MeasureDistanceBuilder.MeasureType.Maximum
Dim unit1 As Unit = CType(workPart.UnitCollection.FindObject("MilliMeter"), Unit)

 

Dim ZeroPoint As Point = 'Your Point'
measureDistanceBuilder1.Object1.Value = ZeroPoint

Dim body1 As Body = 'Your soldi body'
measureDistanceBuilder1.Object2.Value = body1

Dim measureDistance1 As MeasureDistance
measureDistance1 = workPart.MeasureManager.NewDistance(unit1, MeasureManager.MeasureType.Maximum, measureDistanceBuilder1.Object1.Value, measureDistanceBuilder1.Object2.Value)

 

'HERE YOU GET THE INFO

'--------------------------------------------------------------

msgbox(measureDistance1.Value)

'--------------------------------------------------------------

measureDistance1.Dispose()

measureDistanceBuilder1.Destroy()

Re: To watch the value of an Nx expression parameter externaly

Creator
Creator
Thank you but the main problem the whole proccess is executed automatically by the Ansys Workbench Optimisation Tool. Therefore there should be a way that after sending the new parameter set to Nx by Ansys, Nx should know to run the journal file which I think imposible. As a solution I hope there is a kind of a log file which already contains all the expression parameters.
Thanks

Re: To watch the value of an Nx expression parameter externaly

Valued Contributor
Valued Contributor

I am not getting what you want exactly. I am not a Ansys user, but I think you will get a log file for all the parameters you deal with.