关于sengcommand
<p> Polyline offsetBox = cutBox.GetOffsetCurves(0.2) as Polyline;<br/> if (offsetBox.Area < cutBox.Area)<br/> {<br/> offsetBox = cutBox.GetOffsetCurves(-0.2) as Polyline;<br/> }<br/> Point3d[] p = new Point3d;<br/> for (int i = 0; i < offsetBox.NumberOfVertices; i++)<br/> {<br/> p=new Point3d(offsetBox.GetPoint3dAt(i).X, offsetBox.GetPoint3dAt(i).Y, 0);<br/> }</p><p> offsetBox.Dispose();<br/> //裁剪<br/> acdDoc.SendCommand("TRIM\r");<br/> acdDoc.SendCommand(cutBox.ObjectId.ToString() + "\r\r");<br/> for (int i = p.GetLowerBound(0); i <= p.GetUpperBound(0); i++)<br/> {<br/> Point3d p1 = p;<br/> Point3d p2 = new Point3d();<br/> if (i == p.GetUpperBound(0))<br/> {<br/> p2 = p;<br/> }<br/> else<br/> {<br/> p2 = p;<br/> }<br/> acdDoc.SendCommand("f\r");<br/> acdDoc.SendCommand(p1.X.ToString()+","+p1.Y.ToString() + "\r");<br/> acdDoc.SendCommand(p2.X.ToString()+","+p2.Y.ToString() + "\r\r");<br/> //CommandLine.Command("TRIM", cutBox.ObjectId, "", "F", p1, p2, "", "");<br/> }<br/> acdDoc.SendCommand("\r");<br/>这段代码中发送坐标会让CAD死机,同样的数据也这样把坐标手工输入就没问题,为什么会这样?</p> <p>能用代码实现就尽量不要用SendCommand</p><p>看看置顶的曲线贴</p> 纠正,经过几天的跟踪调试,发现不是发送坐标引起的,是cutBox.ObjectID.Tostring()这句闹的,谁知道怎么实现向命令行发送实体? 使用曲线类的GetSplitCurves方法可以满足你的要求,不推荐用SendCommand方法 看高手出招
页:
[1]