乐筑天下

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

(求救)刚学VBA,提取PLINE闭合线顶点坐标为3维坐标时提示类型不匹配

[复制链接]

4

主题

12

帖子

3

银币

初来乍到

Rank: 1

铜币
28
发表于 2006-4-21 08:37:00 | 显示全部楼层 |阅读模式
代码如下:加下划线的地方提示类型不匹配,为什么?二天都没找到原因啊。
Private Sub UserForm_Click()
Dim aa As AcadPolyline
Me.hide
Dim entobj As AcadEntity
Dim coorpoint As Variant
Dim coorpoint1 As Variant
Dim pickpoint As Variant
ThisDrawing.Utility.GetEntity entobj, pickpoint, "请选择闭合多段线"
If StrComp(entobj.ObjectName, "acdbpolyline", 1) = 0 And entobj.Closed = True Then
a = entobj.Area
TextBox1.Text = a
coorpoint = entobj.Coordinates
Else
MsgBox "不是多段线或没有闭合,请检查"
Exit Sub
End If
Dim n As Integer, m As Integer
n = UBound(coorpoint)
m = (n + 1) * 3 / 2 - 1
TextBox2.Text = n
For I = 0 To n Step 2
[U][U]coorpoint1(I * 3 / 2) = coorpoint(I)[/U]
coorpoint1(I * 3 / 2 + 1) = coorpoint(I + 1)
'coorpoint1(I + 2) = 0
Next I
'TextBox2.Text = coorpoint1(5)
Dim sset As AcadSelectionSet
    On Error Resume Next
    If ThisDrawing.SelectionSets.Count  0 Then
        For j = 0 To ThisDrawing.SelectionSets.Count - 1
            Set sset = ThisDrawing.SelectionSets(I)
            sset.Delete
        Next
    End If
Set sset = ThisDrawing.SelectionSets.Add("4")
mode = acSelectionSetCrossingPolygon
'mode = acSelectionSetWindowPolygon
filtertype = 0
filterdata = "text"
sset.SelectByPolygon mode, coorpoint1, filtertype, filterdata
'sset.SelectOnScreen
Dim entry As AcadEntity
For Each entry In sset
entry.Color = acBlue
entry.updata
Next entry
Me.Show
End Sub
回复

使用道具 举报

7

主题

51

帖子

2

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
79
发表于 2006-4-21 16:02:00 | 显示全部楼层
因为 你只有写了 Dim coorpoint1 As Variant
而中途你改动了coorpoint = entobj.Coordinates
coorpoint 就变成数组了 当然类型不匹配
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-7-5 16:27 , Processed in 0.647697 second(s), 67 queries .

© 2020-2025 乐筑天下

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