Opening Drawings not read only with VB

Discussion in 'AutoCAD' started by rochemont_j, Jul 15, 2003.

  1. rochemont_j

    rochemont_j Guest

    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
     
    rochemont_j, Jul 15, 2003
    #1
  2. rochemont_j

    rochemont_j Guest

    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
     
    rochemont_j, Jul 16, 2003
    #2
  3. rochemont_j

    Tim Arheit Guest

    There is also a command line version available as well, so I don't
    think you really need to interface autocad to do it. It uses the
    NetFileEnum windows API function call. I'm not sure how to use it.

    There is some information on making an ActiveX control usint this
    funciton (Which you could setup to call from vba) at
    http://archive.devx.com/premier/mgznarch/vbpj/1999/09sep99/cb0999.pdf

    Googleing: "netfileenum vb" seems to turn up a number of promising
    hits.
     
    Tim Arheit, Jul 16, 2003
    #3
  4. 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
     
    Mike Tuersley, Jul 16, 2003
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.