明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2193|回复: 3

块属性的输出??

[复制链接]
发表于 2005-6-7 13:11:00 | 显示全部楼层 |阅读模式
在输出块的属性时,用到"GetAttributes"方法,但"GetAttributes"又是由"AcadBlockReference"得到.
在我找到的例子中"AcadBlockReference"都是由插入块时得到.
问:1)AcadBlockReference是不是只能由插入块时得到??
2)如果块已存在(不需插入),该如何做??
谢谢!!
发表于 2005-6-7 22:44:00 | 显示全部楼层
AcadBlockReference不是只能由插入块时得到.
如果块已存在(不需插入),选择块(用鼠标)或搜索块名都可.
 楼主| 发表于 2005-6-8 18:04:00 | 显示全部楼层
块可以搜到,但属性该怎样显示呢?
发表于 2005-6-9 12:07:00 | 显示全部楼层
Dim basePnt As Variant
Dim elemod As Object
Dim pickblk As Object
On Error Resume Next
Me.Hide ThisDrawing.Utility.GetEntity returnObj, basePnt, "请选择属性块进行编辑"
Dim con()
Dim xxx As Integer
Dim yyy As Integer
Dim zzz As Integer
MSFlexGrid1.Clear
MSFlexGrid1.Rows = 1
MSFlexGrid1.TextMatrix(0, 1) = "标记"
MSFlexGrid1.TextMatrix(0, 2) = "提示"
MSFlexGrid1.TextMatrix(0, 3) = "值" 'temp = False If returnObj.ObjectName = "AcDbBlockReference" Then
varAttributes = returnObj.GetAttributes
ReDim con(UBound(varAttributes), 2)
For i = LBound(varAttributes) To UBound(varAttributes)

con(i, 0) = varAttributes(i).TagString
'con(i, 1) = elemod.PromptString
con(i, 2) = varAttributes(i).TextString
yyy = i
Next i
Set pickblk = ThisDrawing.Blocks(returnObj.Name)
For Each elemod In pickblk
If elemod.ObjectName = "AcDbAttributeDefinition" Then
For xxx = 0 To yyy
If con(xxx, 0) = elemod.TagString Then
con(xxx, 1) = elemod.PromptString
Exit For
End If
Next xxx
End If
Next elemod
MSFlexGrid1.Rows = yyy + 2
For i = 0 To yyy
MSFlexGrid1.Row = i + 1
MSFlexGrid1.Col = 1
MSFlexGrid1.Text = con(i, 0)
MSFlexGrid1.CellAlignment = 0

MSFlexGrid1.Col = 2
MSFlexGrid1.Text = con(i, 1)
MSFlexGrid1.CellAlignment = 0

MSFlexGrid1.Col = 3
MSFlexGrid1.Text = con(i, 2)
MSFlexGrid1.CellAlignment = 0
Next i Else MsgBox "你选择的不是图块,请从新选择", vbOKOnly, "提示"
End If Me.Show
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-27 16:29 , Processed in 0.176085 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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