VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Opening Drawings not read only with VB

3 REPLIES 3
Reply
Message 1 of 4
rochemont_j
138 Views, 3 Replies

Opening Drawings not read only with VB

Hi,

I'm facing a little problem which I can't solve:

I want to open a drawing from VB (6). I'm opening it from the documents collection. So it goes something like this:

set objacad = New AutoCAD.AcadApplication
objAcad.Documents.Open .DrawingCombo.Text , False

yadiyadiya

objacad.Visible = true

So up to here it works. The problem begins when the user already has the particular drawing open. despite the false option in the open command it still opens read only.

I've circumvented this by first checking al the windows in the objacad for an active file with the same name and then make it active. This also works, but the routine only checks the first acad application in the ROT. If it is running lower in the hierarchie the routine comes up with nothing and you've got the same document opened twice (sometimes read only, sometimes not).

So does anybody have an solution other then writing a API wrapper which checks al windows/processes. There use to be a type of lockfile when a drawing was opened (release 13 and earlier).

Any help would be greatly appreciated.


Thanx


James
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: rochemont_j

Two approaches depending upon your version of AutoCAD

1. With at least all versions since 2000, there is a WHOHAS.ARX that
deptermines who, if anyone, has the file in question open.

2. If 2004, there is hidden lock file create whenever a drawing is
opened named whateverdrawing.DWL. The dwl is an ascii text file with
info on who opened the file and when.

HTH,
Mike
___________________________
Mike Tuersley
AutoCAD Clinic
Rand IMAGINiT Technologies
Message 3 of 4
rochemont_j
in reply to: rochemont_j

Thanks for the info, but I'm not that familiar with objectARX (acad 2000 version). I've looked at it at in the developers section and it seems it works with C++. Any idea how to use it with VB? Cause i dont have or know how to C++.

Thanks in advance


James
Message 4 of 4
Anonymous
in reply to: rochemont_j

You don't need to know any C++. I wwas also mistaken about the dwl file
- it is created by whohas, not 2004. Here is how to do it:

1. Make sure whohas.arx is automatically loaded with all cad installs -
just add it to the acad.rx file

2. This will generate a dwl file for drawing file whenever it is opened

3. Search for the dwls
___________________________
Mike Tuersley
AutoCAD Clinic
Rand IMAGINiT Technologies

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

Post to forums  

Autodesk Design & Make Report

”Boost