.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
sweekly
1099 Views, 5 Replies

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

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.
5 REPLIES 5
Message 2 of 6
Anonymous
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.
Message 3 of 6
sweekly
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?
Message 4 of 6
Anonymous
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?
Message 5 of 6
sweekly
in reply to: sweekly

that got me past the autocad killing bug, thanks Tony.
Message 6 of 6
shunta17
in reply to: Anonymous

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

 

Cheers,

Sean

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost