wang_hui 发表于 2005-1-19 15:43:00

请教访问CAD的问题!(基本)

请各位帮忙看一下这个为什么不能运行:


Sub sn()<BR>ThisDrawing.SendCommand "_line 0,100 319,100       "<BR>Dim i As Single<BR>Dim x As Single<BR>Dim y As Single<BR>pi = 3.1415926<BR>For i = 0 To 2 * pi Step 0.1<BR>       x = 50 * i<BR>       y = 100 + 75 * Sin(i)<BR>       ThisDrawing.SendCommand "_point x,y       "<BR>Next i<BR>End Sub


运行老提示,画的点无较,我是刚刚用VBA弄CAD以前老用LISP,请会的告诉一下<BR>

yulijin608 发表于 2005-1-19 18:36:00

Sub sn()<BR>ThisDrawing.SendCommand "_line 0,100 319,100       "<BR>Dim i As Single<BR>Dim x As Single<BR>Dim y As Single<BR>pi = 3.1415926<BR>For i = 0 To 2 * pi Step 0.1<BR>       x = 50 * i<BR>       y = 100 + 75 * Sin(i)<BR>       ThisDrawing.SendCommand "_point " &amp; x &amp; "," &amp; y &amp; " "<BR>Next i<BR>End Sub

雪山飞狐_lzh 发表于 2005-1-20 09:04:00

VBA里尽量不用SendCommand,用AddXXX方法

wang_hui 发表于 2005-1-20 10:57:00

哦,ADDXXX又是怎么个用法,我对这些一片空白,我呆的地方还卖不到这方面的书!!!望大家不吝指教!

yulijin608 发表于 2005-1-20 15:40:00

画线可以用Thisdrawing.Modelspace.AddLine


画点可以用Thisdrawing.Modelspace.AddPoiint


建议楼主多看看对象模型<A href="http://www.mjtd.com/object/acad2004/" target="_blank" >http://www.mjtd.com/object/acad2004/</A>.

mccad 发表于 2005-1-20 18:29:00

多看看书,或多看看帮助
页: [1]
查看完整版本: 请教访问CAD的问题!(基本)