明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1592|回复: 3

哪里错了?文字怎么加入块中

[复制链接]
发表于 2005-7-2 22:27:00 | 显示全部楼层 |阅读模式
如要想把文字说明和对应的直线封装到一起组成一个块 但是文字总是加不进去~~~郁闷,帮忙看看程序哪里有问题?一直抱错~~ Dim ssetObj As AcadSelectionSet
Dim getbiaohao As String
Dim FilterType(5) As Integer
Dim FilterData(5) As Variant
Dim adText As String
Dim adhight As Double
Dim insertionPnt(0 To 2) As Double
Dim blockObj As AcadBlock
Dim temp As Variant
Dim element As AcadEntity
Dim obtext As AcadText

insertionPnt(0) = 0
insertionPnt(1) = 0
insertionPnt(2) = 0


Set ssetObj = ThisDrawing.SelectionSets.Add("ssetObj")

FilterType(0) = -4
FilterData(0) = "<or"
FilterType(1) = 0
FilterData(1) = "Text"
FilterType(2) = 8
FilterData(2) = "0"
FilterType(4) = 0
FilterData(4) = "Polyline"
FilterType(5) = -4
FilterData(5) = "or>"

ssetObj.SelectOnScreen FilterType, FilterData
For Each element In ssetObj
If element.ObjectName = "AcDbText" Then
temp = element.TextString
adText = temp
temp = element.Height
adhight = temp
Set obtext = blockObj.AddText(adText, insertionPnt, adhight)
ElseIf element.ObjectName = "AcDbPolyline" Then
temp = element.Coordinates
blockObj.AddPolyline (temp)
End If
Next
发表于 2005-7-2 23:17:00 | 显示全部楼层
你的块在哪里?
 楼主| 发表于 2005-7-3 19:09:00 | 显示全部楼层
ssetObj.SelectOnScreen FilterType, FilterData
Set blockObj = ThisDrawing.Blocks.Add(insertionPnt, "CircleBlock")

For Each element In ssetObj
If element.ObjectName = "AcDbText" Then
temp = element.TextString
adText = temp
temp = element.Height
adhight = temp
Set obtext = blockObj.AddText(adText, insertionPnt, adhight)
ElseIf element.ObjectName = "AcDbPolyline" Then
temp = element.Coordinates
blockObj.AddPolyline (temp)
End If
Next 少给了一句,不好意思,删多余对话框的时候,不小心删掉了
发表于 2005-7-3 20:08:00 | 显示全部楼层
直接用CopyObjects方法试试
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-27 12:40 , Processed in 0.179470 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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