CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

关于编辑属性定义 (VBA/ActiveX)

2023-1-4 19:42| 发布者: admin| 查看: 567| 评论: 0|来自: AutoCAD

摘要: 可以使用属性对象属性和方法来编辑属性。

可以使用对象属性和方法来编辑属性。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

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-11 19:48

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部