How to automatically generate a part number on a part template.

Anonymous

How to automatically generate a part number on a part template.

Anonymous
Not applicable

Hi

 

My name is Steffen. I am hoping this community can help me. I am new to use iLogic.

 

I'm developing a part template in inventor. It works very well, but I have a problem that you may be able to help.

 

In my template I am working with a form.

 

My question is as follows:

 

Is it possible to get inventor to automatically generate part numbers with current date (hours / month / day) with hours and minutes directly after with no seperators, example 151020171728 on each new part drawing.

 

Is it possible, and how do you do it.

 

Screen.png

 

0 Likes
Reply
Accepted solutions (1)
2,344 Views
2 Replies
Replies (2)

JaneFan
Autodesk
Autodesk

Hello Steffen, 

 

Do you want to use iLogic to save the template with time stamp? 

Please check whether this is what you want: 

SyntaxEditor Code Snippet

Dim doc = ThisDoc.Document
strAA = "c:\temp\test" + Timer.ToString() + ".ipt"
MsgBox(strAA)
doc.SaveAs(strAA, True)

 




Jane Fan
Inventor QA Engineer

mcgyvr
Consultant
Consultant
Accepted solution

Another solution...

 

'get the current date and time
strAA = Now.ToString()
'remove the / from it
strBB = Replace(strAA, "/", "")
'remove : from it
strCC = Replace(strBB, ":", "")
'remove spaces from it
strDD = Replace(strCC, " ", "")
'show the newly formatted date
MessageBox.Show(strDD, "Title")
'do whatever you want with strDD

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes