[求助] 如何获得属性块的属性并修改某个值?
<p>Public Sub Add_Block1()</p><p>Dim dblStart(0 To 2) As Double '插入点<br/>Dim objBlkDef As AcadBlock<br/>Dim objBlkRef As AcadBlockReference<br/>Dim objBlock As AcadBlock</p><p>For Each objBlock In ThisDrawing.Blocks<br/> If objBlock.Name = "Block1" Then '找到指定的块<br/> Set objBlkDef = ThisDrawing.Blocks.Item("OrderBlock")<br/> End If<br/>Next</p><p><font color="#ff0000">'objBlkDef 如何转换为objBlkRef呢?</font></p><p>Dim varAttributes As Variant<br/>varAttributes = objBlkRef.GetAttributes<br/>varAttributes(0).TextString = "成功了" '修改第一个属性值?</p><p>End Sub<br/></p> <p>用选择集过滤相应块名的块参照</p><p>Blocks是块定义集合而不是块参照集合<br/></p> <p>如何写程序呢?</p><p>刚开始学cad的vba,需要大侠帮忙</p> 继续等大侠帮忙。。 Set objBlkRef = ThisDrawing.ModelSpace.InsertBlock(InsertionPoint, "Block1", 1, 1, 1, 0) 这是直接引用啊,我需要或者已经存在的块的属性。。。 Dim ent As AcadEntity<br/>For Each ent In ThisDrawing.ModelSpace<br/> If ent.Name = "Block1" Then '找到指定的块<br/> Set objBlkRef = ent<br/> End If<br/>Next Set objBlkRef = ent 这句出错, 运行错误438,对象不支持该属性和方法。 Set objBlkRef = ent 这句提示方法错 我的怎么没有提示错误,
页:
[1]
2