获取文档的模型空间集合。 支持的平台:仅窗口 言论没有额外的评论。 例子工 务 局: Sub Example_ModelSpace()
' This example adds a line and a circle to model space.
' The line is added using a user-defined variable representing
' the model space. The circle is added without using the
' user-defined variable. Either use of the ModelSpace
' property is valid.
' Define the line
Dim lineObj As AcadLine
Dim startPoint(0 To 2) As Double
Dim endPoint(0 To 2) As Double
startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
endPoint(0) = 4: endPoint(1) = 4: endPoint(2) = 0
' Add the line to model space using the mspace variable
Dim mspace As AcadModelSpace
Set mspace = ThisDrawing.ModelSpace
Set lineObj = mspace.AddLine(startPoint, endPoint)
' Define a circle
Dim circleObj As AcadCircle
Dim center(0 To 2) As Double
Dim radius As Double
center(0) = 4: center(1) = 4: center(2) = 0
radius = 1
' Add the circle to model space without using the mspace variable
Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, radius)
ZoomAll
End Sub
Visual LISP: (vl-load-com)
(defun c:Example_ModelSpace()
;; This example adds a line and a circle to model space.
;; The line is added using a user-defined variable representing
;; the model space. The circle is added without using the
;; user-defined variable. Either use of the ModelSpace
;; property is valid.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Define the line
(setq startPoint (vlax-3d-point 0 0 0)
endPoint (vlax-3d-point 4 4 0))
;; Add the line to model space using the mspace variable
(setq mspace (vla-get-ModelSpace doc))
(setq lineObj (vla-AddLine mspace startPoint endPoint))
;; Define a circle
(setq center (vlax-3d-point 4 4 0)
radius 1)
;; Add the circle to model space without using the mspace variable
(setq circleObj (vla-AddCircle mspace center radius))
(vla-ZoomAll acadObj)
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-31 00:40
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.