明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1719|回复: 2

如何修改块的属性

[复制链接]
发表于 2007-6-21 12:08:00 | 显示全部楼层 |阅读模式

在程序中自定义属性块后,如何获取并修改块的属性值呢?

不是块参照

谢谢

发表于 2007-6-21 12:39:00 | 显示全部楼层
Sub Example_Blockttribute()
    ' This example creates an MLeader object and gets and sets values for
    ' the block attribute type.

    Dim points(0 To 5) As Double

    points(0) = 0: points(1) = 4: points(2) = 0
    points(3) = 1.5: points(4) = 5: points(5) = 0

    Dim i As Long

    Dim oML As AcadMLeader
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)
    
    oML.ContentType = acBlockContent
    oML.ContentBlockType = acBlockBox

    Dim sBlock As String

    sBlock = oML.ContentBlockName

    Dim o As AcadEntity
    For Each o In ThisDrawing.Blocks(sBlock)
        If o.ObjectName = "AcDbAttributeDefinition" Then
            Call oML.SetBlockAttributeValue(o.ObjectID, "123")
            MsgBox oML.GetBlockAttributeValue(o.ObjectID)
        End If
    Next o
    Update
    ZoomExtents

End Sub

 

 楼主| 发表于 2007-6-22 16:01:00 | 显示全部楼层

能不能给个简单的例子,我是在CAD2004下的。

上面的例子看不懂。

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

本版积分规则

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

GMT+8, 2025-2-23 01:31 , Processed in 0.168675 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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