- SelectionSet pSelectSet = pDocument.Editor.SelectAll().Value;
- SelectionSet pSelectSet1 = pDocument.Editor.GetSelection().Value;
- using (Transaction tran = pDatabase.TransactionManager.StartTransaction())
- {
- Entity entity = tran.GetObject(pSelectSet1.GetObjectIds()[0], OpenMode.ForRead) as Entity;
- BlockTableRecord pBlockTableRecord = (BlockTableRecord)tran.GetObject(pDatabase.CurrentSpaceId, OpenMode.ForWrite);
- foreach (ObjectId pObjId in pSelectSet.GetObjectIds())
- {
- Entity pEntity = tran.GetObject(pObjId, OpenMode.ForWrite) as Entity;
- Point3dCollection p3dCollection=new Point3dCollection();
- entity.IntersectWith(pEntity, Intersect.OnBothOperands, p3dCollection, 0, 0);
- if (p3dCollection.Count > 0)
- {
- pEntity.ColorIndex = 3;
- }
-
- }
- tran.Commit();
- }
lz试下这个代码 可以选择出所有与某一块相交的实体 |