×
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

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

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

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

(OP)
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

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

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
 

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

(OP)
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.


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

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

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