Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations 3DDave on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NX9 Journal - Appended Text

Status
Not open for further replies.

Kenja824

Automotive
Nov 5, 2014
958
I know it is easy to add an appended text to a dimension, but when you get a lot of them, it becomes annoying. So I used to have macros where you could select a dimnsion, click an icon, and it would automatically add the appended text below the dimension. I had one for each note. (REF, START, TYP, etc...)

Unfortunately those macros are not working anymore and I am trying to do this with Journal now. (Journal is attached.)

The problems I have run into is...
1) It only worked on the same kind of dimensions. I believe I fixed this by removing the "Vertical" out of the code here ....
appendedTextEditorBuilder1 = workPart.Dimensions.CreateAppendedTextEditorBuilder(CType(theUI.SelectionManager.GetSelectedObject(0), Annotations.VerticalDimension))

2) After the journal plays back, it leaves the dimension that it added the Appended Text to hi-lighted and I manually have to hit the escape button to de-select it.

My QUESTIONS..... Can I add something to the code to force it to automatically de-select the dimension? AND is there a way to make this work for selecting multiple dimensions to add the appended text to in one swoop?

Clarification.... Right now I have it set up that I select the dimension, then run the Journal. I would prefer to keep it this way, but if I have to change it to where the journal tells me to select which dimensions to add the attribute to, that would be fine. Though I have not found a way to have User commands in the middle of the journal playback like in Macros.
 
Replies continue below

Recommended for you

Kenja824 said:
Can I add something to the code to force it to automatically de-select the dimension?

There is currently no good way to deselect entities in a plain journal*; you might be able to get around this by using SendKeys to send an [kbd]Esc[/kbd] keystroke to NX.

* - There are existing Enhancement Requests (ER's) to add such functionality. If you'd like to see this in future versions of NX, you can contact GTAC and have them add you to the list (ER 1785948 and ER 1663128).

If you change the approach to make the journal prompt the user to select dimensions, it will deselect the dimensions automatically when the journal completes.

Kenja824 said:
is there a way to make this work for selecting multiple dimensions to add the appended text to in one swoop?

Yes: query the number of currently selected objects, loop through the objects adding the appended text to the dimension objects (the user may have other object types selected which you will need to ignore).

p.s. I don't see any attachment.


www.nxjournaling.com
 
The following journal is from GTAC, it demonstrates how to work with pre-selected objects. Select a few objects and run the journal, it will write some info about each object to the listing window.

Code:
'Amy Webster
'Date:  03/28/2011
'Subject:  Sample NX Open .NET Visual Basic program : report type and subtype of preselected objects
'
'Note:  GTAC provides programming examples for illustration only, and
'assumes that you are familiar with the programming language being
'demonstrated and the tools used to create and debug procedures.  GTAC
'support professionals can help explain the functionality of a particular
'procedure, but we will not modify these examples to provide added
'functionality or construct procedures to meet your specific needs.

Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpenUI

Module journal

  Sub Main
    Dim s As Session = Session.GetSession()
    Dim ufs As NXOpen.UF.UFSession = NXOpen.UF.UFSession.GetUFSession()
    Dim selobj As NXObject
    Dim type As Integer
    Dim subtype As Integer
    Dim lw As ListingWindow = s.ListingWindow

    Dim theUI As UI = ui.GetUI
    Dim numsel As Integer = theUI.SelectionManager.GetNumSelectedObjects()
    lw.Open()
    lw.WriteLine("Selected Objects: " & numsel.ToString())

    For inx As Integer = 0 To numsel-1
      selobj = theUI.SelectionManager.GetSelectedObject(inx)

      ufs.Obj.AskTypeAndSubtype(selobj.Tag, type, subtype)
      lw.WriteLine("Object: " & selobj.ToString())
      lw.WriteLine(" Tag: " & selobj.Tag.ToString())
      lw.WriteLine(" Type: " & type.ToString())
      lw.WriteLine(" Subtype: " & subtype.ToString())
      lw.WriteLine("")
    Next

    End Sub

End Module

www.nxjournaling.com
 
Sorry about not attaching the Journal. I do that in emails a lot too. lol Unfortunately, I have since accidentally recorded over it so I cant attach it now.

I am currently trying to figure out how to have Journal prompt someone to select a dimension to add appended text to. I see the pause, the user pause and the comment, but I havent yet figured out what order and which ones to use. lol
 
I closed the site I found, but someone did one very similar. The only thing was theirs asked you to type the appended text, then asked you to select all of the dimensions to add the text to, where I am making multiple Journals that will already have the text and only ask me to select the dimensions.

Also, I had to add a section that cleared any appended text before it added the right text.

Attached is a ref after I made the changes. (Yes this time I am attaching it. lol) I am sure it could be cleaned up some bt it seems to work so far. :eek:) But I will read those articles too, as the more I learn the better off I am. Thanks.
 
 http://files.engineering.com/getfile.aspx?folder=af5ee317-fa41-4c2b-9e21-c8faa3c24282&file=DIM_REF.vb
Status
Not open for further replies.

Part and Inventory Search

Sponsor