CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

关于创建实体 (VBA/ActiveX)

2023-1-4 21:08| 发布者: admin| 查看: 887| 评论: 0|来自: AutoCAD

摘要: 实体对象(3DSolid 对象)表示对象的整个体积。

实体对象(对象)表示对象的整个体积。3DSolid

实体是 3D 建模类型中信息最完整且最不明确的。复杂的实体形状也比线框和网格更容易构建和编辑。

您可以从方框、圆锥、圆柱、球体、圆环和楔形等基本实体形状之一创建实体,或者通过沿路径拉伸 2D 对象或绕轴旋转 2D 对象来创建实体。使用以下方法之一创建实体:

  • AddBox
  • AddCone
  • AddCylinder
  • AddEllipticalCone
  • AddEllipticalCylinder
  • AddExtrudedSolid
  • AddExtrudedSolidAlongPath
  • AddRevolvedSolid
  • AddSolid
  • AddSphere
  • AddTorus
  • AddWedge

与网格一样,实体显示为线框,直到您隐藏、着色或渲染它们。此外,您还可以分析实体的质量属性(体积、惯性矩、重心等)。使用以下属性分析实体:

  • MomentOfInertia
  • PrincipalDirections
  • PrincipalMoments
  • ProductOfInertia
  • RadiiOfGyration
  • Volume

该属性控制用于可视化线框的弯曲部分的细分线数。该属性调整着色和隐藏线对象的平滑度。ContourlinesPerSurfaceRenderSmoothness

创建楔形实体

下面的示例在模型空间中创建一个楔形实体。活动视口的查看方向已更新,以便更轻松地显示楔形的三维性质。

Sub Ch8_CreateWedge()
    Dim wedgeObj As Acad3DSolid
    Dim center(0 To 2) As Double
    Dim length As Double
    Dim width As Double
    Dim height As Double

    ' Define the wedge
    center(0) = 5#: center(1) = 5#: center(2) = 0
    length = 10#: width = 15#: height = 20#

    ' Create the wedge in model space
    Set wedgeObj = ThisDrawing.ModelSpace. _
 AddWedge(center, length, width, height)

    ' Change the viewing direction of the viewport
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1
    NewDirection(1) = -1
    NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll
End Sub

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-19 14:38

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部