I just started journaling and I am trying to understand the cause (and meaning) of three
- Dim expressionGroup1 As NXOpen.ExpressionGroup
expressionGroup1 = workPart.ExpressionGroups.Active
(NX seems to activate ALL expression groups of the workpart...why there are so many (up to 300?)?
Is there a method to activate all of them?
-Dim markId4 As NXOpen.Session.UndoMarkId
markId4 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Expression")
(At random places it declares markIDs...my understandig of it is to eliminate all undo-marks of the steps so far?)
-Dim nErrs4 As Integer
nErrs4 = theSession.UpdateManager.DoUpdate(markId6)
(generating an Error-number as Integer for markId6 in this case? for what?)
An explanation would be very helpful, for those components seem to be part of every generated journal.
Which components are redundant for a functioning code?
Thanks a lot!
I'm not sure about the first as I've not worked with ExpressionGroups.
For the second: yes, there are a bunch of undo marks included in recorded journals that are not needed. You can typically delete most/all of these. You probably want to set one at the beginning of your journal execution so that you can easily undo whatever your journal does. You may also want to set additional undo marks if you are updating in a loop (see below)
Update.DoUpdate() will attempt to update the session. The integer return value tells you how many errors were generated. If there are any errors that prevent the update from completing, the session is rolled back to the undo mark specified in the argument list.