Language = Visual Basic
File Format = Unicode
I created a journal to go into Properties of a file and add three attributes. However, it only seems to add the last of the three attributes. If I turn off the lines for the third attribute, it then adds the second attribute.
When doing Drafting Preferences, I could add a bunch of changes to them all in a row and it would do all of them. I figured adding attributes would be the same way but its not working out that way.
Here is what my code looks like.....
Option Strict Off
Imports System
Imports NXOpen
Module NXJournal
Sub Main (ByVal args() As String)
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start")
Dim objects3(0) As NXObject
objects3(0) = workPart
Dim attributePropertiesBuilder1 As AttributePropertiesBuilder
attributePropertiesBuilder1 = theSession.AttributeManager.CreateAttributePropertiesBuilder(workPart, objects3, AttributePropertiesBuilder.OperationType.None)
theSession.SetUndoMarkName(markId1, "Displayed Part Properties Dialog")
attributePropertiesBuilder1.Title = "F_ENGR"
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.StringValue = "JOHN SMITH"
attributePropertiesBuilder1.Title = "F_ENGRPH"
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.StringValue = "248-555-5555"
attributePropertiesBuilder1.Title = "PROGRAM"
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.StringValue = "XXXX"
Dim nXObject1 As NXObject
nXObject1 = attributePropertiesBuilder1.Commit()
attributePropertiesBuilder1.Destroy()
' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------
End Sub
End Module
I know the change will be simple but I just dont know Journal well enough yet to see what I need to change or add.
Also, I will likely be adding more attributes in the future, if that makes any difference.
Thanks
File Format = Unicode
I created a journal to go into Properties of a file and add three attributes. However, it only seems to add the last of the three attributes. If I turn off the lines for the third attribute, it then adds the second attribute.
When doing Drafting Preferences, I could add a bunch of changes to them all in a row and it would do all of them. I figured adding attributes would be the same way but its not working out that way.
Here is what my code looks like.....
Option Strict Off
Imports System
Imports NXOpen
Module NXJournal
Sub Main (ByVal args() As String)
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start")
Dim objects3(0) As NXObject
objects3(0) = workPart
Dim attributePropertiesBuilder1 As AttributePropertiesBuilder
attributePropertiesBuilder1 = theSession.AttributeManager.CreateAttributePropertiesBuilder(workPart, objects3, AttributePropertiesBuilder.OperationType.None)
theSession.SetUndoMarkName(markId1, "Displayed Part Properties Dialog")
attributePropertiesBuilder1.Title = "F_ENGR"
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.StringValue = "JOHN SMITH"
attributePropertiesBuilder1.Title = "F_ENGRPH"
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.StringValue = "248-555-5555"
attributePropertiesBuilder1.Title = "PROGRAM"
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.StringValue = "XXXX"
Dim nXObject1 As NXObject
nXObject1 = attributePropertiesBuilder1.Commit()
attributePropertiesBuilder1.Destroy()
' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------
End Sub
End Module
I know the change will be simple but I just dont know Journal well enough yet to see what I need to change or add.
Also, I will likely be adding more attributes in the future, if that makes any difference.
Thanks