本帖最后由 sxpd 于 2012-7-7 08:50 编辑
- /// <summary>
- /// 获取复合实体的子实体集合
- /// </summary>
- /// <typeparam name="T">复合实体类型(PolyLine2d/3d、PolyfaceMesh......)</typeparam>
- /// <param name="ent">复合实体</param>
- /// <param name="tr">事务实例</param>
- /// <returns>子实体迭代器</returns>
- public static IEnumerable<Vertex> GetVertexs<T>(this T ent, Transaction tr) where T : Entity, IEnumerable
- {
-
- foreach (ObjectId id in ent)
- {
- yield return (Vertex)tr.GetObject(id, OpenMode.ForRead);
- }
- }
- /// <summary>
- /// 获取复合实体的子实体集合
- /// </summary>
- /// <typeparam name="T">复合实体类型(PolyLine2d/3d、PolyfaceMesh......)</typeparam>
- /// <param name="ent">复合实体</param>
- /// <param name="tr">事务实例</param>
- /// <param name="mode">打开模式(读/写)</param>
- /// <returns>子实体迭代器</returns>
- public static IEnumerable<Vertex> GetVertexs<T>(this T ent, Transaction tr, OpenMode mode) where T : Entity, IEnumerable
- {
- foreach (ObjectId id in ent)
- {
- yield return (Vertex)tr.GetObject(id, mode);
- }
- }
|