<BR>针对上面的源代码,应加怎样的代码来读取和生成呢? Sub test()<BR>On Error Resume Next<BR>Dim ss As AcadSelectionSet<BR>ThisDrawing.SelectionSets("Test").Delete<BR>Set ss = ThisDrawing.SelectionSets.Add("Test")<BR>Dim ft(0) As Integer, fd(0)<BR>ft(0) = 0: fd(0) = "Circle"<BR>ss.SelectOnScreen ft, fd<BR>For Each i In ss<BR>Cir2LW i, 1<BR>Next i<BR>End Sub
Sub Cir2LW(ByVal oCircle, ByVal Width As Double)<BR>Dim pnt<BR>Dim r As Double<BR>Dim pnts(3) As Double<BR>Dim oLW As AcadLWPolyline<BR>pnt = oCircle.Center<BR>r = oCircle.radius<BR>pnts(0) = pnt(0) - r: pnts(1) = pnt(1)<BR>pnts(2) = pnt(0) + r: pnts(3) = pnt(1)<BR>Set oLW = ThisDrawing.ModelSpace.AddLightWeightPolyline(pnts)<BR>oLW.Closed = True<BR>oLW.SetBulge 0, 1<BR>oLW.SetBulge 1, 1<BR>oLW.SetWidth 0, Width, Width<BR>oLW.SetWidth 1, Width, Width<BR>oLW.Update<BR>oCircle.Delete<BR>End Sub<BR> 你的程序只需把Set circ = ThisDrawing.ModelSpace.AddCircle(centerpt, radius)<BR>改成6楼所说的方法就可以了,这应该很容易完成,又何必在画完圆后再改成圆环呢? 恩, 谢谢!!! 我刚才试了改不成功,偶比较菜,老大可以帮我修改一下源码吗?
谢谢! 加一个函数
Sub AddDonut(ByVal Center, ByVal Radius As Double, ByVal Width As Double)<BR> Dim oLW As AcadLWPolyline<BR> Dim pnts(3) As Double<BR> pnts(0) = Center(0) - Radius: pnts(1) = Center(1)<BR> pnts(2) = Center(0) + Radius: pnts(3) = Center(1)<BR> Set oLW = ThisDrawing.ModelSpace.AddLightWeightPolyline(pnts)<BR> oLW.Closed = True<BR> oLW.SetBulge 0, 1<BR> oLW.SetBulge 1, 1<BR> oLW.SetWidth 0, Width, Width<BR> oLW.SetWidth 1, Width, Width<BR> oLW.Update<BR>End Sub
把
Set circ = ThisDrawing.ModelSpace.AddCircle(centerpt, radius)
改为
AddDonut centerpt,radius, 1<BR> 搞定,非常感谢lzh和mccad的帮忙!
页:
1
[2]