04-21-2024
07:05 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
04-21-2024
07:05 PM
Hi!
Run this iLogic rule in your drawing:
This rule will rename the sheet name to the name of the model (part or assembly) present in the main view of each sheet.
If ThisApplication.ActiveDocument.DocumentType <> kDrawingDocumentObject Then MessageBox.Show("Please run this rule from the Multi-Sheet DRAWING file.", "iLogic") Exit Sub End If 'ilogic rule renames each drawing sheet to first part/model/ipn/etc view inserted into each drawing sheet 'Purpose: Push file name to sheet name Dim oDoc As Document oDoc = ThisApplication.ActiveDocument Dim oSheets As Sheets oSheets = oDoc.Sheets Dim oSheet As Sheet Dim oDrawingView As DrawingView 'Iterate through sheets For Each oSheet In oSheets Try 'Grab the first drawing view on the sheet oDrawingView = oSheet.DrawingViews(1) 'Grab the model of the first drawing view oModel = oDrawingView.ReferencedDocumentDescriptor.ReferencedDocument 'Assign the sheet name based off of the file name, with the path and extension removed oSheet.Name = System.IO.Path.GetFileNameWithoutExtension(oModel.FullFileName) Catch 'There is no drawing views End Try Next InventorVb.DocumentUpdate()
Tip:
You can add this rule to your template and start to use it in the new files, or use it as an external rule to use it when you like in any drawing.
I use it as an external Rule.
CCarreiras