轴承二次开发
本帖最后由 作者 于 2004-5-28 22:48:32 编辑那位高手帮助我解决剖面线问题,我用了很多方法(hatch)没有成功 你的轴承好像只有外边界,不需要内边界 把中间的弧和线一起连成Polyline,再做填充,InnerLoop(0)和InnerLoop(1)相交,当然不能创建内边界 你知道该怎么解决吗? 用圆弧和直线直接连接成内边界 我已经把圆弧和直线连到了一起作为外边界(我没用内边界),可还是没法填充啊。不知道为什么? 是内边界有问题,内部的多段线与圆是相交的,不可能构成填充的内环。 把你的圆弧和直线连接的代码传上来看看 我设计边界时没有用圆,我只用圆弧和轻便多义线封闭,而且我的同学做他的设计时已经实现。我现在发一个自己任意做实验的程序。这个程序也出现同样的情况。
Private Sub Command1_Click()<BR>On Error Resume Next<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 ("不能运行AUTOCAD, 请检查是否安装了AUTOCAD")<BR> Exit Sub<BR> End If<BR> End If<BR> acadapp.Visible = True
'创建填充对象<BR>Dim hatchobj As AcadHatch<BR>Dim patternname As String<BR>Dim patterntype As Long<BR>Dim bassociativity As Boolean<BR> <BR> '定义填充<BR> patterntype = 0<BR> patternname = "ANSI31"<BR> bassociativity = True<BR> '创建填充对象<BR> Set hatchobj = acadapp.ActiveDocument.ModelSpace.AddHatch(patterntype, patternname, bassociativity)
Dim outerloop(0 To 1) As AcadEntity<BR>'Dim innerloop(0 To 0) As AcadEntity
Dim points11(0 To 7) As Double<BR>points11(0) = 30<BR>points11(1) = 30<BR>points11(2) = 30<BR>points11(3) = 60<BR>points11(4) = 60<BR>points11(5) = 60<BR>points11(6) = 60<BR>points11(7) = 30<BR>Set outerloop(0) = acadapp.ActiveDocument.ModelSpace.AddLightWeightPolyline(points11)
Dim cen(0 To 2) As Double<BR>Dim r As Double<BR>Dim startangle As Double<BR>Dim endangle As Double<BR>cen(0) = 45: cen(1) = 30: cen(2) = 0<BR>r = 15<BR>st = 180 * 3.1415926 / 180<BR>ed = 360 * 3.1415926 / 180<BR>Set outerloop(1) = acadapp.ActiveDocument.ModelSpace.AddArc(cen, r, st, ed)
<BR> '向填充对象添加填充边界<BR>hatchobj.AppendOuterLoop (outerloop)<BR>'hatchobj.AppendInnerLoop (innerloop)<BR>hatchobj.Evaluate<BR>acadapp.ActiveDocument.Regen True<BR>ZoomExtents
End Sub<BR>
页:
[1]
2