可以使用对象属性和方法来编辑属性。Attribute 属性的某些属性包括:
可用于编辑属性的一些方法包括:
重新定义属性定义此示例创建一个块,然后向该块添加一个属性。然后将块插入到图形中。然后更新属性文本以向后显示。 Sub Ch10_RedefiningAnAttribute() ' Define the block Dim blockObj As AcadBlock Dim insertionPnt(0 To 2) As Double insertionPnt(0) = 0 insertionPnt(1) = 0 insertionPnt(2) = 0 Set blockObj = ThisDrawing.Blocks.Add _ (insertionPnt, "BlockWithAttribute") ' Add an attribute to the block Dim attributeObj As AcadAttribute Dim height As Double Dim mode As Long Dim prompt As String Dim insertionPoint(0 To 2) As Double Dim tag As String Dim value As String height = 1 mode = acAttributeModeVerify prompt = "New Prompt" insertionPoint(0) = 5 insertionPoint(1) = 5 insertionPoint(2) = 0 tag = "New Tag" value = "New Value" Set attributeObj = blockObj.AddAttribute(height, mode, _ prompt, insertionPoint, tag, value) ' Insert the block, creating a block reference ' and an attribute reference Dim blockRefObj As AcadBlockReference insertionPnt(0) = 2 insertionPnt(1) = 2 insertionPnt(2) = 0 Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock _ (insertionPnt, "BlockWithAttribute", 1#, 1#, 1#, 0) ' Redefine the attribute text to display backwards. attributeObj.Backward = True attributeObj.Update End Sub |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )
GMT+8, 2024-5-11 19:48
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.