- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This has got me stumped. I am trying to rewrite Curtis Waguespack's ilogic code to modify drawing view labels from this post http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/Custom-user-properties-in-view-label-o...
The completed label should appear like this
<Description> - Mk <Part Number>
Est Unit Mass = X kg
(Scale 1:1)
At this point I have 2 problems
1. I want to add the physical mass to the second line and would prefer to use the calculated physcial property rather than the a custom iproperty. If editing the view label, it would the property access under physcial properties.
2. I want to rewrite the code so it is selective or per view - in otherwords, I only want it to modify a single view I select once the code is run. At this point I know I need to remove the For loop but I dont have a clue as to how to make it selective.
So far this is what I have, any help would be much appreciated
Steve
'start of ilogic codeDim oDoc As DrawingDocument: oDoc = ThisDoc.Document oModel = ThisDoc.ModelDocument Dim oSheets As Sheets Dim oSheet As Sheet Dim oViews As DrawingViews Dim oView As DrawingView oSheets = oDoc.Sheets For Each oSheet In oSheets oViews = oSheet.DrawingViews For Each oView In oViews oView.ShowLabel = True Try 'format the model iproperties oDescription = "<StyleOverride Underline='True'><Property Document='model' PropertySet='Design Tracking Properties' Property='Description' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='29'>DESCRIPTION</Property></StyleOverride>" oPartNumber = "<StyleOverride Underline='True'> - Mk <Property Document='model' PropertySet='Design Tracking Properties' Property='Part Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property></StyleOverride>" 'Dim oMassStr As String = Round(oDoc.ComponentDefinition.MassProperties.Mass,0) 'format the custom iproperty string and add the property ID oStringMass = "<Br/><StyleOverride Underline='False' FontSize='0.35'>EST UNIT MASS = <PhysicalProperty PhysicalPropertyID='72449' Precision='0'>MASS</PhysicalProperty></Property>,</StyleOverride>" 'oStringMass = "<PhysicalProperty PhysicalPropertyID='72449' Precision='0'>MASS</PhysicalProperty></Property>" oStringScale = "<Br/><StyleOverride FontSize='0.3'>(Scale <DrawingViewScale/>)</StyleOverride>" 'add the custom iproperties to the view label 'oView.Label.FormattedText = oDescription & oPartNumber & oStringMass & oStringScale oView.Label.FormattedText = oDescription & oPartNumber & oStringScale Catch 'do nothing if error End Try Next Next 'end of ilogic code
Solved! Go to Solution.