Adding Attributes to Properties with Journal (NX9)
Adding Attributes to Properties with Journal (NX9)
(OP)
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





RE: Adding Attributes to Properties with Journal (NX9)
Where it says OBJECTS3, used to say OBJECTS1. I changed that hoping to figure this out for myself and forgot to put it back when I posted this. Sorry for any confusion.
RE: Adding Attributes to Properties with Journal (NX9)
CODE
With best regards
Michael
RE: Adding Attributes to Properties with Journal (NX9)
RE: Adding Attributes to Properties with Journal (NX9)
This is awesome journal, Is it possible to add same attributes in all components in assembly file.
Regards,
Ganesh
RE: Adding Attributes to Properties with Journal (NX9)
http://www.eng-tips.com/viewthread.cfm?qid=375494
some time ago I have similar question, and I solved it in this thread. If You have any questions, don't hesitate to post there Your questions.
With best regards
Michael