关于编辑属性定义 (VBA/ActiveX)
您可以使用对象属性和方法来编辑属性。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 苏公网安备32011402011833)
GMT+8, 2024-12-15 22:33
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.