evsa
Electrical
- Dec 6, 2011
- 10
Hello,
I currently have a method for adding a PMI note to reference a part attribute which requires the user to select the piece, search for the attribute, and place the note + leader.
This process takes a few too many steps, so I'd like to simplify it by auto-generating the note text (not necessarily the placement) via NXOpen, and have the user simply select a piece, hit a button, and get his PMI Note window pulled up with the correct text for a particular attribute.
While the above code doesn't actually do anything without some more to it, I believe it highlights the issue. Having "W!63161@" before the part attribute will only select a particular piece, and can't be used for the rest of the assembly. How do I make this work for any part?
Thank You
I currently have a method for adding a PMI note to reference a part attribute which requires the user to select the piece, search for the attribute, and place the note + leader.
This process takes a few too many steps, so I'd like to simplify it by auto-generating the note text (not necessarily the placement) via NXOpen, and have the user simply select a piece, hit a button, and get his PMI Note window pulled up with the correct text for a particular attribute.
Code:
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
Dim nullAnno As Annotations.SimpleDraftingAid = Nothing
Dim noteBuild As Annotations.PmiNoteBuilder
Dim noteText(0) As String
noteText(0) = "<W!63161@PART_ATTRIBUTE_HERE>"
noteBuild = workPart.Annotations.CreatePmiNoteBuilder(nullAnno)
noteBuild.Text.TextBlock.SetText(noteText)
End Sub
End Module
While the above code doesn't actually do anything without some more to it, I believe it highlights the issue. Having "W!63161@" before the part attribute will only select a particular piece, and can't be used for the rest of the assembly. How do I make this work for any part?
Thank You