How do you make a tool to open a drawing from a tool palette?

How do you make a tool to open a drawing from a tool palette?

tiger4956
Advocate Advocate
633 Views
3 Replies
Message 1 of 4

How do you make a tool to open a drawing from a tool palette?

tiger4956
Advocate
Advocate

Hi, I'm trying to make a tool on a custom tool palette that will open a drawing.

 

The following command line works, but I have to press enter to complete the command and open the drawing. First, set FILEDIA=0 or this won't work at all.  The "open" command is one of the Express tools.

 

^C^C_open "D:\Dropbox\Acad\Steel Shapes.dwg";

 

The semi-colon at the end is supposed to be the same as pressing "Enter", but it doesn't work.  I also tried a space and ^M, which are also supposed to be the same as pressing enter.  I also tried replacing back-slashes with forward slashes, it still works the same, I still have to press enter to open the drawing.

 

I tried replacing "_open" with ^O but found it toggling ortho instead of opening.

 

Thanks,

 

Rob

0 Likes
Accepted solutions (1)
634 Views
3 Replies
Replies (3)
Message 2 of 4

hmsilva
Mentor
Mentor
Accepted solution

Hi Rob,

if SDI=1 your code will works as expected.

If you are not using LT, I would suggest something like this

 

^C^C(vl-load-com);(vla-activate (vla-open (vla-get-documents (vlax-get-acad-object))"D:/Dropbox/Acad/Steel Shapes.dwg"));

 

Hope this helps,
Henrique

EESignature

Message 3 of 4

tiger4956
Advocate
Advocate

Thank you very much!  Your code worked exactly as expected.  Some of my tool palettes are getting bloated, and in some cases I would just rather open the source drawing and copy-paste what I need.

 

Thanks again!

 

Rob

0 Likes
Message 4 of 4

hmsilva
Mentor
Mentor

You're welcome, Rob!
Glad I could help

Henrique

EESignature

0 Likes