wfcst2004 发表于 2006-1-3 11:51:00

求助

<P>各位帮主:请帮帮忙吧。这个问题困扰我好久了,为什么我在vb编程时将外面的边界线分为两段,他咋就填补上了那?并且填到内边界线里了?请看程序:</P>
<P>On Error Resume Next<BR>&nbsp; Dim acadApp As AcadApplication<BR>&nbsp; Dim acaddoc As AcadDocument<BR>&nbsp;Set acadApp = GetObject(, "AutoCAD.Application")<BR>'&nbsp;&nbsp;&nbsp; acaApp.Command = script.exe<BR>&nbsp;&nbsp;&nbsp; If Err Then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Err.Clear<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set acadApp = CreateObject("AutoCAD.Application")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set acaddoc = acadApp.ActiveDocument<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; acadApp.Visible = True<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<BR>&nbsp;&nbsp;&nbsp; Dim hatchobj As AcadHatch<BR>&nbsp;Dim patternname As String<BR>&nbsp;Dim patterntype As Long<BR>&nbsp;Dim bassociativity As Boolean<BR>&nbsp;patterntype = 0<BR>&nbsp;patternname = "ansi31"<BR>&nbsp;bassociativity = True<BR>&nbsp;Set hatchobj = acadApp.ActiveDocument.ModelSpace.AddHatch(0, "ansi31", True)<BR>&nbsp;Dim innerloop(0 To 0) As AcadEntity<BR>&nbsp;Dim outerloop(0 To 0) As AcadEntity<BR>&nbsp;Dim Plineobj As AcadLWPolyline<BR>&nbsp;Set acaddoc = acadApp.ActiveDocument<BR>&nbsp;Dim points(0 To 7) As Double<BR>&nbsp;points(0) = 10: points(1) = 10<BR>&nbsp;points(2) = 30: points(3) = 50<BR>&nbsp;points(4) = 70: points(5) = 20<BR>&nbsp;Dim stp0(0 To 2) As Double<BR>&nbsp;Dim enp0(0 To 2) As Double<BR>&nbsp; stp0(0) = 70: stp0(1) = 20: enp0(2) = 0<BR>&nbsp;enp0(0) = 10: enp0(1) = 10: enp0(2) = 0<BR>' Set plnObj = acadApp.ActiveDocument.ModelSpace.AddLine(stp0, enp0)<BR>' points(6) = 10: points(7) = 10<BR>&nbsp;Set innerloop(0) = acaddoc.ModelSpace.AddLightWeightPolyline(stp0, enp0)<BR>&nbsp;Dim centerpoint10(0 To 2) As Double<BR>&nbsp;Dim endpoint10 As Double<BR>&nbsp;Dim radius10 As Double<BR>&nbsp;centerpoint10(0) = 20: centerpoint10(1) = 20: centerpoint10(2) = 0#<BR>&nbsp; radius10 = 4<BR>&nbsp;Set outerloop(0) = acadApp.ActiveDocument.ModelSpace.AddCircle(centerpoint10, radius10)<BR>&nbsp; hatchobj.AppendOuterLoop (outerloop)<BR>hatchobj.AppendInnerLoop (innerloop)<BR>hatchobj.Evaluate<BR>acadApp.ActiveDocument.Regen True<BR>&nbsp; ZoomExtents<BR>&nbsp;ZoomAll</P>
<P>在此先谢谢各位了</P>
页: [1]
查看完整版本: 求助