沿平面镜像对象

AutoCAD ActiveX/VBA

 
沿平面镜像对象
 
 
 

使用 Mirror3D 方法可以沿由三点指定的特定镜像平面镜像对象。

有关在三维中镜像对象的详细信息,请参见《用户手册》中的“镜像对象”。

在三维空间中镜像对象

本样例在模型空间中创建一个长方体,然后根据某个平面镜像该长方体,并将镜像得到的长方体着色为红色。

Sub Ch8_MirrorABox3D()
    ' 创建长方体对象
    Dim boxObj As Acad3DSolid
    Dim length As Double
    Dim width As Double
    Dim height As Double
    Dim center(0 To 2) As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0
    length = 5#: width = 7: height = 10#
      
    ' 在模型空间中创建长方体 (3DSolid) 对象
    Set boxObj = ThisDrawing.ModelSpace. _
                AddBox(center, length, width, height)
      
    ' 用三个点定义镜像平面
    Dim mirrorPt1(0 To 2) As Double
    Dim mirrorPt2(0 To 2) As Double
    Dim mirrorPt3(0 To 2) As Double
      
    mirrorPt1(0) = 1.25: mirrorPt1(1) = 0: mirrorPt1(2) = 0
    mirrorPt2(0) = 1.25: mirrorPt2(1) = 2: mirrorPt2(2) = 0
    mirrorPt3(0) = 1.25: mirrorPt3(1) = 2: mirrorPt3(2) = 2
      
    ' 镜像长方体
    Dim mirrorBoxObj As Acad3DSolid
    Set mirrorBoxObj = boxObj.Mirror3D _
                (mirrorPt1, mirrorPt2, mirrorPt3)
    mirrorBoxObj.Color = acRed
    ZoomAll
End Sub