Ilogic rule to copy filename to Iproperty discription

Ilogic rule to copy filename to Iproperty discription

jelle_nobus
Contributor Contributor
486 Views
3 Replies
Message 1 of 4

Ilogic rule to copy filename to Iproperty discription

jelle_nobus
Contributor
Contributor

Hi,

 

Recently i've been working to improve my companies filenaming, document structure. 

To this, i wanted to adapt the file name to the iproperty "Description" (which is later used to display as the occurance name in the model tree). I found an existing rule that basically does what i want but adapts it to the "Part Number" Iproperty instead. Ive been trying to get this to work for Description instead but it doesnt... and im not sure why. Im new to Ilogic so any adive on getting this to work the way i want would be appreciated.

 

For more context why i dont use the Original irule, when using frame generator it generates a diffrent part file for each member, if two members are the same they should have the same entry in the BOM/Parts list which is harder to do when having each frame member as a diffrent entry in the BOM. The "Part Number" is reserved for the part's name (ex: member type, lenght, width, etc) instead of the filename. 

 

I will uninclude both mine, and the example i have in the attachment.

 

Thanks in advance!

0 Likes
Accepted solutions (1)
487 Views
3 Replies
Replies (3)
Message 2 of 4

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @jelle_nobus 

 

Give this a try.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

' set description for the active document
iProperties.Value("Project", "Description") = ThisDoc.FileName(False)

'process assembly components if active document is an assembly
If ThisDoc.Document.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
	For Each oOcc As ComponentOccurrence In ThisAssembly.Document.ComponentDefinition.Occurrences
		Dim docFile As Document = oOcc.Definition.Document
		docName = docFile.FullFileName
		docNameNoExt = IO.Path.GetFileNameWithoutExtension(docName)

		iProperties.Value(oOcc.Name, "Project", "Description") = docNameNoExt
	Next
End If

 

EESignature

0 Likes
Message 3 of 4

jelle_nobus
Contributor
Contributor

This seems to do what i need it to, altough it looks like you'd need to put it with a trigger for it to affect the files in an assembly properly. but it does what i needed it for, thank you.

0 Likes
Message 4 of 4

yatinp175
Observer
Observer

we can add to the template and use right ? so that each and very time we use the template and save the document . the description shows the name of the file name rather than the name of the template.

0 Likes