ch_wang 发表于 2010-5-12 00:58:00

_fillt圆角多段线,如何获得多段线的点

<p>感谢大家了!上次的问题,我已经明白了,感谢大家的帮忙!这次又有一个问题!</p><p>我想使用sendcommand&nbsp; 圆角一个直线和一个多段线</p><p>这个直线交在多段线的中间某段</p><p>圆角的时候要获得这两个对象的拾取点,直线的可以line.endpoint,多段线的点该怎么获得啊???!</p><p>我试着用几何算法,算了一个点,</p><p>但是,圆角的时候图全乱了,说是 <font color="#f73809">命令: (list(handent"3A14")(list 305.32 .15 0)) ; 错误: 输入中的点位置不正确</font></p><p><font color="#000000">小弟不明白这种问题怎么处理啊???请大家帮忙啊!急!!!!</font></p>

ch_wang 发表于 2010-5-12 12:10:00

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

雪山飞狐_lzh 发表于 2010-5-15 00:55:00

GetDoubleEntTable = "(list(handent" &amp; Chr(34) &amp; entHandle &amp; Chr(34) &amp; ")(list " &amp; Str(Pnt(0)) &amp; " " &amp; Str(Pnt(1)) &amp; " " &amp; Str(Pnt(2)) &amp; "))"
页: [1]
查看完整版本: _fillt圆角多段线,如何获得多段线的点