New here and to journaling in general.
Trying to automate a process for a range of motion in a sketch (NX Motion doesn't support my objective). To get a start I recorded what the process I have for entering a value change into an expression, see below.
- expressions are setup in the part file
- use excel range to change 1 - 4 expressions (start with 1)
- update the sketch based on new stepped values for the expressions
- read and export N number of expressions measuring critical features to Excel / Text tab delimited.
Being new to this, I am trying to understand the base code functions. I see where my recorded input was entered, but I didn't have a way to export the measured expressions. Those won't be in the code.
' NX 7.5.5.4
' Journal created by kdo on Tue Aug 23 14:15:15 2016 Central Daylight Time
'
Option Strict Off
Imports System
Imports NXOpen
Module NXJournal
Sub Main
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
' ----------------------------------------------
' Menu: Tools->Expression...
' ----------------------------------------------
theSession.CleanUpFacetedFacesAndEdges()
theSession.CleanUpFacetedFacesAndEdges()
theSession.CleanUpFacetedFacesAndEdges()
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Expression")
Dim expression1 As Expression = CType(workPart.Expressions.FindObject("Sheave_ax"), Expression)
Dim unit1 As Unit = CType(workPart.UnitCollection.FindObject("MilliMeter"), Unit)
workPart.Expressions.EditWithUnits(expression1, unit1, "0")
Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Update Expression Data")
Dim nErrs1 As Integer
nErrs1 = theSession.UpdateManager.DoUpdate(markId2)
theSession.DeleteUndoMark(markId2, "Update Expression Data")
Dim markId3 As Session.UndoMarkId
markId3 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Expression")
theSession.CleanUpFacetedFacesAndEdges()
' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------
End Sub
End Module