CAD 精简多段线顶点——cad c# 二次开发
效果如下:
部分代码如下(须完善):
public static void DD()
{
using var tr = new DBTrans();
// CreateSimplePolyline3d();
//*****polyline2d转polyline开始
//tr.Editor.GetEntities<Polyline2d>(out List<Polyline2d> mypl2d, "\n请选择polyline2d\n");
//Polyline2dToPolyline(tr, mypl2d[0]);
//*****polyline2d转polyline结束
//if (!tr.Editor.GetEntities<Curve>(out List<Curve> mycur, "")) return;
//tr.Database.CurvesToPolyLine(mycur);//手画一个椭圆,转为多段线
if (!tr.Editor.GetEntities<Polyline>(out List<Polyline> mypl, "\n选择polyline")) return;
var resultPl = SimplifyPolylines(mypl, 5);
//resultPl[0].ColorIndex = 1;
tr.ModelSpace.AddEntity(resultPl);
}