Jump to content

Recommended Posts

Posted

Hello,

 

I wrote a VBA program that exports several drawings from paperspace to model, using following code for each drawing:

1. SendCommand "_exportlayout "
2. SendKeys "d:\example.dwg" 'specify destination file
3. SendKeys "{ENTER}" 'export
4. Application.Wait (Now + TimeValue("0:00:10")) 'wait for export to finish
5. SendKeys "{ENTER}" 'open exported drawing

 

As I didn't know how tu use exportlayout command with parameters specyfying destination file and whether I wish to open exported drawing or not, I had to use SendKeys function.

Sometimes export takes so long, that application "forgets" keys that i send in line 5, so i had to add line 4.

But now the program needlessly waits for smaller drawings, that export quite fast, and sometimes breaks for exceptionally large drawings, when 10s delay is not enough.

 

So, my question is:

Is it possible to specify destination file and whether to open exported drawing, using command parameters so I wouldn't have to use SendKeys function?

Or maybe somehow tell the program to wait while AutoCAD is busy converting the drawing?

 

Thanks in advance for any reply.

 

PS. My program was written in Excel VBA.

PPS. If it's impossible to do it in VBA, maybe it possible to solve this problem with LISP routine?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...