明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2126|回复: 2

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

[复制链接]
发表于 2010-5-12 00:58:00 | 显示全部楼层 |阅读模式

感谢大家了!上次的问题,我已经明白了,感谢大家的帮忙!这次又有一个问题!

我想使用sendcommand  圆角一个直线和一个多段线

这个直线交在多段线的中间某段

圆角的时候要获得这两个对象的拾取点,直线的可以line.endpoint,多段线的点该怎么获得啊???!

我试着用几何算法,算了一个点,

但是,圆角的时候图全乱了,说是 命令: (list(handent"3A14")(list 305.32 .15 0)) ; 错误: 输入中的点位置不正确

小弟不明白这种问题怎么处理啊???请大家帮忙啊!急!!!!

 楼主| 发表于 2010-5-12 12:10:00 | 显示全部楼层

我现在已经知道怎么获得多段线上的点通过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)!!!!什么意思?是不是提示没有选中的意思!

请大家帮忙啊!我都搞了好几天了!实在不懂怎么回事了!

就像我以前说的,周围就我一个人,连请教的人都没有~就靠大家了!

我在这里谢过了!

发表于 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; "))"
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-25 22:25 , Processed in 0.159679 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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