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!

Expression update

Status
Not open for further replies.

Lars1978

Mechanical
Dec 30, 2015
327
Ha All,

I've got my standard part file tweaked to filter the document number, revision number and description. See the image beneath. These separate info is used to fill the title block. To make the expression accurate i've to use the 'update for external change' the get te accurate info. This causing the whole assembly to update. This takes to much time.

Can this update be done without the "update for external change" ?
and can this expression update be done automaticly?





Capture_dvozap.png




Lars
NX11.0.1.11 native
Solid Edge
Inventor
 
Replies continue below

Recommended for you

Anybody please?

Lars
NX11.0.1.11 native
Solid Edge
Inventor
 
Hello,

Do You wanna update date or what? I have similar problem few years ago, and in DRW file I created new attribute "DATE". It contain date from when I created those standard. When I create PDF, the journal automatically update it to time when I run this code. I have also journal to update every DWG file in folder.

With best regards
Michael
 
Michael,

I want to update line 24 to 26. These are expressions which fill my title block.



Lars
NX11.0.1.11 native
Solid Edge
Inventor
 
I think, that if You change part name, the expressions still rimember old value - ug_askCurrentWorkPart(). Here is the same problem described:
What I can advise You - instead of using expressions, use part attributes and journal to update / change.

With best regards
Michael
 
Below is some code to create part atributes:

Code:
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

	Dim markId1 As Session.UndoMarkId
	markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Edit Properties")

	Dim MyTimeStamp As string
	Dim Filename as String = workpart.name

	Dim x_order_nr as String
	Dim y_rev_nr as String
	Dim Z_title as String
	Dim File_string() as String

	Dim Lw as listingwindow = theSession.ListingWindow

	'lw.open

	MyTimeStamp = System.DateTime.Now.Tostring("dd.MM.yyyy")
	'MyTimeStamp= System.DateTime.Now.Tostring("yyyy-MM-dd")

	file_string = filename.split("_")

	x_order_nr = file_string(0)
	Y_rev_nr = file_string(1)
	z_title = file_string(2)
	
	workPart.SetUserAttribute("MyTimeStamp", -1, MyTimeStamp, update.option.now)
	workPart.SetUserAttribute("x_order_nr", -1, x_order_nr, update.option.now)
	workPart.SetUserAttribute("Y_rev_nr", -1, Y_rev_nr, update.option.now)
	workPart.SetUserAttribute("z_title", -1, z_title, update.option.now)

	theSession.DeleteUndoMark(markId1, Nothing)
	'lw.close

End Sub
End Module



With best regards
Michael
 
Micheal,

This wil help I think. When I add the save command to this yournal I can use this journal to save the file always with the latest data.

Thnx.

Lars

Lars
NX11.0.1.11 native
Solid Edge
Inventor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor