Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

renaming Sketches with a Jurnal or a Macro

Status
Not open for further replies.

Jochen874

Mechanical
Nov 3, 2009
2
Hello,
I'm new in this forum. I've got a little problem because I have to rename nearly 1000 sketches, and I do not know how to write a little program to help me do this work. Exactly I have to add a the same String to the name of many sketches, for example to the name of all selekted sketches. Is there anyone whow can post me a macro or a jurnal or something else to help me do this job???
best regards...
 
Replies continue below

Recommended for you

Hi,

I don't believe there is a macro to rename sketches & to create one, seems like it's more trouble then it's worth.

Typically, as a best practice, the Designer should name sketches up front, such as, "SK_XSECT"

SK = Sketch
XSECT = Cross section


May be a lot of rework, but you are probably better off manually renaming. Also, having a 1000 sketches in model is a bit excessive, even if you really don't have that many.

Hope that helps.

Jason M.
Unigraphics NX & SolidWorks Designer
 
HI Jason,

I don't have 1000 sketches in one part, but I got quit a lot of Parts with up to 200 sketches. I have to add the ISO-standard to the naming of the sketches. So this is really a lot of work if I do it manually. On the other hand it is a good chance to learn a little about automatization. I have another thing to do. I've got to replace a part of the naming-Sting for Example "Profile" to "Pr". To get enough free characters to ad the ISO-standard to the naming. I hope there will be a way to do so. I recorded a journal, but I do not know how to write a loop to rename all selected sketches...

' NX 6.0.2.8
' Journal created by Jochen on Wed Nov 04 08:07:41 2009 Westeuropäische Normalzeit
'
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

' ----------------------------------------------
' Dialogfenster Anfang Skizze Eigenschaften
' ----------------------------------------------
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Edit Properties")

Dim sketch1 As Sketch = CType(workPart.Sketches.FindObject("Flatbar-100X10"), Sketch)

sketch1.SetName("Flatbar-100X10-ISO123456")

Dim nErrs1 As Integer
nErrs1 = theSession.UpdateManager.DoUpdate(markId1)

' ----------------------------------------------
' Menü: Werkzeuge->Journal->Stop Recording
' ----------------------------------------------

End Sub
End Module




kind regards
Jochen

 
Hi Joshen874,

The only other thing I could suggest is to use UG's Excel & attempt to write a macro within that.

Perhaps, to test it out, you may want to export or copy your data into the regular version of Excel & test in that environment.

Attempt to use as if you were setting up a part-family. I'm assuming that you now have a bunch of generic sketch names, which would make a bit harder for Excel to "find & replace" because names aren't similar.

Other then that, I'm not sure what else I would suggest by not seeing the data. Actually, there is one more - Find an intern to assist, but that's probably not an option.

Good Luck...

Jason M.
Unigraphics NX & SolidWorks Designer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor