Message 1 of 3
Scale inventor drawing views automaticly and ISO views specifly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
The code below, I have made to make al the drawing views at an fittable scale. In another code it works, but I want the ISO view about half the scale of the normal views. The code below gives a fault, can someone help me to fix it?
Dim oDrawingDoc As DrawingDocument = ThisApplication.ActiveDocument Dim oSheet As Sheet = oDrawingDoc.Sheets.Item(1) Dim oView As DrawingView = oSheet.DrawingViews.Item(1) Dim oDMDef As ComponentDefinition = oView.ReferencedDocumentDescriptor.ReferencedDocument.ComponentDefinition Dim oWidth As Double =Abs(oDMDef.RangeBox.MaxPoint.Y - oDMDef.RangeBox.MinPoint.Y)*10 Dim oLength As Double= Abs(oDMDef.RangeBox.MaxPoint.X - oDMDef.RangeBox.MinPoint.X)*10 Dim oHeight As Double=Abs(oDMDef.RangeBox.MaxPoint.Z - oDMDef.RangeBox.MinPoint.Z) * 10 Dim oMaxLength As Double= Max(Max(oLength,oWidth),oHeight) Dim oScale As String Dim oView As DrawingView For Each oView In oViews If oMaxLength < 5000 Then Dim orientype As ViewOrientationTypeEnum orientype = oView.Camera.ViewOrientationType If orientype = 10756 Or orientype = 10757 Or orientype = 10764 Or orientype = 10758 Or orientype = 10755 Or orientype = 10754 Then oScale = "1 : 50" End If If orientype = 10763 Or orientype = 10762 Or orientype = 10761 Or orientype = 10760 Or orientype = 10759 Then oScale = "1 : 100" End If End If If oMaxLength < 2500 Then Dim orientype As ViewOrientationTypeEnum orientype = oView.Camera.ViewOrientationType If orientype = 10756 Or orientype = 10757 Or orientype = 10764 Or orientype = 10758 Or orientype = 10755 Or orientype = 10754 Then oScale = "1 : 20" End If If orientype = 10763 Or orientype = 10762 Or orientype = 10761 Or orientype = 10760 Or orientype = 10759 Then oScale = "1 : 50" End If End If If oMaxLength < 2500 Then Dim orientype As ViewOrientationTypeEnum orientype = oView.Camera.ViewOrientationType If orientype = 10756 Or orientype = 10757 Or orientype = 10764 Or orientype = 10758 Or orientype = 10755 Or orientype = 10754 Then oScale = "1 : 10" End If If orientype = 10763 Or orientype = 10762 Or orientype = 10761 Or orientype = 10760 Or orientype = 10759 Then oScale = "1 : 20" End If End If If oMaxLength < 1250 Then Dim orientype As ViewOrientationTypeEnum orientype = oView.Camera.ViewOrientationType If orientype = 10756 Or orientype = 10757 Or orientype = 10764 Or orientype = 10758 Or orientype = 10755 Or orientype = 10754 Then oScale = "1 : 5" End If If orientype = 10763 Or orientype = 10762 Or orientype = 10761 Or orientype = 10760 Or orientype = 10759 Then oScale = "1 : 2" End If End If If oMaxLength < 625 Then Dim orientype As ViewOrientationTypeEnum orientype = oView.Camera.ViewOrientationType If orientype = 10756 Or orientype = 10757 Or orientype = 10764 Or orientype = 10758 Or orientype = 10755 Or orientype = 10754 Then oScale = "1 : 2.5" End If If orientype = 10763 Or orientype = 10762 Or orientype = 10761 Or orientype = 10760 Or orientype = 10759 Then oScale = "1 : 5" End If End If If oMaxLength < 500 Then Dim orientype As ViewOrientationTypeEnum orientype = oView.Camera.ViewOrientationType If orientype = 10756 Or orientype = 10757 Or orientype = 10764 Or orientype = 10758 Or orientype = 10755 Or orientype = 10754 Then oScale = "1 : 2" End If If orientype = 10763 Or orientype = 10762 Or orientype = 10761 Or orientype = 10760 Or orientype = 10759 Then oScale = "1 : 5" End If End If Next