Solved

Automation

Posted on 1999-01-25
3
210 Views
Last Modified: 2010-05-03
I have a VB6 app that from titme to time tries to read an AutoCAD drawing to check that the name is the same. However if AutoCAD is busy, I get an error generated by either AutoCAD or windows asking me to cancel or try again. This doesn't always work but in any case interrupts what I am doing in AutoCAD. Error trapping in VB6 doesn't seem to work. How can I test if AutoCAD is busy before trying to read drawing.
0
Comment
Question by:broadbent
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
mark2150 earned 100 total points
ID: 1470562
Have it attempt to rename the drawing and that should only succeed if the drawing file is idle.

Also, AutoCAD creates a working file with the same base name as the drawing while it's active. This is a good indicator that the primary .DWG is in use. I think it's called *.DWK but don't bet the farm on it.

M

0
 
LVL 4

Author Comment

by:broadbent
ID: 1470563
Renaming is simple and it works. Thanks.
AutoCAD uses .dwk extensions to signify lock files which can be disabled by the user.
Actually the elegant way (someone else gave me) is to error trap the call using
app.OleServerBusyRaiseError = True
app.OleServerBusyTimeout = 100

thanks anyway and welcome to the points
0
 
LVL 4

Author Comment

by:broadbent
ID: 1470564
Further comment:
Renaming only tests if AutoCAD has loaded the drawing, not whether AutoCAD is busy or not.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now