Quantcast
Channel: Manufacturing DevBlog
Viewing all articles
Browse latest Browse all 518

Set Drawing View Width

$
0
0

By Adam Nagy

You cannot set the Width or Height of a DrawingView directly. However, you can calculate the Scale necessary to achieve the width or height you need. Here is a VBA code demonstrating it. First you need to select the drawing view in question through the UI then run the code:

Sub SetDrawingViewWidth()
  Dim dv As DrawingView
  Set dv = ThisApplication.ActiveDocument.SelectSet(1)' Current width
  Dim cw As Double
  cw = dv.Width' New width we want' Set in 'cm' (internal length unit)
  Dim nw As Double
  nw = 10' New scale
  Dim ns As Double
  ns = nw / cw * dv.Scale
  dv.[Scale] = ns
  Call MsgBox("Width = " + Str(dv.Width))
End Sub

Viewwidth

 


Viewing all articles
Browse latest Browse all 518

Trending Articles