wfcst2004 发表于 2005-12-24 22:06:00

求助

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