明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1138|回复: 0

多边形转化为CP区域选择的问题

[复制链接]
发表于 2004-8-6 11:37:00 | 显示全部楼层 |阅读模式
Sub Test()
Dim ssetObj As AcadSelectionSet
Dim CC As AcadCircle
Dim points(59) As Double Dim retCoord As Variant
Dim pntcnt As Integer On Error Resume Next
Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_SSET2") On Error GoTo ErrHandle
Dim pFrom, pTo
Dim p1(3) As Double, p2(1) As Double
Dim pPL As AcadLWPolyline
pFrom = ThisDrawing.Utility.GetPoint(, vbCr & "Pls Input First Point:")
pTo = ThisDrawing.Utility.GetPoint(pFrom, vbCr & "Pls Input Second Point")
p1(0) = pFrom(0): p1(1) = pFrom(1)
p1(2) = pTo(0): p1(3) = pTo(1)
Set pPL = ThisDrawing.ModelSpace.AddLightWeightPolyline(p1)
Do While True
pTo = ThisDrawing.Utility.GetPoint(pTo, vbCr & "Pls Input Next Point")
p2(0) = pTo(0): p2(1) = pTo(1)
pPL.AddVertex (UBound(pPL.Coordinates) + 1) / 2, p2
Loop
ErrHandle:
pPL.Closed = True 'points = pPL.Coordinates
retCoord = pPL.Coordinates
pntcnt = UBound(retCoord)
Dim i As Integer
Dim j As Integer
'Dim points As Double
i = 0
Dim dip As String
For j = 0 To pntcnt - 1 Step 2
points(i) = retCoord(j)
points(i + 1) = retCoord(j + 1)
points(i + 1) = 0
i = i + 3

Next j
Dim m As Integer

ssetObj.SelectByPolygon acSelectionSetCrossingPolygon, points For Each CC In ssetObj On Error Resume Next CC.color = acBlue
CC.Update
Next CC
ssetObj.Clear
ssetObj.Erase
ssetObj.Delete
End Sub 此程序是在随风大侠的帮助下编写的多线段定义的多边形转化为CP区域选择的问题,但是在运行中会出现“Run-time error“91”: Object variable or With block variable not set” 请大侠帮我修改与完善次代码,本人涕泪感激!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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