iLogic View Label for all views on select sheets
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
For several months I've been trying to get an iLogic rule to work but keep coming up short. Any assistance would be greatly appreciated.
I've been able to piece together code from others to get most of the way there, but I need just one little piece to get over the hump.
What I'm looking for is to change all of the view labels on a single sheet (of flat patterns), with the Sheet Name "CUT FILES" to the Part Title and Description iprops of the part in the view. This particular sheet is in a drawing with multiple sheets, but typically only one will have the name "CUT FILES". I would like to set this rule to run prior to save, to ensure consistency in view labeling so having a code that only runs on one sheet is not ideal.
Below is the rule that I have together at this point, but it doesn't work. It seems to just quit when it gets to SyntaxEditor Code Snippet
If ActiveSheet.Name IsNot "CUT FILES" Then Continue For
If I remove that particular line the code runs, but on every view on every sheet.
SyntaxEditor Code Snippet
Dim oDoc As DrawingDocument: oDoc = ThisDoc.Document Dim oSheets As Sheets Dim oSheet As Sheet Dim oViews As DrawingViews Dim oView As DrawingView oSheets = oDoc.Sheets For Each oSheet In oSheets If ActiveSheet.Name IsNot "CUT FILES" Then Continue For oViews = oSheet.DrawingViews For Each oView In oViews If oView IsNot Nothing Then oView.ShowLabel = True 'format the model iproperties oStringTitle = "<StyleOverride Underline='True' FontSize='1.27'> <Property Document='model' PropertySet='Summary Information' Property='Title' FormatID='{F29F85E0-4FF9-1068-AB91-08002B27B3D9}' PropertyID='2'>TITLE</Property></StyleOverride>" oStringDescription = "<Br/><StyleOverride FontSize='1.27'> <Property Document='model' PropertySet='Design Tracking Properties' Property='Description' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='29'>DESCRIPTION</Property></StyleOverride>" 'add to the view label oView.Label.FormattedText = oStringTitle & oStringDescription End If Next Next
Thanks
LM
Inventor 2018
Inventor 2021.2 , AutoCAD 2021, 3DS Max 2021