明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2284|回复: 5

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

[复制链接]
发表于 2007-10-3 21:34:00 | 显示全部楼层 |阅读模式
我在用VBA编程时,需要用到边界曲面的功能(没法,用add3dmesh感觉太复杂,二维图是现在的)想用sendcommand的功能调用edgesurf命令,但edgesurf执行后要接下来选择4根线条,如何用程序传递给它呢?谢谢!
发表于 2007-10-4 16:32:00 | 显示全部楼层
这个跟我发的那个求助贴意思差不多,就是涉及到,在vba窗口出现的情况下,怎么实现选择自己要修改的图形。我也期待。
发表于 2007-10-8 17:30:00 | 显示全部楼层

都说了使用选择集

好像刚回复果类似问题

lsp语句利用setq s1(entlast) (有关最后选择集的方式都可以)

vba则是新建选择集利用acSelectionSetLast模式

在选择对象时使用 p 参数即上一个选择集

所有这类操作都是这个样子

 楼主| 发表于 2007-10-8 19:58:00 | 显示全部楼层

楼上介绍的方法和于其它命令是可行的。我用VBA,其中SS1、SS2、SS3、SS4是四个选择集,每个集中选择了一根线条,但执行时就不行了

ThisDrawing.SendCommand "edgesurf" & vbCr & "ss1" & vbCr & "ss2" & vbCr & "ss3" & vbCr & "ss4" & vbCr

这一种方法也不行

ThisDrawing.SendCommand "edgesurf" & vbCr & "setq s1(ss1)" & vbCr & "setq s2(ss2)" & vbCr & "setq s3(ss3)" & vbCr & "setq s4(ss4)" & vbCr

请指点,谢谢!

发表于 2007-10-8 22:02:00 | 显示全部楼层

下载vlax.cls或也可用USERS1-5来传递Handle

Sub test()
Dim lineObj1 As AcadLine
Dim lineObj2 As AcadLine
Dim lineObj3 As AcadLine
Dim lineObj4 As AcadLine
Dim pt1(0 To 2) As Double
Dim pt2(0 To 2) As Double
Dim pt3(0 To 2) As Double
Dim pt4(0 To 2) As Double
pt1(0) = 0#: pt1(1) = 0#: pt1(2) = 0#
pt2(0) = 2#: pt2(1) = 3#: pt2(2) = -5#
pt3(0) = 1#: pt3(1) = 5#: pt3(2) = 8#
pt4(0) = 4#: pt4(1) = 0#: pt4(2) = 2#
Set lineObj1 = ThisDrawing.ModelSpace.AddLine(pt1, pt2)
Set lineObj2 = ThisDrawing.ModelSpace.AddLine(pt2, pt3)
Set lineObj3 = ThisDrawing.ModelSpace.AddLine(pt3, pt4)
Set lineObj4 = ThisDrawing.ModelSpace.AddLine(pt4, pt1)

Dim VL As New VLAX
VL.SetLispSymbol "hd1", lineObj1.Handle
VL.SetLispSymbol "hd2", lineObj2.Handle
VL.SetLispSymbol "hd3", lineObj3.Handle
VL.SetLispSymbol "hd4", lineObj4.Handle
ThisDrawing.SendCommand "(command ""edgesurf"" (Handent hd1) (Handent hd2) (Handent hd3) (Handent hd4)) "
End Sub

 楼主| 发表于 2007-10-11 20:40:00 | 显示全部楼层

谢谢!显然这个办法更简便,不需要其它支持。

Dim lineObj1 As AcadLine
Dim lineObj2 As AcadLine
Dim lineObj3 As AcadLine
Dim lineObj4 As AcadLine
Dim pt1(0 To 2) As Double
Dim pt2(0 To 2) As Double
Dim pt3(0 To 2) As Double
Dim pt4(0 To 2) As Double
pt1(0) = 0#: pt1(1) = 0#: pt1(2) = 0#
pt2(0) = 2#: pt2(1) = 3#: pt2(2) = -5#
pt3(0) = 1#: pt3(1) = 5#: pt3(2) = 8#
pt4(0) = 4#: pt4(1) = 0#: pt4(2) = 2#
Set lineObj1 = ThisDrawing.ModelSpace.AddLine(pt1, pt2)
Set lineObj2 = ThisDrawing.ModelSpace.AddLine(pt2, pt3)
Set lineObj3 = ThisDrawing.ModelSpace.AddLine(pt3, pt4)
Set lineObj4 = ThisDrawing.ModelSpace.AddLine(pt4, pt1)
ThisDrawing.SendCommand "edgesurf" & vbCr & "(Handent """ & lineObj1.Handle & """)" & vbCr & "(Handent """ & lineObj2.Handle & """)" & vbCr & "(Handent """ & lineObj3.Handle & """)" & vbCr & "(Handent """ & lineObj4.Handle & """)" & vbCr

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-26 12:15 , Processed in 0.165064 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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