乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 25|回复: 1

[求助]由面域拉伸生成实体的疑问?

[复制链接]

4

主题

17

帖子

2

银币

初来乍到

Rank: 1

铜币
33
发表于 2005-11-3 16:54:00 | 显示全部楼层 |阅读模式
想用以下代码拉伸生成实体,结果什么也没有得到,也没有报错?请大家看看!
'构造选择集
    Dim gear As AcadSelectionSet
    On Error Resume Next
    If Not IsNull(AcadApp.ActiveDocument.SelectionSets.Item("gear_set")) Then
        Set gear = AcadApp.ActiveDocument.SelectionSets.Add("gear_set")
    End If
   
    gear.Select acSelectionSetAll
        
    '复制选择集里的对象
    Dim ents(11) As AcadEntity
    For i = 0 To gear.Count - 1
        Set ents(i) = gear.Item(i).Copy
    Next i
      
    '定义面域
    Dim reg As Variant
    Set reg = AcadApp.ActiveDocument.ModelSpace.AddRegion(ents)
                  
    '拉伸实体
    Dim height As Double
    Dim taperAngle As Double
    height = 8
    taperAngle = 0
        
    Dim rack As Acad3DSolid
    Set rack = AcadApp.ActiveDocument.ModelSpace.AddExtrudedSolid(reg, height, taperAngle)
回复

使用道具 举报

4

主题

17

帖子

2

银币

初来乍到

Rank: 1

铜币
33
发表于 2005-11-3 17:00:00 | 显示全部楼层
是不是定义面域部分就出错了?
面域的属性和方法都不能通过reg对象引用啊?
是怎么回事?
另外,我看到帮助文件里类似的例子在使用AddExtrudedSolid方法是第一个参数写成了数组形式,即写成:
Set rack = AcadApp.ActiveDocument.ModelSpace.AddExtrudedSolid(reg(0), height, taperAngle)
帮助中的实体可以拉伸生成,我的却不行,为什么?
帮助中的例子如下:
Sub Example_AddExtrudedSolid()
    ' This example extrudes a solid from a region.
    ' The region is created from an arc and a line.
   
    Dim curves(0 To 1) As AcadEntity    ' Define the arc
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    centerPoint(0) = 5#: centerPoint(1) = 3#: centerPoint(2) = 0#
    radius = 2#
    startAngle = 0
    endAngle = 3.141592
    Set curves(0) = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngle, endAngle)
   
    ' Define the line
    Set curves(1) = ThisDrawing.ModelSpace.AddLine(curves(0).startPoint, curves(0).endPoint)
        
    ' Create the region
    Dim regionObj As Variant
    regionObj = ThisDrawing.ModelSpace.AddRegion(curves)
   
    ' Define the extrusion
    Dim height As Double
    Dim taperAngle As Double
    height = 3
    taperAngle = 0
   
    ' Create the solid
    Dim solidObj As Acad3DSolid
    Set solidObj = ThisDrawing.ModelSpace.AddExtrudedSolid(regionObj(0), height, taperAngle)
               
End Sub
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-7-5 17:22 , Processed in 0.514555 second(s), 57 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表