我现在已经知道怎么获得多段线上的点通过oblect.Coordinates(index) 我自己做了个小例子: Rem 倒圆角是对双元表时 Public Function GetDoubleEntTable(entObj As AcadEntity, Pnt As Variant) As String Dim entHandle As String entHandle = entObj.Handle GetDoubleEntTable = "(list(handent" & Chr(34) & entHandle & Chr(34) & ")(list" & Str(Pnt(0)) & Str(Pnt(1)) & Str(Pnt(2)) & "))" End Function Rem 倒圆角实体 Public Function axEnt2lspEnt(entObj As AcadEntity) As String Dim entHandle As String entHandle = entObj.Handle axEnt2lspEnt = "(handent" & Chr(34) & entHandle & Chr(34) & ")" End Function Public Function TdnPLC(LWPLN1 As AcadLine, LWPLN2 As AcadLWPolyline, PikPt As Variant, FiltR As Double)
Dim Comd As String Dim EHadl As String Dim LHadl As String Rem 倒圆角使用command Comd = "_fillet r " & FiltR & " " ThisDrawing.SendCommand Comd EHadl = axEnt2lspEnt(LWPLN1) LHadl = GetDoubleEntTable(LWPLN2, PikPt) 'Comd = "(handent" & Chr(34) & Trim(LWPLN1.Handle) & Chr(34) & ") " & "(handent" & Chr(34) & Trim(LWPLN2.Handle) & Chr(34) & ") " Comd = EHadl & " " & LHadl & " " ThisDrawing.SendCommand Comd ThisDrawing.Application.ZoomExtents End Function Public Sub sy() Dim myline1 As AcadLine Dim myline3 As AcadLWPolyline Dim myline2 As AcadLine Dim pt1(1 To 3) As Double Dim pt2(1 To 3) As Double Dim pt3(1 To 12) As Double Dim pt13(0 To 2) As Double Dim pt23(0 To 2) As Double Dim r As Double Dim i As Integer pt1(1) = 0 pt1(2) = 60 pt1(3) = 0 pt2(1) = 10 pt2(2) = 30 pt2(3) = 0 Set myline1 = ThisDrawing.ModelSpace.AddLine(pt1, pt2) pt1(1) = 40 pt1(2) = 30 pt1(3) = 0 pt2(1) = 50 pt2(2) = 60 pt2(3) = 0 Set myline2 = ThisDrawing.ModelSpace.AddLine(pt1, pt2) r = 3 pt3(1) = 0 pt3(2) = 0 pt3(3) = 10 pt3(4) = 30 pt3(5) = 20 pt3(6) = 40 pt3(7) = 30 pt3(8) = 40 pt3(9) = 40 pt3(10) = 30 pt3(11) = 50 pt3(12) = 0 Set myline3 = ThisDrawing.ModelSpace.AddLightWeightPolyline(pt3) pt13(0) = myline3.Coordinates(4) pt13(1) = myline3.Coordinates(5) pt13(2) = 0 pt23(0) = myline3.Coordinates(6) pt23(1) = myline3.Coordinates(7) pt23(2) = 0 Call TdnPLC(myline1, myline3, pt13, r) Call TdnPLC(myline2, myline3, pt23, r) End Sub 完全可以执行! 但是,我真正用的时候,就不行了!总是提示半径太大!但是不大!因为图形要用到数据库的东西,代码不好发~不好意思! 我用list查看生成的信息,发现了问题! 就是小例子的代码执行时:选择第二个对象: (list(handent"4B61")(list 30 40 0)) (<图元名: 7efe7a48> (30 40 0)) 真正代码执行时:选择第二个对象: (list(handent"4B5C")(list 163.320007324219-2.96499999403954 0)) (<图元名: 7efe7a20> (nil 0)) 大家注意看多了一个(nil 0)!!!!什么意思?是不是提示没有选中的意思! 请大家帮忙啊!我都搞了好几天了!实在不懂怎么回事了! 就像我以前说的,周围就我一个人,连请教的人都没有~就靠大家了! 我在这里谢过了! |