CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

镜像方法 (ActiveX)

2023-1-4 05:27| 发布者: admin| 查看: 595| 评论: 0|来自: AutoCAD

摘要: 围绕轴创建平面对象的镜像副本。

围绕轴创建平面对象的镜像副本。

支持的平台:仅窗口

签名

工 务 局:

RetVal = object.Mirror(Point1, Point2)
对象

类型:所有图形对象属性引用尺寸

此方法适用的对象。

要点1

访问:仅输入

类型:变体(双精度的三元素数组)

指定镜像轴的第一个点的 3D WCS 坐标。

要点2

访问:仅输入

类型:变体(双精度的三元素数组)

指定镜像轴第二个点的 3D WCS 坐标。

返回值(RetVal)

类型:对象

此对象可以是任何绘图对象之一,并且是镜像原始对象的结果。

言论

指定为参数的两个点将成为反映基本对象的线的端点。



所选对象



点 1 和点 2 指定镜像轴



镜像对象

此方法将反射的图像放入图形中并保留原始对象。若要删除原始对象,请使用该方法。Delete

可以在图纸空间中镜像对象,但这样做不会影响其模型空间视图或模型空间对象。Viewport

AutoCAD 检查要复制的对象是否拥有任何其他对象。如果是这样,它也会对这些对象执行复制。该过程将继续,直到复制了所有拥有的对象。

注意:不能在循环访问集合的同时执行此方法。迭代将为只读操作打开工作空间,而此方法将尝试执行读写操作。在调用此方法之前完成任何迭代。

属性引用:不应尝试对对象使用此方法。objects 继承此方法,因为它们是图形对象之一,但是,对属性参照执行此操作是不可行的。AttributeReferenceAttributeReference

注意:若要管理文本对象的反射属性,请使用 MIRRTEXT 系统变量。MIRRTEXT 的默认设置为 On (1),这将导致文本对象像任何其他对象一样镜像。当 MIRRTEXT 关闭 (0) 时,不会镜像文本。


镜像之前



镜像后(MIRRTEXT = 1)



After mirroring (MIRRTEXT = 0)

Examples

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

Visual 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.")
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-11 17:30

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部