Is there anyway to extract Output File Units i.e. Force, Length and Mass available in solution. I have trired the below API to extract and it works fine when solver is Nastran but fails when solver is ANSYS. Can help me out to solve this.
soln = workSimPart.Simulation.ActiveSolution
Please see the attched for more info.
Solved! Go to Solution.
Have you tried recording the action and then look into the recorded code?
You need to know which String to feed to the 'GetStringPropertyValue' api in the case of ANSYS.
While it is called "Mass" in Nastran, it's probably called something different in ANSYS.
I recorded the action:
I'm not familiar with the ANSYS specifics in NX, but it looks like the units are set via an integer.
Dim caeDataContainer1 As NXOpen.CAE.CaeDataContainer = Nothing caeDataContainer1 = theSession.CaeSession.GetDataContainer() caeDataContainer1.AddInteger("units", 8)
If you look at the screenshot, the unit I selected ((N)(mm)(tonne)) is the 9th listed. Given the 0 based indexing, I assume that you specify the units via the integer and that you can choose from the list in the screenshot.
Thnaks for the reply,
Dim caeDataContainer1 As NXOpen.CAE.CaeDataContainer = Nothing caeDataContainer1 = theSession.CaeSession.GetDataContainer() caeDataContainer1.AddInteger("units", 8
But the above api will set the units of solution what I requred is to get the units of the active solution. IS there any way I can extarct units from ACtive existing solution.
Yes I am looking for some thing like this. But CaeDataconatiner is not linked in any way with solution.
This will only work when we set some value. Is there any way to get existing data conayiner from solution?
Dim IntegerForUnits As Integer = caeDataContainer1.GetInteger("units")
This block of code will show you the IntegerPropertyValue:
Dim theSession As NXOpen.Session = NXOpen.Session.GetSession() Dim workSimPart As NXOpen.CAE.SimPart = CType(theSession.Parts.BaseWork, NXOpen.CAE.SimPart) Dim simSimulation1 As NXOpen.CAE.SimSimulation = CType(workSimPart.FindObject("Simulation"), NXOpen.CAE.SimSimulation) Dim simSolution1 As NXOpen.CAE.SimSolution = CType(simSimulation1.FindObject("Solution[Solution 1]"), NXOpen.CAE.SimSolution) Dim theLW As ListingWindow = theSession.ListingWindow() theLW.Open() Dim MyString As String = Nothing For ii As Integer = 0 To 1000 Try MyString = simSolution1.SolverOptionsPropertyTable.GetPropertyNameByIndex(ii) theLW.WriteFullline(MyString & "= " & simSolution1.SolverOptionsPropertyTable.GetIntegerPropertyValue(MyString)) Catch ex As Exception End Try Next
Changing the units, you will notice the change in Output File Units= 1
You can do similar things for StringPropertyValue, GetScalarPropertyValue,...
Hope this answers your question.