本帖最后由 作者 于 2008-12-23 8:28:20 编辑
做了含attribute的Block但重覆引用時需把attribute.rotation,height 上回站上mccad大大教了GetSubEntity 直接由螢幕點選更改attribute, 但有些狀況必需在InsertBlock之前先改變已定義block的attribute.rotation 在 Joe Sutphin的AutoCAD 2006 VBA a programmer's Reference書上 查到先選入collection中 Function GetAttrib(oBlock As AcadBlock) As Collection Dim objEnt As AcadEntity Dim objAttribute As AcadAttribute Dim coll As New Collection For Each objEnt In oBlock If objEnt.ObjectName = "AcDbAttributeDefinition" Then Set objAttribute = objEnt coll.Add objAttribute End If Next objEnt Set GetAttrib = coll End Function 再用 for each ObjAttribute in coll .......捉到attribute更改 請問 1.這是正確而有效率的方法嗎? 2.很少看書上寫collection用法,麻煩前輩指點一二,或推薦閱讀, 謝謝!!
|