Results 1 to 5 of 5

Thread: Extracting Block Information

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2008-12
    Posts
    1
    Login to Give a bone
    0

    Smile Extracting Block Information

    Hi all,

    I'm working on a .NET C# Windows app for automatically indexing drawings, I need to extract titles and drawing numbers from blocks on drawings. (our drawings have been built with templates which contain meaningful blocks).

    Doesn't anyone have a headstart on this before I spend days getting my head round the API?

    Much appreciated.

    James.

  2. #2
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Extracting Block Information

    I have only worked with .Net within Acad, so I'm not sure how to connect and that stuff from windows, but once you get into the drawing you search the BlockTable to see if the blocks exists in the drawing, and once you know they do, the BlockTableRecord has a method to get all the inserted blocks ( BlockReference ), GetBlockReferenceIds. Once you get that, then you can get the AttributeCollection from the BlockReference, and get all the information you need.

  3. #3
    Member
    Join Date
    2008-08
    Posts
    49
    Login to Give a bone
    0

    Default Re: Extracting Block Information

    Kean Wamsley gives some good insight on working with blocks here

    http://through-the-interface.typepad...erface/blocks/

    I believe there is a way to use possibly RealDWG or a different way to access block information without opening the actual drawing.

    Other than that....here is a way to start autocad and open a drawing from an outside program

    Autodesk.AutoCAD.Interop.AcadApplication acadApplication = new Autodesk.AutoCAD.Interop.AcadApplication;
    acadDrawing = acadApplication.Documents.Open(<pathname>, true, paramMissing);
    acadApplication.ActiveDocument.SendCommand(<command>);

    Make sure you also close your drawings and kill the application when you are done or you will get some dreaded HRResult error

    if (acadDrawing != null)
    {

    acadDrawing.Close(false, paramMissing);
    acadDrawing = null;
    }


    Process[] aCAD = Process.GetProcessesByName("acad");

    foreach (Process aCADPro in aCAD)
    {
    aCADPro.CloseMainWindow();
    }



    make sure you reference acdbmgd.dll and acmgd.dll from your AutoCAD root folder

  4. #4
    AUGI Addict sinc's Avatar
    Join Date
    2004-02
    Location
    Colorado
    Posts
    1,986
    Login to Give a bone
    0

    Default Re: Extracting Block Information

    To open a file and access the block table, use the Database.ReadDwgFile() method.

  5. #5
    Active Member Kerry Brown's Avatar
    Join Date
    2006-08
    Location
    Brisbane : GMT+10
    Posts
    87
    Login to Give a bone
    0

    Default Re: Extracting Block Information

    AutoCAD 2007,2008,2009 folders contain a AcDx.dll
    which contains the namespace Autodesk.AutoCAD.DataExtraction

    .. that may be of use.

Similar Threads

  1. Extracting text information from block
    By samir.joshi in forum AutoLISP
    Replies: 5
    Last Post: 2009-07-07, 03:11 AM
  2. Extracting Attribute Information
    By stephen.coff in forum AutoLISP
    Replies: 2
    Last Post: 2006-11-19, 09:07 PM
  3. Extracting information from Autocad
    By louis.64641 in forum AutoCAD General
    Replies: 2
    Last Post: 2005-06-30, 10:51 PM
  4. Extracting information from ABS
    By stelthorst in forum AMEP General
    Replies: 6
    Last Post: 2005-06-27, 08:39 PM
  5. Extracting Room Information
    By jay.10209 in forum AutoCAD Customization
    Replies: 2
    Last Post: 2004-12-10, 09:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •