Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Need .vb to copy attributes from master part to 2D drawing template

Status
Not open for further replies.

JBIM

Industrial
Nov 22, 2006
89
Hi,

I´ve been looking in the forum and there is some info but what i would like is toask if some one have a vb file that would copy attributes from master part to 2D drawing template so I didn´t have to copy paste attribute every time.

thanks
 
Replies continue below

Recommended for you

What I did was to make templete of the drawing borders with the attribute names in the title block. Then, I copied a vb journal file provided by someone on this forum (forget who). How it worked was like this. I would run the journal file, import the border, and the attribute fields would show the correct info for the file name and date. This should get you started. Here's the vb script below.

------------------------------------------------------------





' NX 4.0.0.25
' Journal created by Henry on Tue Mar 21 10:57:55 2006 FLE Standard Time
'
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

' ----------------------------------------------
' Menu: File->Properties
' ----------------------------------------------
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Edit Properties")

Dim TimeNote As DateTime
TimeNote = System.DateTime.Now()
Dim TimeNoteString as String() = TimeNote.GetDateTimeFormats()

workPart.SetAttribute("DATE", TimeNoteString(1))
theSession.Parts.Work.SetAttribute("FILENAME",theSession.Parts.Work.Leaf)


' ----------------------------------------------
' Menu: Tools->Journal->Stop
' ----------------------------------------------

End Sub
End Module
 
thanks men, i try it and it´s usefull.

But what id like to do is to get master 3D part attributes such as material, ref, mw_stock_size and copy those attributes to the 2d drawing template based file.
all this with a vb file .

I appreciate the help.


 
I just manually copy and paste them. They will stay on the clipboard for a fair while so I don't find it too much trouble. I guess you know that you always have to edit something, so you're likely to have to go into Properties>Attributes anyway.

I actually furnish my template files with the correct attributes and paste over them with values from other files that are similar.

Because all you're doing depends on attributes I'm pretty sure that you could do a lot of what you need using GRIP if necessary.

Cheers

Hudson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor