I select a block, I explode the block and after that I want to use the SelectCrossingWindow() method for every element of the block, in order to get the entities which intersect the current entity, by using IntersectWith() method.
The other way in which I did this routine, it was by simpling getting all the objects in my drawing and see if those entities intersect by block elements. The problems in this situation is that I must stay at least 5 min for every running of the routine.
[CommandMethod("mymeth")]
public static void KLM()
{
// Get the current document and database
Document document = Application.DocumentManager.MdiActiveDocument;
Database database = document.Database;
using (Transaction transaction = database.TransactionManager.StartTransaction())
{
// Open the Block table for read
BlockTable blockTable = transaction.GetObject(database.BlockTableId, OpenMode.ForRead) as BlockTable;
// Open the Block table record Model space for write
BlockTableRecord blockTableRecord = transaction.GetObject(blockTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
PromptSelectionResult promptSelectionResult = Helper.chooseEntities("choose", document);
DBObjectCollection dBObjectCollection = new DBObjectCollection();
// If the prompt status is OK, objects were selected
Entity axDesen;
if (promptSelectionResult.Status == PromptStatus.OK)
{
SelectionSet selectionSet = promptSelectionResult.Value;
// Step through the objects in the selection set
//DBDictionary databaseDictionary = database.LayoutDictionaryId.GetObject(OpenMode.ForRead) as DBDictionary;
axDesen = transaction.GetObject(selectionSet[0].ObjectId, OpenMode.ForWrite) as Entity;
if (axDesen is BlockReference)
{
axDesen.Explode(dBObjectCollection);
foreach (Entity elementAx in dBObjectCollection)
{
if (!elementAx.GetType().Name.Equals("Circle"))
{
structuraAx.Add(elementAx);
}
}
}
else
{
Application.ShowAlertDialog("Bye!");
return;
}
}
else
{
return;
}
// here, using a foreach loop I want to use the SelectCrossingWindow for every element of structuraAx