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

DetachImage

2 REPLIES 2
Reply
Message 1 of 3
ffattizzi
226 Views, 2 Replies

DetachImage

I have written a command that retrieves an image from http://terraserver.microsoft.com/ and inserts it into a drawing. I would like my code to check if an image has already been inserted, and if so, remove the image, then retrieve an updated image. So far I have been unsuccessful in removing the image.

I have tried 3 different ways to remove the image:

SendStringToExecute didn't work because the command doesn't execute until after my command competes.

I tried a library from Tony Tanzillo (http://www.caddzone.com/CommandLine.cs), I called it like this:
ret = CommandLine.Command(".-IMAGE", "Detach", shortImageName);

Finally, I tried calling a Lisp function that is a wrapper for (command "-IMAGE" "D" imageKey)

If I enter the commands on the command line the image detaches, but I'm left with a box where the image was. When the commands are run by my C# code, the image stays attached.

How can I completely remove an image from my drawing in C#?

Thanks,

Frank
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: ffattizzi

Are you running from a registered command handler?

If so, can you show the CommandMethod attribute for it?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5555077@discussion.autodesk.com...
I have written a command that retrieves an image from http://terraserver.microsoft.com/ and inserts it into a drawing. I would like my code to check if an image has already been inserted, and if so, remove the image, then retrieve an updated image. So far I have been unsuccessful in removing the image.

I have tried 3 different ways to remove the image:

SendStringToExecute didn't work because the command doesn't execute until after my command competes.

I tried a library from Tony Tanzillo (http://www.caddzone.com/CommandLine.cs), I called it like this:
ret = CommandLine.Command(".-IMAGE", "Detach", shortImageName);

Finally, I tried calling a Lisp function that is a wrapper for (command "-IMAGE" "D" imageKey)

If I enter the commands on the command line the image detaches, but I'm left with a box where the image was. When the commands are run by my C# code, the image stays attached.

How can I completely remove an image from my drawing in C#?

Thanks,

Frank
Message 3 of 3
ffattizzi
in reply to: ffattizzi

[CommandMethod("DetachImage")]

- Frank

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