tkodwang 发表于 2007-4-24 13:27:00

[求助]关于vba中使用command问题,急

本帖最后由 作者 于 2007-4-26 9:54:23 编辑 <br /><br /> <p>&nbsp;THISDRAWING.SendCommand "(command ""leader"" pause pause ""F"" ""N"" ""A"" """" ""b"" ""1.dwg""&nbsp;""s""&nbsp;<font color="#ff0000">""1""</font> pause """" """" pause )" &amp; vbCr</p><p>&nbsp;</p><p>大家请看上面那句vba代码,这句话就是画一个引线,引线的注释不是文字而是一个块——1.dwg,上面这句话运行是没错的,但是我想把其中的""1"",也就是缩放比例换成xscale,他是一个变量,再此句前赋值为1,好象就不能用了。各位大虾帮忙啊。</p><p>直接用sendcommand不能实现中途puase,选取图上对象</p>

jiangmolhm 发表于 2007-4-24 15:17:00

恩啊~可怜的孩子~与你共同关注~

mccad 发表于 2007-4-25 03:54:00

<p>你是怎么写的?</p><p>1.用了sendcommand就不需要再用LISP的command,而可以直接使用,注意不要括号)</p><p>2.注意你的变量要变成字符串。</p>

tkodwang 发表于 2007-4-25 09:35:00

<p>直接用sendcommand不能实现中途puase,从而选取图上对象吧</p>

dianbotang 发表于 2008-10-27 02:26:00

<p>楼主的问题可否这样解决?</p><p>xyz = 1 '比例<br/>ThisDrawing.SendCommand "(setq xyz " &amp; xyz &amp; ")" &amp; vbCr<br/>ThisDrawing.SendCommand "(command ""leader"" pause pause ""F"" ""N"" ""A"" """" ""b"" ""1.dwg"" ""s"" xyz pause """" )" &amp; vbCr<br/></p><p>不使用command的话也可以这样做:<br/>Sub leader()<br/>&nbsp; pt1 = ThisDrawing.Utility.GetPoint(, "指定引线起点")<br/>&nbsp; pt2 = ThisDrawing.Utility.GetPoint(pt1, "指定下一点")<br/>&nbsp; pt0 = ThisDrawing.Utility.GetPoint(, "指定插入点")<br/>&nbsp; lsppt1 = axPoint2lspPoint(pt1)<br/>&nbsp; lsppt2 = axPoint2lspPoint(pt2)<br/>&nbsp; lsppt0 = axPoint2lspPoint(pt0)<br/>&nbsp; <br/>&nbsp; xyz = 1 '比例<br/>&nbsp; <br/>&nbsp; ThisDrawing.SendCommand "leader" &amp; vbCr &amp; lsppt1 &amp; vbCr &amp; lsppt2 &amp; vbCr &amp; "F" &amp; vbCr &amp; "N" &amp; vbCr &amp; "A" &amp; vbCr &amp; vbCr &amp; "b" &amp; vbCr &amp; "1.dwg" &amp; vbCr &amp; "s" &amp; vbCr &amp; xyz &amp; vbCr &amp; lsppt0 &amp; vbCr &amp; vbCr<br/>End Sub</p><p>Public Function axPoint2lspPoint(ByVal Pnt As Variant) As String<br/>&nbsp;&nbsp;&nbsp; axPoint2lspPoint = Pnt(0) &amp; "," &amp; Pnt(1) &amp; "," &amp; Pnt(2)<br/>End Function<br/></p>

兰州人 发表于 2008-10-30 13:23:00

chr(34) 可以代替"",用"(command .. )" &amp; chr(34) "pause" &amp; chr(34)效果比较好。
页: [1]
查看完整版本: [求助]关于vba中使用command问题,急