Hello
I have a problem regarding the part occurrance name.
At our office we have a lot of parts with existing names, (defined by 3rd party subcontractors) wich need to be changed to the part numbers we use.
We use vault and when checking in assemblies and parts the automatic renaming funcion in vault does its job.
However, when checking out the parts and assemblies from vault, the occurance name (in the model tree) does not update to the part number (which is the intention). We have tried using the Inventor feature "Rename Browser Nodes" and selecting "New Name: Part number". But when we try saving the assembly (With updated occurrance names) the part occurrance names gets reset to the name defined by 3rd party subcontractor.
A way to fix this problem is by individually opening every part and resetting occurrance name (editing occurrance name, deleting the name, and pressing enter), however this is a very time consuming way of fixing the issue at several thousand parts in assembly.
The problem is illustrated by the following screenshots.
Is there a way to automate this process using Ilogic rules?
Is there any other way to fix the issue using some of the features in Inventor?
Thanks in advance
Solved! Go to Solution.
Hello
I have a problem regarding the part occurrance name.
At our office we have a lot of parts with existing names, (defined by 3rd party subcontractors) wich need to be changed to the part numbers we use.
We use vault and when checking in assemblies and parts the automatic renaming funcion in vault does its job.
However, when checking out the parts and assemblies from vault, the occurance name (in the model tree) does not update to the part number (which is the intention). We have tried using the Inventor feature "Rename Browser Nodes" and selecting "New Name: Part number". But when we try saving the assembly (With updated occurrance names) the part occurrance names gets reset to the name defined by 3rd party subcontractor.
A way to fix this problem is by individually opening every part and resetting occurrance name (editing occurrance name, deleting the name, and pressing enter), however this is a very time consuming way of fixing the issue at several thousand parts in assembly.
The problem is illustrated by the following screenshots.
Is there a way to automate this process using Ilogic rules?
Is there any other way to fix the issue using some of the features in Inventor?
Thanks in advance
Solved! Go to Solution.
I wrote some code that will get you close to what you are looking for. It was written to "normalize" nodes for building iLogic configurators:
I've tweaked that code to change the node names to part numbers, one drawback of this version of code, is that it renames all of the instances numerically, see image below:
Part numbers are correctly displayed though.
'Code by @ClintBrown3D originally posted here: --> https://clintbrown.co.uk/ilogic-normalise-browser-nodes---with-code 'This iLogic utility "normalises" the first instance of a browser node in an assembly oDoc = ThisDoc.Document oNamer = "Normalise Browser Nodes" Dim UNDO As Transaction UNDO = ThisApplication.TransactionManager.StartTransaction(oDoc, oNamer) 'The rule is placed in an "undo wrapper" to it faster to undo the changes to multiple browser node changes 'https://clintbrown.co.uk/2019/03/03/undo/ '---------------------------------------------------------------------------------------------------------------------- Dim doc = ThisDoc.Document : If doc.DocumentType = kAssemblyDocumentObject Then 'Check we are in an IAM Else : Return :End If Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition Dim oCompOcc As Inventor.ComponentOccurrence OccCounter = 0 For Each oCompOcc In oDef.Occurrences GetOccName = oCompOcc.Name OccCounter = OccCounter + 1 SubOccCount = 0 Try 'Top Level Occurrences NewName = (GetOccName) NewName = iProperties.Value(GetOccName, "Project", "Part Number") oCompOcc.Name = NewName & ":" & OccCounter 'Sub level Occurrences For Each oSubOcc As ComponentOccurrence In oCompOcc.SubOccurrences SubOccCount = SubOccCount + 1 SubNewName = iProperties.Value(GetOccName, "Project", "Part Number") oSubOcc.Name = SubNewName & ":" & SubOccCount Next Catch : End Try : Next '------------------------------------------------------------------------------------------------------------------------- UNDO.End
Hope this points you in the right direction. Maybe someone else can tweak this to fix the instance numbering.
I wrote some code that will get you close to what you are looking for. It was written to "normalize" nodes for building iLogic configurators:
I've tweaked that code to change the node names to part numbers, one drawback of this version of code, is that it renames all of the instances numerically, see image below:
Part numbers are correctly displayed though.
'Code by @ClintBrown3D originally posted here: --> https://clintbrown.co.uk/ilogic-normalise-browser-nodes---with-code 'This iLogic utility "normalises" the first instance of a browser node in an assembly oDoc = ThisDoc.Document oNamer = "Normalise Browser Nodes" Dim UNDO As Transaction UNDO = ThisApplication.TransactionManager.StartTransaction(oDoc, oNamer) 'The rule is placed in an "undo wrapper" to it faster to undo the changes to multiple browser node changes 'https://clintbrown.co.uk/2019/03/03/undo/ '---------------------------------------------------------------------------------------------------------------------- Dim doc = ThisDoc.Document : If doc.DocumentType = kAssemblyDocumentObject Then 'Check we are in an IAM Else : Return :End If Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition Dim oCompOcc As Inventor.ComponentOccurrence OccCounter = 0 For Each oCompOcc In oDef.Occurrences GetOccName = oCompOcc.Name OccCounter = OccCounter + 1 SubOccCount = 0 Try 'Top Level Occurrences NewName = (GetOccName) NewName = iProperties.Value(GetOccName, "Project", "Part Number") oCompOcc.Name = NewName & ":" & OccCounter 'Sub level Occurrences For Each oSubOcc As ComponentOccurrence In oCompOcc.SubOccurrences SubOccCount = SubOccCount + 1 SubNewName = iProperties.Value(GetOccName, "Project", "Part Number") oSubOcc.Name = SubNewName & ":" & SubOccCount Next Catch : End Try : Next '------------------------------------------------------------------------------------------------------------------------- UNDO.End
Hope this points you in the right direction. Maybe someone else can tweak this to fix the instance numbering.
Thank you very much for the response and rule. And thank you for your time.
When executing the rule the part occurrance name changes as intended. But i still run into the same issue (the part occurrance name resets to default) when saving the document.
Im completely new to Ilogic and i only understand the basics of it.
Could my issue be resolved by executing the rule differently?
Thank you very much for the response and rule. And thank you for your time.
When executing the rule the part occurrance name changes as intended. But i still run into the same issue (the part occurrance name resets to default) when saving the document.
Im completely new to Ilogic and i only understand the basics of it.
Could my issue be resolved by executing the rule differently?
I've tested this on my end, the names should stay "as set" by the rule after a save.
Have a look at the Event triggers:
Make sure that nothing is currently running "Before Save" or "After Save".
You could try putting this rule into "Before Save", that way, it will update the nodes while the file is being saved. It's best practice not to run anything that changes the file "After Save", as this could dirty the file.
I've tested this on my end, the names should stay "as set" by the rule after a save.
Have a look at the Event triggers:
Make sure that nothing is currently running "Before Save" or "After Save".
You could try putting this rule into "Before Save", that way, it will update the nodes while the file is being saved. It's best practice not to run anything that changes the file "After Save", as this could dirty the file.
It works like a charm.
Thank you so much. You have been a tremendous help.
It works like a charm.
Thank you so much. You have been a tremendous help.
Hi, @Anonymous congratulations on your code! Is there a code can I utilize to change the name in my ilogic because with your code I lose the reference to the last names I put?
Hi, @Anonymous congratulations on your code! Is there a code can I utilize to change the name in my ilogic because with your code I lose the reference to the last names I put?
Hello, after reading your question i think we have a solution for you in the form of an app. We are launching a Numbering app this week. I was wondering if you would be interested in testing it? The app is capable of renaming a lot of properties, numbering parts and assemblies and many more things.
You can send me a PM if interested!
Hello, after reading your question i think we have a solution for you in the form of an app. We are launching a Numbering app this week. I was wondering if you would be interested in testing it? The app is capable of renaming a lot of properties, numbering parts and assemblies and many more things.
You can send me a PM if interested!
Can't find what you're looking for? Ask the community or share your knowledge.