明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2417|回复: 5

版主:如何根据选择的线条来创建面域?

[复制链接]
发表于 2004-9-29 14:16:00 | 显示全部楼层 |阅读模式
版主:如何根据选择的线条来创建面域? 我的代码如下: 'On Error Resume Next
Dim SsetObj As AcadSelectionSet
Dim FilterType(7) As Integer
Dim FilterData(7) As Variant
frmMain.Hide
ThisDrawing.SelectionSets("AA").Delete
Set SsetObj = ThisDrawing.SelectionSets.Add("AA")
FilterType(0) = -4
FilterData(0) = "<or"
FilterType(1) = 0
FilterData(1) = "Arc"
FilterType(2) = 0
FilterData(2) = "Circle"
FilterType(3) = 0
FilterData(3) = "Ellipse"
FilterType(4) = 0
FilterData(4) = "Line"
FilterType(5) = 0
FilterData(5) = "Pline"
FilterType(6) = 0
FilterData(6) = "Spline"
FilterType(7) = -4
FilterData(7) = "or>"
SsetObj.SelectOnScreen FilterType, FilterData

Dim m As Integer '选择集中的元素个数
m = SsetObj.Count
Dim element() As AcadEntity
ReDim element(m)
For i = 1 To m
Set element(i - 1) = SsetObj.Item(i - 1)
Next
Dim Region As Variant
Region = ThisDrawing.ModelSpace.AddRegion(element)
tdArea.Text = Region.Area

'返回对话框
frmMain.Show 这句代码处提示:(方法'Addregion'作用于对象'IaCadModelSpace'时失败) Region = ThisDrawing.ModelSpace.AddRegion(element)
发表于 2004-9-29 14:20:00 | 显示全部楼层
ReDim element(m-1)


For i =        0 To m-1
 楼主| 发表于 2004-9-29 14:25:00 | 显示全部楼层
改了,还是Region = ThisDrawing.ModelSpace.AddRegion(element)处


提示:(方法'AddRegion'作用于对象'IaCadModelSpace'时失败)
 楼主| 发表于 2004-9-29 14:37:00 | 显示全部楼层
改为了以下代码后: Dim element() As AcadEntity
ReDim element(m - 1)
For i = 0 To m - 1
Set element(i) = SsetObj.Item(i)
Next
Dim Region As Variant
Region = ThisDrawing.ModelSpace.AddRegion(element)
msgbox Region.area 在msgbox Region.area出错提示:“要求对象”
 楼主| 发表于 2004-9-29 14:40:00 | 显示全部楼层
改成这样就行了。


sgBox Region(0).Area


谢谢版主!!!!
发表于 2004-9-29 14:40:00 | 显示全部楼层
AddRegion的返回值是Region对象的数组,帮助要看全!!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-28 02:39 , Processed in 0.183074 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表