[求助]请教高手:怎获得到thisdrawing.sendcommand绘制的autocad对象
<p><strong>编程时遇到一个问题:</strong></p><p><strong>怎样可以获得用thisdrawing.sendcommand画的CAD实体(图元)?</strong></p><p><strong>比如:</strong></p><p><strong> sub drawcir()</strong></p><p><strong> Dim circleOBJ As AcadCircle</strong></p><p><strong> ThisDrawing.SendCommand "circle" & vbCrLf & "3p" & vbCrLf</strong></p><p><strong> ' 怎样把 ThisDrawing.SendCommand "circle" & vbCrLf & "3p" & vbCrLf 绘制的圆</strong></p><p><strong> ' 赋给 circleOBJ ?</strong></p><p><strong>end sub</strong></p> <p><strong>试试下面的语句。不过如果命令行创建实体没有成功,给circleOBJ 赋值会出错。</strong></p><p><strong>sub drawcir()</strong></p><p><strong> Dim circleOBJ As AcadCircle</strong></p><strong><p><strong>dim i%</strong></p><p><strong>i=ThisDrawing.ModelSpace.Count</strong></p><p> ThisDrawing.SendCommand "circle" & vbCrLf & "3p" & vbCrLf "0,0 100,100 100,50 "</p></strong><p><strong> ' 怎样把 ThisDrawing.SendCommand "circle" & vbCrLf & "3p" & vbCrLf 绘制的圆</strong></p><p><strong> ' 赋给 circleOBJ ?</strong></p><p><strong>Set circleOBJ = ThisDrawing.ModelSpace(I)</strong></p><p><strong></strong></p><p><strong>end sub</strong></p> <p>楼上的只能解决一个圆的问题。</p> <strong>把Dim circleOBJ As AcadCircle改成Dim circleOBJ As AcadEntity</strong>
页:
[1]