明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2254|回复: 1

如何region

[复制链接]
发表于 2002-8-12 18:23:00 | 显示全部楼层 |阅读模式
创建一选择集,选择集中为封闭多义线
如何对每一多义线进行addregion 操作
发表于 2002-8-17 19:37:00 | 显示全部楼层

如内程序,试试看

Sub AddRegFromPLline()
   
    Dim ftype As Variant
    Dim fdata As Variant
    Dim PlineEnt(0) As AcadEntity
    Dim PlineSet As AcadSelectionSet
   
    BuildFilter ftype, fdate, 0, "*POLYLINE"
   
    Set PlineSet = CreateSelectionSet
    PlineSet.SelectOnScreen ftype, fdate
   
    Dim Entry As AcadEntity
    On Error Resume Next
    For Each Entry In PlineSet
        Set PlineEnt(0) = Entry
        ThisDrawing.ModelSpace.AddRegion PlineEnt
    Next Entry

End Sub

Public Function CreateSelectionSet(Optional ssName As String = "ss") As AcadSelectionSet

    Dim ss As AcadSelectionSet
   
    On Error Resume Next
    Set ss = ThisDrawing.SelectionSets(ssName)
    If Err Then Set ss = ThisDrawing.SelectionSets.Add(ssName)
    ss.Clear
    Set CreateSelectionSet = ss


End Function

Public Sub BuildFilter(typeArray, dataArray, ParamArray gCodes())
    Dim ftype() As Integer, fdata()
    Dim index As Long, i As Long
   
    index = LBound(gCodes) - 1
        
    For i = LBound(gCodes) To UBound(gCodes) Step 2
        index = index + 1
        ReDim Preserve ftype(0 To index)
        ReDim Preserve fdata(0 To index)
        ftype(index) = CInt(gCodes(i))
        fdata(index) = gCodes(i + 1)
    Next
    typeArray = ftype: dataArray = fdata
End Sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-28 22:31 , Processed in 0.162101 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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