Polyline offsetBox = cutBox.GetOffsetCurves(0.2)[0] as Polyline; if (offsetBox.Area < cutBox.Area) { offsetBox = cutBox.GetOffsetCurves(-0.2)[0] as Polyline; } Point3d[] p = new Point3d[offsetBox.NumberOfVertices]; for (int i = 0; i < offsetBox.NumberOfVertices; i++) { p=new Point3d(offsetBox.GetPoint3dAt(i).X, offsetBox.GetPoint3dAt(i).Y, 0); } offsetBox.Dispose(); //裁剪 acdDoc.SendCommand("TRIM\r"); acdDoc.SendCommand(cutBox.ObjectId.ToString() + "\r\r"); for (int i = p.GetLowerBound(0); i <= p.GetUpperBound(0); i++) { Point3d p1 = p; Point3d p2 = new Point3d(); if (i == p.GetUpperBound(0)) { p2 = p[0]; } else { p2 = p[i + 1]; } acdDoc.SendCommand("f\r"); acdDoc.SendCommand(p1.X.ToString()+","+p1.Y.ToString() + "\r"); acdDoc.SendCommand(p2.X.ToString()+","+p2.Y.ToString() + "\r\r"); //CommandLine.Command("TRIM", cutBox.ObjectId, "", "F", p1, p2, "", ""); } acdDoc.SendCommand("\r"); 这段代码中发送坐标会让CAD死机,同样的数据也这样把坐标手工输入就没问题,为什么会这样? |