yuangw1234 发表于 2006-5-9 21:12:00

线不能串连

<P>本人这样写了一个将线串连的程式,可是不能串连</P>
<P>请大师指教,希望可以帮忙修改一下,谢谢</P>
<P>Public Sub j()<BR>Dim obj As AcadEntity, pt As Variant, selobj As AcadEntity, ssetobj As AcadSelectionSet<BR>ThisDrawing.Utility.GetEntity obj, pt: obj.Highlight True<BR>On Error Resume Next<BR>ThisDrawing.SelectionSets("j").Delete<BR>Err.Clear<BR>Set ssetobj = ThisDrawing.SelectionSets.Add("j")<BR>Dim cmd As String<BR>cmd = "pe" &amp; vbCr &amp; obj &amp; "j" &amp; vbCr &amp; ssetobj &amp; vbCr<BR>ThisDrawing.SendCommand cmd<BR>End Sub<BR></P>

xinghesnak 发表于 2006-5-10 09:59:00

实体和选择集怎么能作为命令行中的东东出现呢?可能得用LISP了,会LISP的高手帮帮忙吧。。。。。

yuangw1234 发表于 2006-5-10 18:39:00

<P>但是vba應該也是可以做的啊,版主能否指教本人一二,谢谢!</P>

login1986 发表于 2006-5-10 18:58:00

<P>好像很復杂!!!</P>

xinghesnak 发表于 2006-5-11 08:52:00

<P>没有高手出面,自立更生啦,看下面的程序吧!</P>
<P>Sub main()<BR>Dim obj As AcadEntity, pt As Variant, selobj As AcadEntity, ssetobj As AcadSelectionSet<BR>ThisDrawing.Utility.GetEntity obj, pt: obj.Highlight True<BR>On Error Resume Next<BR>ThisDrawing.SelectionSets("j").Delete<BR>Err.Clear<BR>Set ssetobj = ThisDrawing.SelectionSets.Add("j")<BR>ssetobj.SelectOnScreen</P>
<P>Dim cmd As String<BR>cmd = "pe" &amp; vbCr &amp; "(handent """ &amp; obj.Handle &amp; """)" &amp; vbCr &amp; "j" &amp; vbCr<BR>Dim i As Integer<BR>For i = 0 To ssetobj.Count<BR>&nbsp;&nbsp;&nbsp; cmd = cmd &amp; "(handent """ &amp; ssetobj.Item(i).Handle &amp; """)" &amp; vbCr<BR>Next</P>
<P>ThisDrawing.SendCommand cmd &amp; vbCr &amp; vbCr<BR>End Sub</P>

yuangw1234 发表于 2006-5-11 21:40:00

<P>兄台,不行的,我用过,并没有串连,管理员可以帮忙吗</P>

xinghesnak 发表于 2006-5-12 13:08:00

<P>在我这运行没有问题,报错吗?</P>

yuangw1234 发表于 2006-5-13 14:36:00

是选过后没有串连

xinghesnak 发表于 2006-5-13 15:44:00

我先选一个pline线,再选中3,4根Line,没有问题,要不你把你的图传上来睽睽吧!

yuangw1234 发表于 2006-8-15 16:08:00

Public Sub j()<BR>Dim ssetobj As AcadSelectionSet<BR>On Error Resume Next<BR>ThisDrawing.SelectionSets("j").Delete<BR>Err.Clear<BR>Set ssetobj = ThisDrawing.SelectionSets.Add("j")<BR>ssetobj.SelectOnScreen<BR>Dim cmd As String<BR>cmd = "pe" &amp; vbCr &amp; "m" &amp; vbCr &amp; "p" &amp; vbCr &amp; vbCr &amp; "y" &amp; vbCr &amp; "j" &amp; vbCr &amp; vbCr &amp; vbCr<BR>ThisDrawing.SendCommand cmd<BR>End Sub
页: [1] 2
查看完整版本: 线不能串连