删除视口配置。 支持的平台:仅窗口 返回值(RetVal)无返回值。 言论视口配置由使用该方法拆分的单个视口组成。拆分视口后,生成的视口将被视为视口配置。配置中的所有视口与拆分前的原始视口同名。Split 例子工 务 局: Sub Example_DeleteConfiguration() ' This example creates a new viewport and splits ' the viewport into 4 windows. ' It then deletes the viewport configuration Dim oldViewport As AcadViewport Set oldViewport = ThisDrawing.ActiveViewport ' Create a new viewport and make it active Dim newViewport As AcadViewport Set newViewport = ThisDrawing.Viewports.Add("TESTVIEWPORT") ThisDrawing.ActiveViewport = newViewport ' Split the viewport in 4 windows newViewport.Split acViewport4 ' Make the newly split viewport active ThisDrawing.ActiveViewport = newViewport MsgBox "The viewport configuration split into 4 windows." ' Delete the viewport configuration ThisDrawing.ActiveViewport = oldViewport ThisDrawing.Viewports.DeleteConfiguration ("TESTVIEWPORT") ThisDrawing.Regen acAllViewports MsgBox "The viewport configuration has been deleted." End Sub Visual LISP: (vl-load-com) (defun c:Example_DeleteConfiguration() ;; This example creates a new viewport and splits ;; the viewport into 4 windows. ;; It then deletes the viewport configuration (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) (setq oldViewport (vla-Add (vla-get-Viewports doc) "CurrentViewport")) ;; Create a new viewport and make it active (setq newViewport (vla-Add (vla-get-Viewports doc) "NewViewport")) (vla-put-ActiveViewport doc newViewport) ;; Split the viewport in 4 windows (vla-Split newViewport acViewport4) ;; Make the newly split viewport active (vla-put-ActiveViewport doc newViewport) (alert "The viewport configuration split into 4 windows.") ;; Delete the viewport configuration (vla-put-ActiveViewport doc oldViewport) (vla-DeleteConfiguration (vla-get-Viewports doc) "NewViewport") (vla-DeleteConfiguration (vla-get-Viewports doc) "CurrentViewport") (vla-Regen doc acAllViewports) (alert "The viewport configurations have been deleted and original viewport restored.") ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:34
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.