Message 1 of 19

Not applicable
07-03-2013
06:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm looking for some help figuring out how to create an iLogic rule that automatically renames the browser nodes based on part number. I know that this is a function in Inventor itself. The problem is that there is no built-in functionality to automatically change the default browser name to something besides part number. I've done a lot of digging and I came across the following code from an old thread discussing Inventor 2011. I am interested in 2013. It is also worth noting that when I run this code, my Inventor crashes.
If someone knows more about programming than I do and can get this to work, it would be much appreciated.
PrivateSubMain
UpdateAssyBrowser(ThisDoc.Document)
End Sub
PrivateSubUpdateAssyBrowser(ByValoDocAsInventor.Document)
DimoAssyAsInventor.AssemblyDocument
DimoCompAsInventor.ComponentOccurrence
DimoSubDocAsInventor.Document
DimNodeName()AsString
DimInstNumAsString
IfoDoc.DocumentType=Inventor.DocumentTypeEnum.kAssemblyDocumentObjectThen
oAssy=CType(oDoc, AssemblyDocument)
ForEachoCompInoAssy.ComponentDefinition.Occurrences
oSubDoc=CType(oComp.Definition.Document, Document)
NodeName=oComp.Name.Split(NewChar() {":"c}, StringSplitOptions.None)
InstNum=":"&NodeName(1)
oComp.Name=GetProp(oSubDoc, "Design Tracking Properties", "Part Number")&InstNum
IfoSubDoc.DocumentType=Inventor.DocumentTypeEnum.kAssemblyDocumentObjectThen
CallUpdateAssyBrowser(oSubDoc)
EndIf
NextoComp
EndIf
End Sub
PrivateFunctionGetProp(ByValoDocAsInventor.Document, ByValPropSetNameAsString, ByValPropNameAsString)AsString
DimoPropSetAsInventor.PropertySet
DimsHoldAsString=""
oPropSet=oDoc.PropertySets(PropSetName)
DimoPropAsInventor.Property
ForEachoPropInoPropSet
IfoProp.DisplayName="Part Number"Then
sHold=CStr(oProp.Value)
ExitFor
EndIf
NextoProp
ReturnsHold
End Function
Solved! Go to Solution.