CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2022 开发者帮助

关于创建实体 (VBA/ActiveX)

2024-5-18 18:43| 发布者: admin| 查看: 13| 评论: 0|原作者: admin|来自: AutoCAD

关于创建实体 (VBA/ActiveX)

实体对象(对象)表示对象的整个体积。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-6-27 15:56

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部