mycad 发表于 2009-10-27 07:28:00

[求助]请教高手:怎获得到thisdrawing.sendcommand绘制的autocad对象

<p><strong>编程时遇到一个问题:</strong></p><p><strong>怎样可以获得用thisdrawing.sendcommand画的CAD实体(图元)?</strong></p><p><strong>比如:</strong></p><p><strong>&nbsp;sub drawcir()</strong></p><p><strong>&nbsp;&nbsp;&nbsp;&nbsp; Dim circleOBJ As AcadCircle</strong></p><p><strong>&nbsp;&nbsp;&nbsp; ThisDrawing.SendCommand "circle" &amp; vbCrLf &amp; "3p" &amp; vbCrLf</strong></p><p><strong>&nbsp;&nbsp;&nbsp;&nbsp; ' 怎样把&nbsp; ThisDrawing.SendCommand "circle" &amp; vbCrLf &amp; "3p" &amp; vbCrLf 绘制的圆</strong></p><p><strong>&nbsp;&nbsp;&nbsp; '&nbsp; 赋给 circleOBJ ?</strong></p><p><strong>end sub</strong></p>

烟雨.江南 发表于 2009-10-27 09:07:00

<p><strong>试试下面的语句。不过如果命令行创建实体没有成功,给circleOBJ 赋值会出错。</strong></p><p><strong>sub drawcir()</strong></p><p><strong>&nbsp;&nbsp;&nbsp;&nbsp; Dim circleOBJ As AcadCircle</strong></p><strong><p><strong>dim i%</strong></p><p><strong>i=ThisDrawing.ModelSpace.Count</strong></p><p>&nbsp;&nbsp;&nbsp; ThisDrawing.SendCommand "circle" &amp; vbCrLf &amp; "3p" &amp; vbCrLf "0,0 100,100 100,50 "</p></strong><p><strong>&nbsp;&nbsp;&nbsp;&nbsp; ' 怎样把&nbsp; ThisDrawing.SendCommand "circle" &amp; vbCrLf &amp; "3p" &amp; vbCrLf 绘制的圆</strong></p><p><strong>&nbsp;&nbsp;&nbsp; '&nbsp; 赋给 circleOBJ ?</strong></p><p><strong>Set circleOBJ = ThisDrawing.ModelSpace(I)</strong></p><p><strong></strong></p><p><strong>end sub</strong></p>

mycad 发表于 2009-10-27 09:22:00

<p>楼上的只能解决一个圆的问题。</p>

wylong 发表于 2009-10-27 09:26:00

<strong>把Dim circleOBJ As AcadCircle改成Dim circleOBJ As AcadEntity</strong>
页: [1]
查看完整版本: [求助]请教高手:怎获得到thisdrawing.sendcommand绘制的autocad对象