CAD中存在面域(region),当用系统自带命令是,生成的是断开的直线Line。
此插件可实现面域转为闭合的多段线(Polyline)。效果如下:
一次转600个图形
部分代码如下:
public class 面域转线Demo
{
[CommandMethod("xx")]
public static void shp()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
string layerName = "面域转线层";
if ( ! Env.Editor.GetEntities<Region>(out List<Region> regions,"") ) return;
var ents = 面域封装.面域转实体多段线(regions,0.1,true,0);
db.AddLayer(layerName, 1);
// db.SetLayer(ents[0], layerName);//有bug
db.AddEntityToModeSpacelayer(layerName ,ents.ToArray());
// ents.ForEach(x => x.ChangeEntityColor(3));
"ok\n作者qq\n".Print();
}
}