请教各位老大:
哪位能看一下下面的程序:为何我不能将定义好的块,插到指定点
Private Sub Command1_Click() On Error Resume Next Dim acadApp As AcadApplication Set acadApp = GetObject(, "AutoCAD.Application") If Err Then Err.Clear Set acadApp = CreateObject("AutoCAD.Application") If Err Then MsgBox Err.Description Exit Sub End If End If
Dim blockobj05 As AcadBlock
Dim insertionpnt05(0 To 2) As Double insertionpnt05(0) = 2136.8: insertionpnt05(1) = 1389.8: insertionpnt05(2) = 0# Set blockobj05 = acaddocc.Blocks.Add(insertionpnt05, "qblock") '创建块 '向块中添加直线、多义线 Dim linobj As AcadLine Dim stp130(0 To 2) As Double Dim enp130(0 To 2) As Double stp130(0) = 20: stp130(1) = 20: stp130(2) = 0# enp130(0) = 50: enp130(1) = 50: enp130(2) = 0# Set linobj = blockobj.AddLine(stp130, enp130) Dim Pll39obj As AcadLWPolyline Dim points139(0 To 5) As Double points139(0) = 10: points139(1) = 18 points139(2) = 30: points139(3) = 47 points139(4) = 60: points139(5) = 75 Set Pl139obj = acaddoc.ModelSpace.AddLightWeightPolyline(points139)  l139obj.Closed = ture Set Pll39obj = blockobj.AddLightWeightPolyline(points139) Dim Pl140obj As AcadLWPolyline Dim points140(0 To 5) As Double points140(0) = 41: points140(1) = 64 points140(2) = 38: points140(3) = 52 points140(4) = 25: points140(5) = 100 Set Pl140obj = acaddoc.ModelSpace.AddLightWeightPolyline(points140)  l140obj.Closed = ture Set Pll40obj = blockobj.AddLightWeightPolyline(points140) Dim blockRefobj As AcadBlockReference '''''''''''''''''''''''插入快 Dim insertionpnt(0 To 2) As Double insertionpnt05(0) = 200: insertionpnt05(1) = 200: insertionpnt05(2) = 0# Set blockRefobj = acadApp.ActiveDocument.ModelSpace.InsertBlock(insertionpnt05, "qblock", 1#, 1#, 1#, 0) '插入块 ZoomExtents acadApp.Visible = True End Sub |