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