Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Searching Text in Drawings 3

Status
Not open for further replies.

eroe

Mechanical
Jul 29, 2009
37
0
0
US
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
 
Replies continue below

Recommended for you

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
 
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
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
 
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
 
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
 
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
 
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
 
[ol][li]Open notepad[/li]
[li]Copy and paste Frank's code into the notepad window[/li]
[li]Save the file and name it, change the file extension from .txt to .vb[/li]
[li]In NX, go to Tools -> Journal -> Play... (Alt+F8)[/li]
[li]Browse to the .vb file you saved and press Run[/li][/ol]
 
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
 
Status
Not open for further replies.
Back
Top