Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Auto Date? 2

Status
Not open for further replies.

DieMan44

Mechanical
Sep 16, 2004
183
0
0
US
I am working on border templetes for file we get from G.M. These are to be used for quoting purposes and do not need to be very complicated. However, there is some information in the title block that needs to be included and I am trying to automate the process. I have been able to include part attribute like part number and name, but I can not find a way to include the current date. Is this even possible?
 
Replies continue below

Recommended for you

You'll have to write a program for that since there is no 'current date' type routine inside of interactive NX, at least not one that won't update everytime the model updates, which I suspect is NOT what you're looking for.

If you wish, I could supply a code segment (in GRIP) that would extract the current date and write it into an attribute which could then be linked to a note in a drawing border.


John R. Baker, P.E.
Product 'Evangelist'
UGS NX Product Line
SIEMENS
UGS PLM Software
Cypress, CA
 
Thanks John but that won't be necessary. It would be just as fast to copy and past the current date as it would be to run the grip program. But I am grateful for your quick response.
 
Here is little journal file which I use to update Date and Filename attributes:

' 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

To get suitable Date format play with TimeNoteString(X).
You can run this journal from toolbar icon.

Henry
 
Henry, this is really cool. Thank you.

What types of formats can you have for the date? We typically have 06Jun07 format. Do you know if that code can display that?

I think this is pointing me in the right direction for our title blocks. I would love to have a generic format block that has attributes tied to it, run this journal, and it fills it all out.

Thank you again.

Justin Ackley
Designer
jackley@gmail.com
 
The format for a note showing the content of a Part Attribute is <W@'attribute'> where 'attribute' is the name of the Part Attribute (the format for linking to an Object Attribute is more complex in that it requires the unique object ID as well).

Note that you don't have to manually type this out each time as there is an option in the full Text Editor to create notes linked to Attributes and Expression by selecting the 'Relationships' tab on the dialog.


John R. Baker, P.E.
Product 'Evangelist'
UGS NX Product Line
SIEMENS
UGS PLM Software
Cypress, CA
 
Justin,

TimeNoteString(1) writes 04.05.2007
TimeNoteString(2) writes 07.06.07
TimeNoteString(3) writes 2007-06-07
TimeNoteString(4) writes 7. juuni 2007. a.
TimeNoteString(5) writes 07. juuni 2007. a.
TimeNoteString(6) writes neljapäev, 7. juuni 2007
TimeNoteString(7) writes 07. juuni 2007. a. 22:44
TimeNoteString(8) writes 7. juuni 2007. a. 22:47
TimeNoteString(9) writes 07. juuni 2007. a. 22:47
TimeNoteString(10) writes 07. juuni 2007. a. 22:48
TimeNoteString(11) writes neljapäev, 7. juuni 2007 22:48
TimeNoteString(12) writes neljapäev, 7. juuni 2007 22:49
TimeNoteString(13) writes 7. juuni 2007. a. 22:49:22

It might depend your computer Regional setting.

Henry
 
Thanks Aikon for your date journal file.
I wondering if it´s possible to create an attribute with the scale of the view inserted in 2d drawing using journal file?

I have an other question:

I draw molds, an it´s usual that in the same assembly I have many time the same part.

My problem is when I draw this part 2D drawing I need to indicate the quantity existing in part.

Since it´s a sub assembly file and quantity only apears on top assembly, is there a way to use journal file to create an attribute with the quantity of this file existing on top

It would help me a lot avoiding mistakes.

thanks a lot
 
Hi again

Dieman 44, You wrote that your were able to include part attribute like part number and name automaticly .

Can you tell me how?

Thanks in advance
 
Hi again,

This time I´ll have to ask a favor to Aikon:)

I apply your journal file and it´s really helpfull.

My (problem) is that my cad file in 2D drawing are all name like that: refnumber-componentname-2D

Is there a way to eliminate the "-2D" in the attribute create by journal file.

Thanks a lot
 
JBIM,

This works for me only with G.M. files. They include these attributes in most of their files. All you need to do is format your tile block to include which <W@'attribute'> you want.
 
Status
Not open for further replies.
Back
Top