@JimmyDoe wrote:
Any chance you got around to this?...
Hi JimmyDoe,
Sort of.
Here's an example that gets the stabilized name and writes it to a custom iprop, and then toggle the browser name to the be the file name, or vice versa.
Experiment with this on a test assembly in case it's buggy, as it could wipe out your stabilized names.
Note too that as written it uses the assembly name as part of the custom iProp, so that a file used in multiple assemblies can have multiple "stabilized" names. Meaning that you'd have multiple custom iprops in the part file. You can remove that if needed, and just have it write to the same iprop if you want.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
'check for variable to hold inputradiobox value
If SharedVariable.Exists("Input_Value") = False Then
SharedVariable("Input_Value") = True
End If
'get user input
sOption1 = "Browser currently has Stablized Names"
sOption2 = "Browser currently has File Names"
bStabilizedName = InputRadioBox("Select an option:", sOption1, sOption2, _
SharedVariable("Input_Value"), "iLogic - Toggle browser names")
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
oAssemblyName = _
System.IO.Path.GetFileNameWithoutExtension(ThisApplication.ActiveDocument.FullFileName)
oIpropName = "Stabilized_Name_" & oAssemblyName
'Iterate through all of the occurrences
Dim oOcc As ComponentOccurrence
For Each oOcc In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef)
docFile = oOcc.Definition.Document
docName = System.IO.Path.GetFileNameWithoutExtension(docFile.FullFileName)
If bStabilizedName = True Then
iProperties.Value(oOcc.Name, "Custom", oIpropName) = oOcc.Name
'clear browser name override by setting to nothing
'which resets it to file name
oOcc.Name = ""
'set variable to hold inputradiobox value
SharedVariable("Input_Value") = False
Else
'set occurence name to stablized name
oOcc.Name = iProperties.Value(oOcc.Name, "Custom", oIpropName)
'set 'variable to hold inputradiobox value
SharedVariable("Input_Value") = True
End If
Next
