• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    Contributor
    Posts: 16
    Registered: ‎03-01-2010

    How do I get the 'status' of an attached image vis .NET

    336 Views, 5 Replies
    05-24-2010 10:15 AM
    Hello all. I am trying to clean up our drawing database and have run across several drawings that are showing external file references with a status of 'unreferenced'. During a scan early last week of all current revisions of our drawings (about 120000) we uncovered about 7500 drawings that don't quite cut the mustard as it pertains to the use of attachments. I have written a small .NET app that scans through my drawings, but I am having difficulty with one aspect of my probing.

    I need to be able to open up an AutoCAD drawing, navigate to said drawings image dictionary, get a RasterImageDef from that dictionary, and then check to see what the 'status' of that drawing is. By 'status' I mean the status as reported in the External References dialog that appears when using the command 'xref'. In particular, I want to write out/show a message when I encounter a drawing with an attachment that has a status of 'Unreferenced', which I take to mean that the drawing was attached at one point, has been unloaded, but not properly detached.

    My problem is that I can't seem to get to any property that shows that status. I have used ARXDBG to snoop the database and I can verify that I see the images still in the image dictionary, but not in the drawing itself. I also can't seem to get at thte status of the attachment. To compund the matter, everytime I try to inspect the RasterImageDef object I get, AutoCAD locks up and bombs out.

    Anyone have a means to do this? I am guessing I could get at what I need via C++/ObjectARX but I don't want to go that route if I dont have to. I have attached a snippet of the code I am currently using to scan through my drawings, not perfect or even pretty, but it works.
    Please use plain text.
    *Tony Tanzillo

    Re: How do I get the 'status' of an attached image vis .NET

    05-24-2010 03:31 PM in reply to: sweekly
    The problem you're having occurs because the runtime
    extension/object enabler that contains the RasterImage
    and RasterImageDef managed wrapper objects is not
    loaded when you try to access them.

    I reported this problem two releases back but they
    have yet to fix it.

    Implement IExtensionApplication in your project, and
    in your Initialize() method, add this:

    new RasterImage().Dispose();

    You only need to do this once per AutoCAD session.

    --
    http://www.caddzone.com

    AcadXTabs: MDI Document Tabs for AutoCAD
    Supporting AutoCAD 2000 through 2011

    http://www.acadxtabs.com

    Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

    wrote in message news:6396331@discussion.autodesk.com...
    Hello all. I am trying to clean up our drawing database and have run across
    several drawings that are showing external file references with a status of
    'unreferenced'. During a scan early last week of all current revisions of our
    drawings (about 120000) we uncovered about 7500 drawings that don't quite cut
    the mustard as it pertains to the use of attachments. I have written a small
    .NET app that scans through my drawings, but I am having difficulty with one
    aspect of my probing.

    I need to be able to open up an AutoCAD drawing, navigate to said drawings image
    dictionary, get a RasterImageDef from that dictionary, and then check to see
    what the 'status' of that drawing is. By 'status' I mean the status as reported
    in the External References dialog that appears when using the command 'xref'.
    In particular, I want to write out/show a message when I encounter a drawing
    with an attachment that has a status of 'Unreferenced', which I take to mean
    that the drawing was attached at one point, has been unloaded, but not properly
    detached.

    My problem is that I can't seem to get to any property that shows that status.
    I have used ARXDBG to snoop the database and I can verify that I see the images
    still in the image dictionary, but not in the drawing itself. I also can't seem
    to get at thte status of the attachment. To compund the matter, everytime I try
    to inspect the RasterImageDef object I get, AutoCAD locks up and bombs out.

    Anyone have a means to do this? I am guessing I could get at what I need via
    C++/ObjectARX but I don't want to go that route if I dont have to. I have
    attached a snippet of the code I am currently using to scan through my drawings,
    not perfect or even pretty, but it works.
    Please use plain text.
    Contributor
    Posts: 16
    Registered: ‎03-01-2010

    Re: How do I get the 'status' of an attached image vis .NET

    05-25-2010 10:40 AM in reply to: sweekly
    Done and done but still failing. Still getting an autocad lockup followed by immediate death of app when I try to inspect the RasterImageDef. I can't rule out some other issue in my code though.

    Is there a property that you know of that I can interrogate to get my ellusive status? Or will I have to implement a LISP caller or drop into ARX?
    Please use plain text.
    *Tony Tanzillo

    Re: How do I get the 'status' of an attached image vis .NET

    05-25-2010 09:42 PM in reply to: sweekly
    Oops.. Sorry, I forgot about this one, which I also ran into
    when I was working on the AutoCAD Database Explorer.

    There is a bug in the RasterImageDef API.

    The workaround is to open the RasterImageDef using
    OpenMode.ForWrite.

    --
    http://www.caddzone.com

    AcadXTabs: MDI Document Tabs for AutoCAD
    Supporting AutoCAD 2000 through 2011

    http://www.acadxtabs.com

    Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

    wrote in message news:6397066@discussion.autodesk.com...
    Done and done but still failing. Still getting an autocad lockup followed by
    immediate death of app when I try to inspect the RasterImageDef. I can't rule
    out some other issue in my code though.

    Is there a property that you know of that I can interrogate to get my ellusive
    status? Or will I have to implement a LISP caller or drop into ARX?
    Please use plain text.
    Contributor
    Posts: 16
    Registered: ‎03-01-2010

    Re: How do I get the 'status' of an attached image vis .NET

    05-27-2010 11:47 AM in reply to: sweekly
    that got me past the autocad killing bug, thanks Tony.
    Please use plain text.
    Active Member
    shunta17
    Posts: 6
    Registered: ‎06-24-2011

    Re: How do I get the 'status' of an attached image vis .NET

    09-11-2011 02:58 PM in reply to: *Tony Tanzillo

    Thanks for providing that work around Tony. Saved me a lot of time.

     

    Cheers,

    Sean

    Please use plain text.