VB二次开发CAD关于选择集的语法问题,请帮忙从下面的程序中找一下问题到底出在哪? 5
我想选择“GCZJ”层的所有文字,但选不上,程序如下:PrivateSubcommand2_Click()AppActivateacadApp.CaptionOnErro...
我想选择“GCZJ”层的所有文字,但选不上,程序如下:
Private Sub command2_Click()
AppActivate acadApp.Caption
On Error Resume Next
Dim ssetobj As AcadSelectionSet
Set ssetobj = acadApp.ActiveDocument.SelectionSets.Add("test1")
Dim FType(0 To 1) As Integer
Dim FData(0 To 1) As Variant
FType(0) = 0
FData(0) = "TEXT"
FType(1) = 8
FData(1) = "GCZJ"
ssetobj.Select acSelectionSetAll, , , FType, FData
For Each pickedobjs In ssetobj
pickedobjs.Color = acGreen '把选上的实体变成绿色
pickedobjs.Update
Next
ssetobj.Delete
AppActivate form1.Caption
End Sub
求高手分析一下问题出在哪?谢谢了
可以肯定就是过滤器设置的问题,我不知道过滤器到底该怎样设? 展开
Private Sub command2_Click()
AppActivate acadApp.Caption
On Error Resume Next
Dim ssetobj As AcadSelectionSet
Set ssetobj = acadApp.ActiveDocument.SelectionSets.Add("test1")
Dim FType(0 To 1) As Integer
Dim FData(0 To 1) As Variant
FType(0) = 0
FData(0) = "TEXT"
FType(1) = 8
FData(1) = "GCZJ"
ssetobj.Select acSelectionSetAll, , , FType, FData
For Each pickedobjs In ssetobj
pickedobjs.Color = acGreen '把选上的实体变成绿色
pickedobjs.Update
Next
ssetobj.Delete
AppActivate form1.Caption
End Sub
求高手分析一下问题出在哪?谢谢了
可以肯定就是过滤器设置的问题,我不知道过滤器到底该怎样设? 展开
2个回答
展开全部
回答过一次了
选集过滤没问题,具体参考CAD的《DXF参考》
你删掉On Error Resume Next再测试一下,看是哪里出了问题
查看一下是否引用了CAD,图层字母是否区分大小写
以下我通过了测试
Dim acadApp As AcadApplication
Dim acadDoc As AcadDocument
Private Sub Command1_Click()
On Error Resume Next
Set acadApp = GetObject(, "AutoCAD.Application")
If Err Then
Err.Clear
Set acadApp = CreateObject("AutoCAD.Application")
End If
Set acadDoc = acadApp.ActiveDocument
Dim FType(0 To 1) As Integer
Dim FData(0 To 1) As Variant
FType(0) = 0
FData(0) = "TEXT"
FType(1) = 8
FData(1) = "GCJZ"
Dim ssetobj As AcadSelectionSet
Set ssetobj = acadDoc.SelectionSets.Add("test2")
ssetobj.Select acSelectionSetAll, , , FType, FData
For Each pickedobjs In ssetobj
pickedobjs.Color = acGreen '把选上的实体变成绿色
pickedobjs.Update
Next
ssetobj.Delete
End Sub
选集过滤没问题,具体参考CAD的《DXF参考》
你删掉On Error Resume Next再测试一下,看是哪里出了问题
查看一下是否引用了CAD,图层字母是否区分大小写
以下我通过了测试
Dim acadApp As AcadApplication
Dim acadDoc As AcadDocument
Private Sub Command1_Click()
On Error Resume Next
Set acadApp = GetObject(, "AutoCAD.Application")
If Err Then
Err.Clear
Set acadApp = CreateObject("AutoCAD.Application")
End If
Set acadDoc = acadApp.ActiveDocument
Dim FType(0 To 1) As Integer
Dim FData(0 To 1) As Variant
FType(0) = 0
FData(0) = "TEXT"
FType(1) = 8
FData(1) = "GCJZ"
Dim ssetobj As AcadSelectionSet
Set ssetobj = acadDoc.SelectionSets.Add("test2")
ssetobj.Select acSelectionSetAll, , , FType, FData
For Each pickedobjs In ssetobj
pickedobjs.Color = acGreen '把选上的实体变成绿色
pickedobjs.Update
Next
ssetobj.Delete
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
个就很快了,主要看一下模块,模块知道了,才能谈CAD开发,好多东西VB和VBA可以互用,但要把CAD中搞好的模块调出来用
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询