Click here to Skip to main content
14,450,027 members
Rate this:
Please Sign up or sign in to vote.
See more:
[CommandMethod("FindAllHatches")]
public static void FindAllHatches()
{
    Document acDoc = Application.DocumentManager.MdiActiveDocument;
 var str=new StringBuilder();
    str.Append("\nSearching for Hatches");
 
    var db = acDoc.Database;
    using (Transaction transaction = db.TransactionManager.StartTransaction())
    {
        ObjectId idModelSpace = SymbolUtilityServices.GetBlockModelSpaceId(db);
 
        BlockTableRecord modelSpace = transaction.GetObject(idModelSpace, OpenMode.ForRead) as
            BlockTableRecord;
 
        foreach (var objId in modelSpace)
        {
            var entity = transaction.GetObject(objId, OpenMode.ForRead);
            Hatch hatch = entity as Hatch;
            if (hatch == null)
                continue; //not hatch

           str.Append("\nFound Hatch Area={0}", hatch.Area);
        } 
 acDoc.Editor.WriteMessage(str.ToString());           
    }
}


What I have tried:

This code retrieve me the area of a hatches in my autocad drawing but i want the color as well as name of a hatch to how can i get that?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100