Partnumber & description modified according to excel file

Partnumber & description modified according to excel file

Anonymous
Not applicable
667 Views
3 Replies
Message 1 of 4

Partnumber & description modified according to excel file

Anonymous
Not applicable

I have an excel file  (partnumber.xsl)  that has 3 columns: 

 
Filename; Partnumber; Description
123456.ipt; "Partnumber ipropery text"; "Description iproprty Text"
789012.ipt; "Partnumber ipropery text"; "Description iproprty Text"
etc
 
When my assembly is finnished, I would like to get all my parts (subassemblies included) checked on filename, and if present in the excel file, have the partnumber & description iproperty of the part modified by the text in the excel file. If the filename is not present, nothing has to be modified in the part.
 
Would that be difficult to achieve? I would be very thankfull if anyone could point me in the right direction. Many Thanks
0 Likes
668 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

That should be:

 

I have an excel file  (partnumber.xsl)  that has 3 columns: 

 

Column A; Column B; Column C
"First 7 character of a Filename"; Partnumber; Description
1234567; "Partnumber ipropery text"; "Description iproprty Text"
abcdefg; "Partnumber ipropery text"; "Description iproprty Text"
etc
 
When my assembly is finnished, I would like to get all my parts (subassemblies included) checked on the 7 first characters of their filename, and if present in column A of the excel file, have the partnumber & description iproperty of the part modified by the text in the excel file. If the filename is not present, nothing has to be modified in the part.
0 Likes
Message 3 of 4

Anonymous
Not applicable

This was my idea of the excel file.

And this seems to do the opposite?

http://inventortrenches.blogspot.com/2011/04/using-excel-and-ilogic-to-retrieve-part.html

0 Likes
Message 4 of 4

Anonymous
Not applicable

I tried to modify Curtis' code from here, and it works. Except when the filename it is not found in the excel, it takes the partnumber and description from the 1st row. It should leave the part untouched if not found. What should I add to the code?

 

https://forums.autodesk.com/t5/inventor-customization/batch-edit-iproperty-based-on-excel-table/m-p/...

 

'set the target document 
oDoc = ThisApplication.ActiveEditDocument

'example: "C:\TEMP\9876543210.ipt"
sPathAndName = oDoc.FullFileName

'split into an array
oSplit = Split(sPathAndName,"\") 
'example: "C:\TEMP\9876543210.ipt"
'	oSplit(0) = C:
'	oSplit(1) = TEMP
'	oSplit(2) = 9876543210.ipt"  <-- this is the Ubound for this example

'get the upper bound of the array
sNameWithExtension = oSplit(UBound(oSplit)) 

'get length of string
'example: 9876543210.ipt" , would return 14
iNameLength = Len(sNameWithExtension)

'keep first 11 chars ( example: PROF_150001 )
sName = Left(sNameWithExtension, 11) 

'compare excel data
If GoExcel.FindRow("C:\TEMP\Partnumber_Description_List.xlsx", "Blad1", "Filename", "=", sName)

	' Get a reference to the PropertySets
	' we're really only using Design Tracking Properties in this case though
	Dim oPropSet1 As PropertySet
	oPropSet1 = oDoc.PropertySets.Item("Inventor Summary Information")
	Dim oPropSet2 As PropertySet
	oPropSet2 = oDoc.PropertySets.Item("Design Tracking Properties")
	Dim oPropSet3 As PropertySet
	oPropSet3 = oDoc.PropertySets.Item("Inventor User Defined Properties")

	'set value to excel data
	oPropSet2.Item("Part Number").Value = GoExcel.CurrentRowValue("Partnumber")
	oPropSet2.Item("Description").Value = GoExcel.CurrentRowValue("Description")
End If

 

0 Likes