Displaying Part Description in Feature Tree

Displaying Part Description in Feature Tree

ToddPig
Collaborator Collaborator
2,653 Views
8 Replies
Message 1 of 9

Displaying Part Description in Feature Tree

ToddPig
Collaborator
Collaborator

Is there a way to display the part description next to the file name in the feature tree?

Inventor 2018
(23+ years of Solidworks, 5+ years of fighting Inventor)
Autodesk Vault Pro 2018
iParts = iHeadache
2,654 Views
8 Replies
Replies (8)
Message 2 of 9

mdavis22569
Mentor
Mentor

Like this 

 

 

todd.JPG

 

 

yes ...but not out of the box ...

 

 

also check out 

 

https://knowledge.autodesk.com/support/inventor-products/troubleshooting/caas/sfdcarticles/sfdcartic...

 


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------
Mike Davis

EESignature

0 Likes
Message 3 of 9

mcgyvr
Consultant
Consultant

Set this ilogic rule to trigger "on save" or whatever other trigger works for you..

'create reference to part
openDoc = ThisApplication.ActiveDocument
 
'format display name
openDoc.DisplayName = iProperties.Value("Project", "Part Number") & " (" & iProperties.Value("Project", "Description") & ")"
openDoc.Rebuild
 
'update
iLogicVb.UpdateWhenDone = True

 

description.PNG



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 4 of 9

mdavis22569
Mentor
Mentor

we do it via iproperties too

 

 

Capture.JPG


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------
Mike Davis

EESignature

0 Likes
Message 5 of 9

cmyersSNP6E
Explorer
Explorer

I've tried this code but it keeps failing on openDoc.Rebuild, and gives the following error message:

   Error on line 6 in rule: DescInModelTree, in document: 11000012.iam

   Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

 

When I comment out that line, the description is shown in parentheses after the parent part number, but none of the components or subassemblies within the parent, they still only show the part number.  What am I missing?

 

More details in the "more info" tab:

System.Runtime.InteropServices.COMException (0x80004005): Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
at Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateCall(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean IgnoreReturn)
at ThisRule.Main() in rule: DescInModelTree, in document 11000012.iam:line 6
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

0 Likes
Message 6 of 9

johnsonshiue
Community Manager
Community Manager

Hi! The original rule only works for an ipt file, not an iam file. To extend it, change "Rebuild" to "Rebuild2" and it will work for iot and iam files.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 7 of 9

swalton
Mentor
Mentor

I am experimenting with this rule using Inventor 2022.  I've found an issue that I'd like to better understand.

 

I've modified the sample code with the Rebild2 command and it works well if I make a change to the description property in each document.  I've set the rule to run on both "iProperty Changes" and "Before Save" in the Event Trigger window.  Both work ok at the individual document level.

 

However, if I open an assembly that has sub-components with this iLogic code, and edit their descriptions in the BOM Editor, I can't get the display names in the assembly to update.  In fact, I find that the parent assembly display name updates each time I change a sub-component description.

 

Is there a different Event Trigger I should use, or does the code need to be modified so that changes in the BOM editor are pushed to the individual sub-components and the display name of each component is updated in the parent assembly when the BOM Editor is closed/assembly saved?

 

 

 

Steve Walton
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Inventor 2025
Vault Professional 2025
0 Likes
Message 8 of 9

A.Acheson
Mentor
Mentor

Hi @swalton 

So what is happening here is the documents you want the rule to run on are not being targeted. 

With This External Rule ran before save event trigger the document object  is the top most document indicated by ActiveDocument. So the Parent Assembly. See Picture(1)

'create reference to part
Dim openDoc As Document = ThisApplication.ActiveDocument'ThisDoc.Document
 
'format display name
openDoc.DisplayName = iProperties.Value("Project", "Part Number") & " (" & iProperties.Value("Project", "Description") & ")"

AAcheson_0-1672982695472.png

 

With this External Rule the document ran before save event trigger the object is driven by ThisDoc.Document which works to update the iproperties of any document the event trigger is targeting. So the rule runs on save on any document that has been dirtied. See  Picture(2). The document can be dirtied by adjusting the iProperty in the BOM editor or deleting the occurrence Name. 

Dim openDoc As Document = ThisDoc.Document
 
'format display name
openDoc.DisplayName = iProperties.Value("Project", "Part Number") & " (" & iProperties.Value("Project", "Description") & ")"

AAcheson_1-1672986595485.png

Assembly7 Document Dirtied

AAcheson_2-1672986659166.png

In my testing I couldn't get any update snippets to provide any meaningful contribution so those have been omitted to avoid unnecessary updates. 

Not sure if Method 2  is robust enough for your use. If not the only other solution I can think of is an external rule run manually to loop through the reference documents Of the Parent Assembly and force a change to the display name. 

 

Dim Asm As AssemblyDocument = ThisDoc.Document
Dim Trans As Transaction = ThisApplication.TransactionManager.StartTransaction(Asm, "Change Display Name In all files") 'Make this a single transaction

For Each Doc As Document In Asm.AllReferencedDocuments 'Traverse all referenced documents 
	If Doc.IsModifiable = True Then
		Try
			Dim PartNo As String = Doc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value  
			Dim Description As String = Doc.PropertySets.Item("Design Tracking Properties").Item("Description").Value  
			
			'Format display name.
			Doc.DisplayName = PartNo & " (" & Description & ")"
		Catch
		End Try
	End If
Next 
Trans.End 'End the transaction

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 9 of 9

swalton
Mentor
Mentor

@A.Acheson 

 

Thanks for the comments and the code snippet.

 

Preliminary testing looks good.  Now to try editing iprops in Vault and Vault Data Standard...

 

 

Steve Walton
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Inventor 2025
Vault Professional 2025