乐筑天下

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

[求助]提示Select 在SelectionSet上失败!请高手指教!!

[复制链接]

4

主题

15

帖子

2

银币

初来乍到

Rank: 1

铜币
31
发表于 2004-2-15 21:56:00 | 显示全部楼层 |阅读模式
Dim mysel As AcadSelectionSet
dim gpcode(2) as integer
dim gpvalue(2) as variant
dim groupcode as variant
dim groupvalue as variant gpcode(0) = 0 : gpvalue(0) = "insert"
gpcode(1) = -4 : gpvalue(1) = "="
gpcode(2) = 2 : gpvalue(2) = blockr.name
groupcode = gpcode
groupvalue = gpvalue
set mysel = acaddoc.SelectionSets.Add("mysel")
mysel.select acSelectionSetAll,,,groupcode,groupvalue
在运行到mysel.select acSelectionSetAll,,,groupcode,groupvalue这句时,提示Select         在SelectionSet 上失败!请高手指教!!
回复

使用道具 举报

124

主题

837

帖子

9

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1333
发表于 2004-2-16 21:28:00 | 显示全部楼层
你写的还挺离谱:
&ltRE class=Code>Sub Example_Select()
    ' This example adds members to a selection set, first by crossing and
    ' then by filtering for circles.
   
    ' Create the selection set
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SSET")
   
   
    ' Add all object to the selection set that lie within a crossing of (28,17,0) and
    ' (-3.3, -3.6,0)
    Dim mode As Integer
    Dim corner1(0 To 2) As Double
    Dim corner2(0 To 2) As Double
   
    mode = acSelectionSetCrossing
    corner1(0) = 28: corner1(1) = 17: corner1(2) = 0
    corner2(0) = -3.3: corner2(1) = -3.6: corner2(2) = 0
    ssetObj.Select mode, corner1, corner2
   
    ' Add all the Circles to the selection set that lie within the crossing of (28,17,0) and
    ' (-3.3, -3.6,0) by filtering from the current drawing
    Dim gpCode(0) As Integer
    Dim dataValue(0) As Variant
    gpCode(0) = 0
    dataValue(0) = "Circle"
   
    Dim groupCode As Variant, dataCode As Variant
    groupCode = gpCode
    dataCode = dataValue
   
    ssetObj.Select mode, corner1, corner2, groupCode, dataCode
   
End Sub
回复

使用道具 举报

4

主题

15

帖子

2

银币

初来乍到

Rank: 1

铜币
31
发表于 2004-2-16 23:42:00 | 显示全部楼层
blockr是我得到的AcadBlockreference对象 blockr.name         是我得到了块名,经检查确实得到了。
acaddoc 是我得到的ActivateDocument         这也是没有错的
gpcode(0) = 0 : gpvalue(0) = "insert"
gpcode(1) = -4 : gpvalue(1) = "="
gpcode(2) = 2 : gpvalue(2) = blockr.name
我是想得到以blockr.name为过滤条件的选择集
Dim mysel As AcadSelectionSet
dim gpcode(2) as integer
dim gpvalue(2) as variant
dim groupcode as variant
dim groupvalue as variant
gpcode(0) = 0 : gpvalue(0) = "insert"
gpcode(1) = -4 : gpvalue(1) = "="
gpcode(2) = 2 : gpvalue(2) = blockr.name
groupcode = gpcode
groupvalue = gpvalue
set mysel = acaddoc.SelectionSets.Add("mysel")
mysel.select acSelectionSetAll,,,groupcode,groupvalue
mysel.select acSelectionSetAll,,,groupcode,groupvalue 这句就是过不去啊
我用的是VB
回复

使用道具 举报

158

主题

2315

帖子

10

银币

顶梁支柱

Rank: 50Rank: 50

铜币
2951
发表于 2004-2-17 12:05:00 | 显示全部楼层
  1.        Dim ss As AcadSelectionSet
  2.        Set ss = CreatSSet
  3.        Dim FilterType As Variant
  4.        Dim FilterData As Variant
  5.        Dim FType(1) As Integer
  6.        Dim FData(1) As Variant
  7.        FType(0) = 0
  8.        FData(0) = "INSERT" '图元名
  9.        FType(1) = 2
  10.        FData(1) = "B-BTL"   '图块名
  11.        FilterType = FType
  12.        FilterData = FData
  13.        ss.Select acSelectionSetAll, , , FilterType, FilterData
以下是用到的创建空白选择集的函数:
  1. Function CreatSSet() As AcadSelectionSet
  2.        On Error Resume Next
  3.        ThisDrawing.SelectionSets("mccad").Delete
  4.        Set CreatSSet = ThisDrawing.SelectionSets.Add("mccad")
  5. End Function
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-15 13:01 , Processed in 0.475780 second(s), 60 queries .

© 2020-2025 乐筑天下

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