cancel
Showing results for 
Search instead for 
Did you mean: 

resultParameter.SetUnit for stress?

Phenom
Phenom

To all

 

I have a bit of code that I am tryign to change to deal with stress result. The original code has the following lines

 

Dim unit_length As Unit = Nothing
If part.PartUnits() = BasePart.Units.Millimeters Then unit_length = CType(part.UnitCollection.FindObject("MilliMeter"), Unit) Else unit_length = CType(part.UnitCollection.FindObject("Inch"), Unit) End If

and later

resultParameter.SetUnit(unit_length)

I want to change this for stress result (MPa or psi) so tried the "obvious"

Dim unit_stress As Unit = Nothing
If part.PartUnits() = BasePart.Units.Millimeters Then
	unit_stress = CType(part.UnitCollection.FindObject("MPa"), Unit)
Else
	unit_stress = CType(part.UnitCollection.FindObject("psi"), Unit)
End If

and then

resultParameter.SetUnit(unit_stress)

but NX states that no object found with this name

 

Questions are

1. Do I have to resultParameter.SetUnit to as part of GetResultAccess()?

2. How do I find the "correct" name(s) needed for the FindObject()?

 

Thanks

Regards

 

 

 

 

 

 

 

 

 

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

Re: resultParameter.SetUnit for stress?

Phenom
Phenom

http://nxjournaling.com/content/units

 

Run the second journal on the page, it will list all the available units and their corresponding names.

Re: resultParameter.SetUnit for stress?

Phenom
Phenom

Thanks for the link. Will have a look. The unit might be the issue in my function to get access to the results

 

 Function GetResultAccess(ByRef results As CAE.Result, _
			ByVal loadCaseIdx As Integer, _
			ByVal iterationIdx As Integer, _ 
			ByVal scale As Double) As CAE.ResultAccess

where I have the lines

Try
	Dim solResultsAccess As CAE.ResultAccess = theResultManager.CreateResultAccess(results, resultParameter)
	solResultsAccess.SetParameters(resultParameter)
	Return solResultsAccess
Catch ex As Exception

 Return Nothing

End Try

the function never returns anything so I never get access to the result! No good

 

 

 

 

 

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

Re: resultParameter.SetUnit for stress?

Phenom
Phenom

Thanks. used the link to test and found the correct keyword

 

Dim unit_stress As Unit = Nothing

If part.PartUnits() = BasePart.Units.Millimeters Then
  unit_stress = CType(part.UnitCollection.FindObject("MilliNewtonPerSquareMilliMeter"), Unit)
Else
  unit_stress = CType(part.UnitCollection.FindObject("PoundForcePerSquareInch"), Unit)
End If

 

I still cannot get my function getaccessresult() working. So might not be related to the result units

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