CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

关于镜像对象 (VBA/ActiveX)

2023-1-5 01:03| 发布者: admin| 查看: 654| 评论: 0|来自: AutoCAD

摘要: 镜像会围绕轴或镜像线创建对象的镜像副本。可以镜像所有图形对象。

镜像会围绕轴或镜像线创建对象的镜像副本。可以镜像所有图形对象。

若要镜像对象,请使用为该对象提供的方法。此方法需要两个坐标作为输入。指定的两个坐标将成为镜像线的端点,基本对象将围绕该镜像线进行反射。在 3D 模式下,此线定向垂直于包含镜像线的 UCS 的XY平面的镜像平面。Mirror

与AutoCAD中的“镜像”命令不同,此方法将反射的图像放入图形中并保留原始对象。(若要删除原始对象,请使用该方法。Erase



要管理对象的反射特性,请使用 AutoCAD MIRRTEXT 系统变量。MIRRTEXT 的默认设置为 On (1),这将导致 Text 对象像镜像任何其他对象一样镜像。当 MIRRTEXT 处于关闭 (0) 时,不会镜像文本。使用 与 方法查询和设置 MIRRTEXT 设置。TextGetVariableSetVariable



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

围绕轴镜像折线

本示例创建一条轻量级折线,并围绕轴镜像该折线。新创建的折线为蓝色。

Sub Ch4_MirrorPolyline()
  ' 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

  ' Mirror the polyline
  Dim mirrorObj As AcadLWPolyline
  Set mirrorObj = plineObj.Mirror(point1, point2)

  Dim col As New AcadAcCmColor
  Call col.SetRGB(125, 175, 235)
  mirrorObj.TrueColor = col

  ZoomAll
End Sub

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-11 18:29

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部