wxpsky113 发表于 2007-6-2 11:39:00

[求助]怎么调出CAD中直线的坐标值

<div class="tpc_content">在CAD模型空间里随便画一条直线<br/>然后用VBA编程输出该直线的起始点和结束点坐标值<br/>Sub OpenDrawing()<br/><br/>Dim LineObj As AcadLine<br/>Dim a As Variant<br/>Dim b As Variant<br/>Set LineObj = ThisDrawing.ModelSpace.Item(0)<br/>a = LineObj.StartPoint<br/>b = LineObj.EndPoint<br/>MsgBox "a=" &amp; a &amp; "&nbsp; &nbsp; b=" b<br/><br/>End Sub<br/><br/>我做出以上程序,但是运行不出来,望高手指教,谢谢!</div>

wxpsky113 发表于 2007-6-2 11:41:00

<div class="tpc_content">本人急用此程序,全天候在线等回答,请高手帮忙,感激不尽!</div><div class="tpc_content"></div><div class="tpc_content"></div><div class="tpc_content"></div>

wmz 发表于 2007-6-2 11:59:00

<div>Sub OpenDrawing()</div><div></div><div>Dim LineObj As AcadLine<br/>Dim a As Variant<br/>Dim b As Variant<br/>Dim x(2) As Double, Y(2) As Double<br/>Dim xx(2) As Double, yy(2) As Double<br/>x(0) = 10: x(1) = 10: x(2) = 0<br/>Y(0) = 50: Y(1) = 50: Y(2) = 0<br/>Set LineObj = ThisDrawing.ModelSpace.AddLine(x, Y)<br/>a = LineObj.StartPoint<br/>b = LineObj.EndPoint<br/>xx(0) = a(0): xx(1) = a(1)<br/>yy(0) = b(0): yy(1) = b(1)</div><div></div><div>&nbsp; MsgBox "xx=" &amp; xx(0) &amp; "&nbsp;&nbsp;&nbsp; xx=" &amp; xx(1)<br/>&nbsp; MsgBox "yy=" &amp; yy(0) &amp; "&nbsp;&nbsp;&nbsp; yy=" &amp; yy(1)</div><div></div><div>End Sub</div>

wmz 发表于 2007-6-2 12:07:00

<div>Sub OpenDrawing()</div><div></div><div>Dim LineObj As AcadLine<br/>Dim a As Variant<br/>Dim b As Variant<br/>Dim x(2) As Double, Y(2) As Double<br/>Set LineObj = ThisDrawing.ModelSpace.Item(0)<br/>a = LineObj.StartPoint<br/>b = LineObj.EndPoint<br/>x(0) = a(0): x(1) = a(1)<br/>Y(0) = b(0): Y(1) = b(1)</div><div></div><div>&nbsp; MsgBox "x=" &amp; x(0) &amp; "&nbsp;&nbsp;&nbsp; x=" &amp; x(1)<br/>&nbsp; MsgBox "y=" &amp; Y(0) &amp; "&nbsp;&nbsp;&nbsp; y=" &amp; Y(1)</div><div></div><div>End Sub</div>
页: [1]
查看完整版本: [求助]怎么调出CAD中直线的坐标值