Mirror 方法 (ActiveX)
创建围绕轴的平面对象的镜像副本。 支持的平台:仅限 Windows 签名VBA: RetVal = object.Mirror(Point1, Point2)
返回值 (RetVal)类型:对象 此对象可以是任何图形对象之一,并且是镜像原始对象的结果。 言论指定为参数的两个点将成为反映基本对象的线的端点。 选定对象 Point1 和 Point2 指定镜像轴 镜像对象 此方法将反射图像放入图形中并保留原始对象。若要删除原始对象,请使用该方法。Delete 您可以在图纸空间中镜像对象,但这样做不会影响其模型空间视图或模型空间对象。Viewport AutoCAD 会检查要复制的对象是否拥有任何其他对象。如果是这样,它也会对这些对象执行复制。该过程将继续进行,直到复制了所有拥有的对象。
注意:不能在同时循环访问集合时执行此方法。迭代将为只读操作打开工作空间,而此方法将尝试执行读写操作。在调用此方法之前,请完成任何迭代。
AttributeReference:不应尝试在对象上使用此方法。 对象继承此方法,因为它们是绘图对象之一,但是,对属性参照执行此操作是不可行的。AttributeReferenceAttributeReference
注意:若要管理文本对象的反射属性,请使用 MIRRTEXT 系统变量。MIRRTEXT 的默认设置为 On (1),这会导致文本对象像任何其他对象一样镜像。当 MIRRTEXT 关闭 (0) 时,文本不会镜像。
镜像之前 镜像后 (MIRRTEXT = 1) 镜像后 (MIRRTEXT = 0) 例子VBA: Sub Example_Mirror() ' This example creates a lightweight polyline ' and then mirrors that polyline. ' Create the polyline Dim plineObj As AcadLWPolyline Dim points(0 To 11) As Double points(0) = 1: points(1) = 1 points(2) = 1: points(3) = 2 points(4) = 2: points(5) = 2 points(6) = 3: points(7) = 2 points(8) = 4: points(9) = 4 points(10) = 4: points(11) = 1 Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points) plineObj.Closed = True ZoomAll ' Define the mirror axis Dim point1(0 To 2) As Double Dim point2(0 To 2) As Double point1(0) = 0: point1(1) = 4.25: point1(2) = 0 point2(0) = 4: point2(1) = 4.25: point2(2) = 0 MsgBox "Mirror the polyline.", , "Mirror Example" ' Mirror the polyline Dim mirrorObj As AcadLWPolyline Set mirrorObj = plineObj.Mirror(point1, point2) ZoomAll MsgBox "Mirror completed.", , "Mirror Example" End Sub 可视化 LISP: (vl-load-com) (defun c:Example_Mirror() ;; This example creates a lightweight polyline ;; and then mirrors that polyline. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Create the polyline (setq points (vlax-make-safearray vlax-vbDouble '(0 . 11))) (vlax-safearray-fill points '(1 1 1 2 2 2 3 2 4 4 4 1 ) ) (setq modelSpace (vla-get-ModelSpace doc)) (setq plineObj (vla-AddLightWeightPolyline modelSpace points)) (vla-put-Closed plineObj :vlax-true) (vla-ZoomAll acadObj) ;; Define the mirror axis (setq point1 (vlax-3d-point 0 4.25 0) point2 (vlax-3d-point 4 4.25 0)) (alert "Mirror the polyline.") ;; Mirror the polyline (setq mirrorObj (vla-Mirror plineObj point1 point2)) (vla-ZoomAll acadObj) (alert "Mirror completed.") ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-19 07:27
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.