iLogic Sequential Part Number Generator

This widget could not be displayed.

iLogic Sequential Part Number Generator

Anonymous
Not applicable

I'd like to create a part number generator using iLogic.  The rule would run as follows:

 

  • If the iProperty "Part Number" was not blank or the same as the file name (as Inventor default), then a question box would pop up asking if you would like to overwrite the part number.  If one were to select yes, then the following would happen.

 

  • iLogic would open an xls that is on the network.  The xls would have two columns.  Column A would be the part number, B would be the filename associated with that part number. 

 

  • Column A (the part number) is a sequential count in the form of 6 or seven digits.  The format would be something like =TEXT(ROW(A1),"JFRC-000000")

 

  • Everytime the part number generator rule is triggered, it would create a new part number on the next blank row, copy this part number to the Part Number iProperty and assign the file in which the iLogic rule was executed to column B in the xls, save and close.

 

  • If, when the rule is triggered, the Part Number property is blank or the same as the file name, the user would not be asked if they would like to overwrite the part number.

 

  • This rule would be triggered manually from a form.

Anyone familiar enough to create simple iLogic code to do this?  I know I'm asking a big favor, but I know there are some experts out there!

 

Reply
Accepted solutions (1)
8,004 Views
5 Replies
Replies (5)

Anonymous
Not applicable

By the way, our part number is completely independant of the file name, so I don't want to use Vault's built in part numbering scheme.

0 Likes

Anonymous
Not applicable
Accepted solution

Accomplished this with the following iLogic (it's not pretty, but it works).  I then trigger the rule using a button in a form.

 

If iProperties.Value("Project", "Part Number") <> ThisDoc.FileName(False) _  
And iProperties.Value("Project", "Part Number") <> "" Then
question = MessageBox.Show("Are you sure you would like to overwrite the currently assigned part number?"&vbLf _
&"Current Part Number: "&iProperties.Value("Project", "Part Number"), "Part Number Overwrite?", MessageBoxButtons.YesNo )
Else
AssignNumber:
GoExcel.Open("\\SVAULT\Inventor Standards\Automation\JFRC - PART NUMBER GENERATOR.xls", "Part Numbers")

		PreviousNumber=GoExcel.CellValue("A2")
			NewNumber=PreviousNumber+1
	GoExcel.CellValue("A2") = NewNumber
	iProperties.Value("Project", "Part Number") = GoExcel.CellValue("B2")
	
End If

If question = vbYes Then
GoExcel.Open("\\SVAULT\Inventor Standards\Automation\JFRC - PART NUMBER GENERATOR.xls", "Part Numbers")
		PreviousNumber=GoExcel.CellValue("A2")
			NewNumber=PreviousNumber+1
	GoExcel.CellValue("A2") = NewNumber
	iProperties.Value("Project", "Part Number") = GoExcel.CellValue("B2")

Else End If
 
GoExcel.Save()

 

 

 

I combined this with another rule to wipe the filename from the part number upon initial creation.  Autodesk should remove this.

 

If iProperties.Value("Project", "Part Number") = ThisDoc.FileName(False) _  
Then iProperties.Value("Project", "Part Number") = ""

This rule is triggered after the save of the document.

 

 

I think this setup has some fat, but it's working for now.  I'll trim it down later.  But it's much better than Vault's custom number schemes.  I've setup property compliance on the part number property, so a file can't be released without a part number.

kchristianson3YHHQ
Community Visitor
Community Visitor

Why isn't this just built into Inventor. Seems like a pretty standard requirement...

0 Likes

Anonymous
Not applicable

Have you ever tried getting iLogic to save each the data to the excel sheet in as way that the excel sheet can be used as a drawing register?
As in it writes each new part number to the next consecutive blank cell in the column? And ideally copy over other iproperties, such as title.

cekol20
Contributor
Contributor

Hello, could explain how to prepare a excel for this? I created a rule but I need excel as well. Thanks!