Does anyone know how to override or change the generated 32 digit part number? Or have a snipit of code that will do this?
Thanks,
Andrew
Hi Andrew,
There are several ways to deal with your problem:
1. Simple. Add the "Part Number" entry into iProperties Rule, similar to:
Rule iProperties As List = {{"Part Number","ABC"}}
2. In some cases (you want the Part number to be based on the finalized geometry of the IPT or on some external data), you have to override the GetNewPartNumber(...) Method specified in IvAdoptedPart Design.
Please have a look at PartNumberDemo.iam in the ETO Inventor samples.
Thanks. That did help. I will have to override the GetNewPartNumber. That changes the iProperties Part number. How do I change the File name to match?
Try something like that (add this code to "AdoptedComponents" design):
Parameter Rule sPartName As String = ""
Parameter Rule iPartIndex As Integer = NoValue
Rule b%%signatureRequired As Boolean
If sPartName = "" Then
Return True
Else
Return False
End If
End Rule
Rule sCacheFactoryFile As String
If sPartName = "" Then
Return iv_pathFileNameOnly(FactoryFileName)
Else
If iPartIndex = NoValue Then
Return sPartName
Else
Return sPartName + "_" + stringValue(iPartIndex)
End If
End If
End Rule
' Member (instance) file
' File name (including extension) of cached member file
<%%Category("Inventor") > _
Rule cacheFileName As String
If b%%signatureRequired Then
Return sCacheFactoryFile + "." + %%Signature + iv_pathExtension(FactoryFileName)
Else
Return sCacheFactoryFile + iv_pathExtension(FactoryFileName)
End If
End Rule
Use sPartName as additional parameter for each part.
Use iPartIndex as additional parameter for list of parts.