VBA创建图块的问题,我已经努力了,但做不到
<P>谁能帮助我一下?熬3天了,坚持不住了,</P><P>问题是:</P>
<P>怎样用一个选择集创建一个图块,</P> <P> </P>人呢?都哪里去了? <p> Dim sset As AcadSelectionSet ThisDrawing.SelectionSets.Item("path").Delete<br/> Set sset = ThisDrawing.SelectionSets.Add("path")<br/> Dim objs() As AcadEntity<br/> Dim zhongzhuan As Double<br/> Dim Entity As AcadEntity<br/> sset.SelectOnScreen '在屏幕上面选线段<br/> <br/> <br/> For Each Entity In sset '如果块已经定义则不需要重新定义<br/> If Entity.ObjectName = "AcDbBlockReference" Then '"AcDbBlockBegin"blockReference<br/> If Entity.Name = "sleeper" Then<br/> <br/> Set blockRefObj = Entity.Copy()<br/> ' MsgBox "wwww"<br/> GoTo insertkuai<br/> <br/> <br/> <br/> End If<br/> End If<br/> Next<br/> <br/> End</p><p> Dim insertionPnt As Variant<br/> <br/> insertionPnt = ThisDrawing.Utility.GetPoint(, "拾取块的中点")</p><p><br/> Set blockObj = ThisDrawing.Blocks.Add _<br/> (insertionPnt, "sleeper")<br/> For Each element In blockObj<br/> element.Delete<br/> Next<br/> <br/> <br/> </p><p> ReDim objs(sset.Count - 1)<br/> Dim i<br/> For i = 0 To sset.Count - 1<br/> Set objs(i) = sset(i)<br/> Next i<br/> <br/> ThisDrawing.CopyObjects objs, blockObj </p><p> <br/> Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock _<br/> (insertionPnt, "sleeper", 1#, 1#, 1#, 0)</p>
页:
[1]