明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 873|回复: 2

创建属性块的时候,AddAttribute 提示参数不可选

[复制链接]
发表于 2016-4-7 16:38:27 | 显示全部楼层 |阅读模式
源代码如下:
'VBA代码创建带属性的块
Public Sub createATTBlockTX()
    Dim objBlock As AcadBlock
    Dim ptBase(2) As Double    '插入块时的基点
    Dim pt1(2) As Double, pt2(2) As Double, pt3(2) As Double, pt4(2) As Double
    pt1(0) = 2: pt1(1) = 0: pt1(2) = 0
    pt2(0) = -2: pt2(1) = 0: pt2(2) = 0
    pt3(0) = 0: pt3(1) = 2: pt3(2) = 0
    pt4(0) = 0: pt4(1) = -2: pt4(2) = 0
    Dim ptArr(3) As Double
    ptArr(0) = 2: ptArr(1) = 0: ptArr(2) = -2: ptArr(3) = 0
    ptBase(0) = 0: ptBase(1) = 0: ptBase(2) = 0
    Set objBlock = ThisDrawing.Blocks.Add(ptBase, "天线")
    objBlock.AddLine pt1, pt2
    objBlock.AddLine pt3, pt4
    objBlock.AddCircle ptBase, 2
    objBlock.AddLightWeightPolyline ptArr
    '更改块中多段线的属性
    Dim objLWP As AcadLWPolyline
    Set objLWP = objBlock.Item(3)
    objLWP.SetBulge 0, 1
    objLWP.SetBulge 1, 1
    objLWP.Closed = True
    objLWP.ConstantWidth = 0.5
    '设置块的属性
    ptBase(0) = 3: ptBase(1) = 0: ptBase(2) = 0
    objBlock.AddAttribute 2, acAttributeModeLockPosition, "FF", ptBase
    ptBase(0) = 3: ptBase(1) = -2: ptBase(2) = 0
    objBlock.AddAttribute 2, acAttributeModeLockPosition, "DD", ptBase
End Sub
如果不设置块的属性可以创建块,设置之后AddAttribute 提示参数不可选



发表于 2016-4-7 22:03:14 | 显示全部楼层
AddAttribute 方法有6个参数,你只给了4个
发表于 2016-4-25 14:34:21 来自手机 | 显示全部楼层
学习了,我在新建属性快的时候也是提示没有可用属性存在,原来少了两个参数来自: Android客户端
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-29 01:38 , Processed in 0.166925 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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