UG NX 10 - Export or Link Measurements?
UG NX 10 - Export or Link Measurements?
(OP)
Hey, is there a way to export a measurement value or multiple measurements to txt or xls file?
I have a linkage assembly together where I am changing the length of 1 part and when I do this, it automatically changes the entire assembly layout because it is fully constrained. As it changes, I am monitoring several measurements in the assembly and then recording them on a notepad.
Rather than manually record the measurements, could I somehow select all of the measurements and have them export or link to another document? Even if I have to copy/paste the output, it would still save a ton of time.
I have a linkage assembly together where I am changing the length of 1 part and when I do this, it automatically changes the entire assembly layout because it is fully constrained. As it changes, I am monitoring several measurements in the assembly and then recording them on a notepad.
Rather than manually record the measurements, could I somehow select all of the measurements and have them export or link to another document? Even if I have to copy/paste the output, it would still save a ton of time.





RE: UG NX 10 - Export or Link Measurements?
How do you feel about using a journal? The journal below will look for measurement features in the work part and write them to the info window. You could then do a file -> save-as on the info window to save it to a text file or copy & paste values as needed.
CODE
Option Strict Off Imports System Imports NXOpen Imports NXOpen.UF Module Module1 Dim theSession As Session = Session.GetSession() Dim theUfSession As UFSession = UFSession.GetUFSession() Dim theUI As UI = UI.GetUI() Dim lw As ListingWindow = theSession.ListingWindow Sub Main() Dim markId1 As Session.UndoMarkId markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "NXJ") lw.Open() For Each temp As Features.Feature In theSession.Parts.Work.Features If TypeOf (temp) Is NXOpen.Measure Then lw.WriteLine(temp.GetFeatureName) If Not String.IsNullOrEmpty(temp.Name) Then lw.WriteLine(" " & temp.Name) End If Dim measureExps() As Expression = temp.GetExpressions For Each tempExp As Expression In measureExps Select Case tempExp.Type Case Is = "Number" 'lw.WriteLine("value (base part units): " & tempExp.Value.ToString) Try lw.WriteLine(tempExp.GetValueUsingUnits(Expression.UnitsOption.Expression).ToString & " " & tempExp.Units.Abbreviation) Catch ex As NullReferenceException 'lw.WriteLine("expression is constant (unitless)") Catch ex2 As Exception 'lw.WriteLine("!! error: " & ex2.Message) End Try Case Else 'lw.WriteLine("Type: " & tempExp.Type & " is not handled by this journal") End Select Next lw.WriteLine("") End If Next lw.Close() End Sub Public Function GetUnloadOption(ByVal dummy As String) As Integer 'Unloads the image immediately after execution within NX GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately End Function End Modulewww.nxjournaling.com
RE: UG NX 10 - Export or Link Measurements?
RE: UG NX 10 - Export or Link Measurements?
This version is proof of concept. It would be fairly easy to change the formatting of the output or write directly to a text file.
www.nxjournaling.com
RE: UG NX 10 - Export or Link Measurements?
You can then open this file with Notepad - the drawback is it seems to only exports all expressions.
Because you would be stuck deleting a bunch of unwanted information anyway, it's probably easier/quicker to do the following:
1) Make associative measurements
2) Double click measure feature from the Part Nav
3) Measure Distance dialog (Results Display group)-> pick Show Information Window
4) Notepad window -> highlight/delete all rows except for the desired row with the measured value
5) File -> Save As -> choose location -> Save -> leave window open
6) Make adjustments to you geometry
7) Double click measure feature again from the Part Nav
8) Measure Distance dialog (Results Display group)-> pick Show Information Window again
9) Notepad window (new information populates below the previous information) -> delete all unwanted rows (now you have 2 rows of measured values)
10)File -> Save As -> overwrite... or just keep the window open and keep going and save/overwrite at the end.
This seems nuts but if you're dealing with a lot of long, run-on values, with many decimal places, this will actually be of some value.
Good luck!
Regards,
SMO (NX10)