马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 csharp 于 2014-10-1 14:41 编辑
;; Brep 各顶点

- [CommandMethod("Test19")]
- public void Test19()
- {
- Transaction tr = ThisDb.TransactionManager.StartTransaction();
- PromptEntityResult per = editor.GetEntity("\nPick Region");
- if (per.Status != PromptStatus.OK) return;
- using (tr)
- {
- BlockTableRecord btr = (BlockTableRecord)tr.GetObject(ThisDb.CurrentSpaceId, OpenMode.ForWrite);
- Entity ent = (Entity)per.ObjectId.GetObject(OpenMode.ForRead);
- Brep brep = new Brep(ent);
- BrepVertexCollection bev = brep.Vertices;
- int col = 1;
- foreach (Vertex vertex in bev)
- {
- Point3d pnt = vertex.Point;
- DBPoint point = new DBPoint(pnt);
- point.ColorIndex = col;
- if (col < 255 || col == 1)
- {
- col++;
- }
- else
- {
- col--;
- }
- btr.AppendEntity(point);
- tr.AddNewlyCreatedDBObject(point, true);
- }
- tr.Commit();
- }
- }
|