...
using CADImport;
using CADImport.DWG;
using CADImport.DXF;
using CADImport.RasterImage;
...
private void Find_block_Click(object sender, EventArgs e)
{
//CADImage.CreateImageByExtension detects format by the extension specified in the argument.
//The correct class for any supported format will be used automatically. We recommend to
//create a new drawing object with CADImage.CreateImageByExtension if import from the existed
//file/stream is required.
CADImage vDrawing = CADImage.CreateImageByExtension(@"..\..\..\Files\Entities.dxf");
vDrawing.LoadFromFile(@"..\..\..\Files\Entities.dxf");
string BlockName = "Block1"; //The block name is Block1
for (int i = 0; i < vDrawing.Converter.Blocks.Count; i++)
if (((CADBlock)vDrawing.Converter.Blocks[i]).Name.ToLower() == BlockName.ToLower())
{ //found
MessageBox.Show("Block with name '" + BlockName + "' has found.\nIndex of the block is " + i);
break;
}
}