region如何转化为polyline
region里面有多个独立封闭小区域,如何转化为polyline?大侠们,如何实现?
给个思路和关键代码
Cad2008以上,引用Brep库
以下只能炸开,然后自己写程序合并线段? Brep库没有用过 该如何使用啊?
给段简单代码可以吗?
writeby xdcad csharp
public void Test13()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
Database database = doc.Database;
PromptEntityOptions peo = new PromptEntityOptions("\nSelect Region");
peo.SetRejectMessage("\nOnly Region");
peo.AddAllowedClass(typeof(Region), true);
PromptEntityResult per = ed.GetEntity(peo);
if (per.Status != PromptStatus.OK) return;
using (Transaction tr = database.TransactionManager.StartTransaction())
{
ObjectId id = per.ObjectId;
Entity ent = (Entity)id.GetObject(OpenMode.ForRead);
Brep brep = new Brep(ent);
BrepEdgeCollection elp = brep.Edges;
BlockTableRecord btr = (BlockTableRecord) tr.GetObject(database.CurrentSpaceId, OpenMode.ForWrite);
int i = 1;
foreach (Edge edge in elp)
{
NurbCurve3d c3d = edge.GetCurveAsNurb();
Curve cv = Curve.CreateFromGeCurve(c3d);
cv.ColorIndex = i;
btr.AppendEntity(cv);
tr.AddNewlyCreatedDBObject(cv, true);
i++;
}
tr.Commit();
}
} 谢谢大师,我用region先做切割运算 后把结果分解成polyline Brep 和BrepEdgeCollection 在哪个类库里面,我找了半天没有找到
页:
[1]