明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1183|回复: 0

求助

[复制链接]
发表于 2006-1-3 11:51:00 | 显示全部楼层 |阅读模式

各位帮主:请帮帮忙吧。这个问题困扰我好久了,为什么我在vb编程时将外面的边界线分为两段,他咋就填补上了那?并且填到内边界线里了?请看程序:

On Error Resume Next
  Dim acadApp As AcadApplication
  Dim acaddoc As AcadDocument
 Set acadApp = GetObject(, "AutoCAD.Application")
'    acaApp.Command = script.exe
    If Err Then
        Err.Clear
      Set acadApp = CreateObject("AutoCAD.Application")
      Set acaddoc = acadApp.ActiveDocument
      acadApp.Visible = True
        If Err Then
            MsgBox Err.Description
            Exit Sub
        End If
    End If
    Dim hatchobj As AcadHatch
 Dim patternname As String
 Dim patterntype As Long
 Dim bassociativity As Boolean
 patterntype = 0
 patternname = "ansi31"
 bassociativity = True
 Set hatchobj = acadApp.ActiveDocument.ModelSpace.AddHatch(0, "ansi31", True)
 Dim innerloop(0 To 0) As AcadEntity
 Dim outerloop(0 To 0) As AcadEntity
 Dim Plineobj As AcadLWPolyline
 Set acaddoc = acadApp.ActiveDocument
 Dim points(0 To 7) As Double
 points(0) = 10: points(1) = 10
 points(2) = 30: points(3) = 50
 points(4) = 70: points(5) = 20
 Dim stp0(0 To 2) As Double
 Dim enp0(0 To 2) As Double
  stp0(0) = 70: stp0(1) = 20: enp0(2) = 0
 enp0(0) = 10: enp0(1) = 10: enp0(2) = 0
' Set plnObj = acadApp.ActiveDocument.ModelSpace.AddLine(stp0, enp0)
' points(6) = 10: points(7) = 10
 Set innerloop(0) = acaddoc.ModelSpace.AddLightWeightPolyline(stp0, enp0)
 Dim centerpoint10(0 To 2) As Double
 Dim endpoint10 As Double
 Dim radius10 As Double
 centerpoint10(0) = 20: centerpoint10(1) = 20: centerpoint10(2) = 0#
  radius10 = 4
 Set outerloop(0) = acadApp.ActiveDocument.ModelSpace.AddCircle(centerpoint10, radius10)
  hatchobj.AppendOuterLoop (outerloop)
hatchobj.AppendInnerLoop (innerloop)
hatchobj.Evaluate
acadApp.ActiveDocument.Regen True
  ZoomExtents
 ZoomAll

在此先谢谢各位了

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-27 06:30 , Processed in 0.155618 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表