dfgs 发表于 2007-10-3 21:34:00

又来请教大家,关于sendcommand的使用

我在用VBA编程时,需要用到边界曲面的功能(没法,用add3dmesh感觉太复杂,二维图是现在的)想用sendcommand的功能调用edgesurf命令,但edgesurf执行后要接下来选择4根线条,如何用程序传递给它呢?谢谢!

zxlllw 发表于 2007-10-4 16:32:00

这个跟我发的那个求助贴意思差不多,就是涉及到,在vba窗口出现的情况下,怎么实现选择自己要修改的图形。我也期待。

phonexi 发表于 2007-10-8 17:30:00

<p>都说了使用选择集</p><p>好像刚回复果类似问题</p><p>lsp语句利用setq s1(entlast) (有关最后选择集的方式都可以)</p><p>vba则是新建选择集利用acSelectionSetLast模式</p><p>在选择对象时使用 p 参数即上一个选择集</p><p>所有这类操作都是这个样子</p>

dfgs 发表于 2007-10-8 19:58:00

<p>楼上介绍的方法和于其它命令是可行的。我用VBA,其中SS1、SS2、SS3、SS4是四个选择集,每个集中选择了一根线条,但执行时就不行了</p><p>ThisDrawing.SendCommand "edgesurf" &amp; vbCr &amp; "ss1" &amp; vbCr &amp; "ss2" &amp; vbCr &amp; "ss3" &amp; vbCr &amp; "ss4" &amp; vbCr</p><p>这一种方法也不行</p><p>ThisDrawing.SendCommand "edgesurf" &amp; vbCr &amp; "setq s1(ss1)" &amp; vbCr &amp; "setq s2(ss2)" &amp; vbCr &amp; "setq s3(ss3)" &amp; vbCr &amp; "setq s4(ss4)" &amp; vbCr</p><p>请指点,谢谢!</p>

alin 发表于 2007-10-8 22:02:00

<p>下载vlax.cls或也可用USERS1-5来传递Handle</p><p>Sub test()<br/>Dim lineObj1 As AcadLine<br/>Dim lineObj2 As AcadLine<br/>Dim lineObj3 As AcadLine<br/>Dim lineObj4 As AcadLine<br/>Dim pt1(0 To 2) As Double<br/>Dim pt2(0 To 2) As Double<br/>Dim pt3(0 To 2) As Double<br/>Dim pt4(0 To 2) As Double<br/>pt1(0) = 0#: pt1(1) = 0#: pt1(2) = 0#<br/>pt2(0) = 2#: pt2(1) = 3#: pt2(2) = -5#<br/>pt3(0) = 1#: pt3(1) = 5#: pt3(2) = 8#<br/>pt4(0) = 4#: pt4(1) = 0#: pt4(2) = 2#<br/>Set lineObj1 = ThisDrawing.ModelSpace.AddLine(pt1, pt2)<br/>Set lineObj2 = ThisDrawing.ModelSpace.AddLine(pt2, pt3)<br/>Set lineObj3 = ThisDrawing.ModelSpace.AddLine(pt3, pt4)<br/>Set lineObj4 = ThisDrawing.ModelSpace.AddLine(pt4, pt1)</p><p>Dim VL As New VLAX<br/>VL.SetLispSymbol "hd1", lineObj1.Handle<br/>VL.SetLispSymbol "hd2", lineObj2.Handle<br/>VL.SetLispSymbol "hd3", lineObj3.Handle<br/>VL.SetLispSymbol "hd4", lineObj4.Handle<br/>ThisDrawing.SendCommand "(command ""edgesurf"" (Handent hd1) (Handent hd2) (Handent hd3) (Handent hd4)) "<br/>End Sub</p>

dfgs 发表于 2007-10-11 20:40:00

<p>谢谢!显然这个办法更简便,不需要其它支持。</p><p></p><p>Dim lineObj1 As AcadLine<br/>Dim lineObj2 As AcadLine<br/>Dim lineObj3 As AcadLine<br/>Dim lineObj4 As AcadLine<br/>Dim pt1(0 To 2) As Double<br/>Dim pt2(0 To 2) As Double<br/>Dim pt3(0 To 2) As Double<br/>Dim pt4(0 To 2) As Double<br/>pt1(0) = 0#: pt1(1) = 0#: pt1(2) = 0#<br/>pt2(0) = 2#: pt2(1) = 3#: pt2(2) = -5#<br/>pt3(0) = 1#: pt3(1) = 5#: pt3(2) = 8#<br/>pt4(0) = 4#: pt4(1) = 0#: pt4(2) = 2#<br/>Set lineObj1 = ThisDrawing.ModelSpace.AddLine(pt1, pt2)<br/>Set lineObj2 = ThisDrawing.ModelSpace.AddLine(pt2, pt3)<br/>Set lineObj3 = ThisDrawing.ModelSpace.AddLine(pt3, pt4)<br/>Set lineObj4 = ThisDrawing.ModelSpace.AddLine(pt4, pt1)<br/>ThisDrawing.SendCommand "edgesurf" &amp; vbCr &amp; "(Handent """ &amp; lineObj1.Handle &amp; """)" &amp; vbCr &amp; "(Handent """ &amp; lineObj2.Handle &amp; """)" &amp; vbCr &amp; "(Handent """ &amp; lineObj3.Handle &amp; """)" &amp; vbCr &amp; "(Handent """ &amp; lineObj4.Handle &amp; """)" &amp; vbCr<br/></p>
页: [1]
查看完整版本: 又来请教大家,关于sendcommand的使用