SetView 方法 (ActiveX)
将视口中的视图设置为 Views 集合对象中保存的视图。 支持的平台:仅限 Windows 返回值 (RetVal)无返回值。 言论没有其他评论。 例子VBA: Sub Example_SetView()
' This example creates a new view.
' It then changes the active viewport to
' the newly created view.
' Create a new view
Dim viewObj As AcadView
Set viewObj = ThisDrawing.Views.Add("TESTVIEW")
' Set the view characteristics
viewObj.center(0) = 374: viewObj.center(1) = 313
viewObj.Width = 450
viewObj.Height = 354
' Get the current active viewport
Dim viewportObj As AcadViewport
Set viewportObj = ThisDrawing.ActiveViewport
MsgBox "Change to the saved view.", , "SetView Example"
' Set the view in the viewport
viewportObj.SetView viewObj
ThisDrawing.ActiveViewport = viewportObj
ThisDrawing.Regen True
End Sub
可视化 LISP: (vl-load-com)
(defun c:Example_SetView()
;; This example creates a new view.
;; It then changes the active viewport to
;; the newly created view.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Create a new view
(setq viewObj (vla-Add (vla-get-Views doc) "TESTVIEW"))
;; Set the view characteristics
(setq centerPoint (vlax-make-safearray vlax-vbDouble '(0 . 1)))
(vlax-safearray-fill centerPoint '(374 313))
(vla-put-Center viewObj centerPoint)
(vla-put-Width viewObj 450)
(vla-put-height viewObj 354)
; Get the current active viewport
(setq viewportObj (vla-get-ActiveViewport doc))
(alert "Change to the saved view.")
;; Set the view in the viewport
(vla-SetView viewportObj viewObj)
(vla-put-ActiveViewport doc viewportObj)
(vla-Regen doc :vlax-true)
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-11-1 08:29
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.