11-07-2019
07:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
11-07-2019
07:54 AM
I need changing the view scale format: just to change : to / or vice versa while existing scale remains the same.
Could someone help me.
Thanks.
'https://forums.autodesk.com/t5/inventor-customization/ilogic-code-to-change-view-label-text/td-p/3625130
'https://forums.autodesk.com/t5/inventor-customization/exsisting-ilogic-rule-view-label-fitted-with-item-number/td-p/6323006
oModelDoc = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
Dim oSSet As SelectSet = ThisDoc.Document.SelectSet
If oSSet.Count = 0 Then
MessageBox.Show("SELECT A DRAWING VIEW FIRST!", "INSTRUCTIONS")
Exit Sub
End If
Dim oView_Names As New ArrayList
oView_Names.Add("DESN - PN")
oView_Names.Add("DESN - VL")
oView_Selected = InputListBox("Prompt", oView_Names, oView_Names(0), Title := "Title", ListName := "List")
'Reference to the drawing view from the 1st selected object
Dim oView As DrawingView = TryCast(oSSet.Item(1), DrawingView)
If oView IsNot Nothing Then
oView.ShowLabel = True
If oView_Selected = "DESN - PN" Then
'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'> - <Property Document='model' PropertySet='Design Tracking Properties' Property='Part Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property></StyleOverride>"
'oStringMass = "<Br/><StyleOverride Underline='False' FontSize='0.35'>EST UNIT MASS = <PhysicalProperty PhysicalPropertyID='72449' Precision='2'>MASS</PhysicalProperty></StyleOverride>"
oStringScale = "<Br/><StyleOverride FontSize='0.3'>(SCALE: <DrawingViewScale/>)</StyleOverride>"
'add to the view label
oView.Label.FormattedText = oDescription & oPartNumber & oStringMass & oStringScale
Else If oView_Selected = "DESN - VL" Then
Dim DESN_VLs As New ArrayList
DESN_VLs.Add(iProperties.Value(oModelDoc, "Custom", "DESN_VL"))
DESN_VLs.Add("HSS")
DESN_VLs.Add("BEAM WELDMENT")
DESN_VLs.Add("BRACING WELDMENT")
DESN_VLs.Add("PLATE")
DESN_VLs.Add("ANGLE")
DESN_VL_Selected = InputListBox("Prompt", DESN_VLs, DESN_VLs(0), Title := "DESCRIPTION for VL", ListName := "Select")
DESN_VL_EDIT = InputBox("EDIT/ACCEPT DESN_VL ", "Title", DESN_VL_Selected)
iProperties.Value(oModelDoc, "Custom", "DESN_VL") = DESN_VL_EDIT
oView_Selected_New = InputBox("EDIT/ACCEPT CUSTOM TEXT: ", "TYPE TEXT TO SUIT", DESN_VL_EDIT)
'format the text first line
oStringItem = "<StyleOverride Underline='True'>" & oView_Selected_New & "</StyleOverride>"
'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'> - <Property Document='model' PropertySet='Design Tracking Properties' Property='Part Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property></StyleOverride>"
'oStringMass = "<Br/><StyleOverride Underline='False' FontSize='0.35'>EST UNIT MASS = <PhysicalProperty PhysicalPropertyID='72449' Precision='2'>MASS</PhysicalProperty></StyleOverride>"
oStringScale = "<Br/><StyleOverride FontSize='0.3'>(SCALE: <DrawingViewScale/>)</StyleOverride>"
'add to the view label
oView.Label.FormattedText = oStringItem & oPartNumber & oStringScale
End If
Else
MessageBox.Show("The selected object is not a drawing view", "iLogic")
End If
'Dim oApp As Application: oApp = ThisApplication
'Dim oDoc As DrawingDocument: oDoc = oApp.ActiveDocument
Dim oSheets As Sheets
Dim oSheet As Sheet
Dim oViews As DrawingViews
'Dim oView As DrawingView
Solved! Go to Solution.