Inventor doesn's support any auto scaling functionality for a set of drawing
views. It's possible to write your own though. Below are two of the key
functions from a much larger program I wrote a while ago that does this.
The ComputeViewScale takes all of the arguments as input and returns the
scale to use. The ComputeViewPositions ByVal arguments are inputs and the
ByRef are outputs. It computes the actual position where to create each
view.
Private Function ComputeViewScale(ByVal PartLength As Double, ByVal
PartHeight As Double, ByVal PartDepth As Double, ByVal AreaWidth As Double,
ByVal AreaHeight As Double, ByVal ViewSpacing As Double, ByVal BorderSpacing
As Double) As Double
On Error GoTo ErrorFound
' Initialize an array with the valid scale values from 1/128 to 64
Dim adScales(13) As Double
adScales(0) = 1 / 128
Dim i As Integer
For i = 1 To 13
adScales(i) = adScales(i - 1) * 2
Next
' Determine the best scale by looking at the view widths.
Dim dWidthScale As Double
dWidthScale = -1
For i = 0 To 13
If ((PartLength + PartDepth) * adScales(i)) + (ViewSpacing +
BorderSpacing * 2) <= AreaWidth Then
dWidthScale = adScales(i)
Else
Exit For
End If
Next
' Determine the best scale by looking at the view heights.
Dim dHeightScale As Double
dHeightScale = -1
For i = 0 To 13
If ((PartHeight + PartDepth) * adScales(i)) + (ViewSpacing +
BorderSpacing * 2) <= AreaHeight Then
dHeightScale = adScales(i)
Else
Exit For
End If
Next
If dWidthScale < dHeightScale Then
ComputeViewScale = dWidthScale
Else
ComputeViewScale = dHeightScale
End If
Exit Function
ErrorFound:
ComputeViewScale = -1
End Function
Private Function ComputeViewPositions(ByVal ViewScale As Double, _
ByVal PartLength As Double, _
ByVal PartHeight As Double, _
ByVal PartDepth As Double, _
ByVal BorderWidth As Double, _
ByVal BorderHeight As Double, _
ByVal BorderXOffset As Double, _
ByVal BorderYOffset As Double, _
ByVal ViewSpacing As Double, _
ByVal BorderSpacing As Double, _
ByRef FrontViewCenter As Point2d, _
ByRef RightViewCenter As Point2d, _
ByRef TopViewCenter As Point2d, _
ByRef IsoViewCenter As Point2d) As
Boolean
On Error GoTo ErrorFound
Dim oTG As TransientGeometry
Set oTG = goApp.TransientGeometry
' Initialize the return points.
Set FrontViewCenter = oTG.CreatePoint2d
Set RightViewCenter = oTG.CreatePoint2d
Set TopViewCenter = oTG.CreatePoint2d
Set IsoViewCenter = oTG.CreatePoint2d
' Account for the scale.
PartLength = PartLength * ViewScale
PartHeight = PartHeight * ViewScale
PartDepth = PartDepth * ViewScale
' Determine the equal spacing between the border and views along the
width of the sheet.
Dim dWidthSpace As Double
dWidthSpace = (BorderWidth - (PartLength + PartDepth)) / 3
' Use half of this spacing to shift if over towards the left side of the
sheet.
dWidthSpace = dWidthSpace * 0.5
' Determine the x positions of the front, right, and top views.
FrontViewCenter.X = BorderXOffset + dWidthSpace + (PartLength / 2)
TopViewCenter.X = FrontViewCenter.X
RightViewCenter.X = FrontViewCenter.X + (PartLength / 2) + dWidthSpace +
(PartDepth / 2)
' Determine the equal spacing between the front and top views along the
height of the sheet.
Dim dHeightSpace As Double
dHeightSpace = (BorderHeight - (PartHeight + PartDepth)) / 3
' Determine the y positions of the front, right, and top views.
FrontViewCenter.Y = BorderYOffset + dHeightSpace + (PartHeight / 2)
RightViewCenter.Y = FrontViewCenter.Y
TopViewCenter.Y = FrontViewCenter.Y + (PartHeight / 2) + dHeightSpace +
(PartDepth / 2)
ComputeViewPositions = True
Exit Function
ErrorFound:
ComputeViewPositions = False
End Function
--
Brian Ekins
Autodesk Inventor API