×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Searching Text in Drawings
3

Searching Text in Drawings

Searching Text in Drawings

(OP)
Hello,

I am new to NX6, and I have been given a task to seach through all the text of a drawing and replce certain part numbers with new part numbers. The hard way would be to scan through the entire drawing and replace them, but I would like to know if there is any kind of Search option that will find a text string in the annotations. Similar to the ctrl+F in word, or any other microsoft application.

Any help would be appreciated.

Thanks!

Eric Roe
Electro-Mechanical Engineer
Airfloat LLC

RE: Searching Text in Drawings

Are all of these part numbers, that you need to search for, located in a single note, or several places on the drawing?

RE: Searching Text in Drawings

(OP)
They are in several places on the drawing. The drawing consists of quite a few notes that could have the part number listed in it.

Eric Roe
Electro-Mechanical Engineer
Airfloat LLC

RE: Searching Text in Drawings

Certainly a program could be written to do that, but I'm not aware of any built-in function which would perform that task.

That being said, there is something which will give you what you're looking for.  Open your drawing and export a PDF version of the drawing, setting the 'Output Text' option to 'Text'.  Once you have the PDF version of your drawing then you can use the standard Adobe Reader 'Find' tool to detect and highlight any string of text on the face of the drawing.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
http://www.siemens.com/plm
UG/NX Museum:   http://www.plmworld.org/p/cm/ld/fid=209

To an Engineer, the glass is twice as big as it needs to be.
 

RE: Searching Text in Drawings

(OP)
Thanks for your help John, That will certainly save me a lot of time considering I can pinpoint the loctaion where I need to change the text. I am just starting to work with NX6 moving from SolidWorks. I was quite familliar with making macros in SW, but it may take a month or two before I start jumping into NX programming.

Thanks again for your help.
 

Eric Roe
Electro-Mechanical Engineer
Airfloat LLC

RE: Searching Text in Drawings

At a prior company, we had a GRIP program that would scan a drawing for all dimensions. This could possibly be used to scan for a text string. The problem is that GRIP can not edit a text string. You would need to locate the string, obtain the location, delete the original string and then write a new string to the original location. This is ok for a single entry, but very hard for a string segement in a drawing note.
 

"Wildfires are dangerous, hard to control, and economically catastrophic."

Ben Loosli

RE: Searching Text in Drawings

Below is a vb journal for which you enter a word to search for and a replacement word.

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpenUI
Imports NXOpen.Utilities
Imports NXOpen.Annotations

Module ChangeNoteWord
 Sub Main()
   Dim s As Session = Session.GetSession()
   Dim dp As Part = s.Parts.Display
   Dim nc As NoteCollection = dp.Notes
   Dim notetext1 As String = "existing word"
   notetext1 = NXInputBox.GetInputString("Change Note", "Note word to be changed", notetext1)
   Dim notetext2 As String = "new word"
   notetext2 = NXInputBox.GetInputString("Change Note", "New note word", notetext2)
   Dim notestring() As String
   Dim nolines As Integer = 0
   Dim found1 As Boolean = False
   Dim m1 As Session.UndoMarkId = s.SetUndoMark(Session.MarkVisibility.Visible, "M1")
   For Each a_note As SimpleDraftingAid In nc
     notestring = a_note.GetText()
     nolines = notestring.Length
     For i As Integer = 0 To nolines - 1
       found1 = notestring(i).Contains(notetext1)
         If found1 = True Then
          notestring(i) = notestring(i).Replace(notetext1, notetext2)
         End If
      Next
      a_note.SetText(notestring)
   Next
   s.UpdateManager.DoUpdate(m1)
 End Sub

 Public Function GetUnloadOption(ByVal dummy As String) As Integer
  GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
 End Function
End Module

Hope this helps.

Frank Swinkels

RE: Searching Text in Drawings

(OP)
Thanks a lot Frank, I will try your code once I figure out how to use it in NX thumbsup     

Eric Roe
Electro-Mechanical Engineer
Airfloat LLC

RE: Searching Text in Drawings

  1. Open notepad
  2. Copy and paste Frank's code into the notepad window
  3. Save the file and name it, change the file extension from .txt to .vb
  4. In NX, go to Tools -> Journal -> Play... (Alt+F8)
  5. Browse to the .vb file you saved and press Run

RE: Searching Text in Drawings

(OP)
Got it. It works great! I was trying to run it as a macro (which shows how new I am to all of this). But this does give me a better understanding on how to make some of my own programs in the future. Thank you guys for helping me out.

Eric Roe
Electro-Mechanical Engineer
Airfloat LLC

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources