+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 18
  1. #1
    Junior Member
    Using
    Map 3D 2006
    Join Date
    Oct 2007
    Posts
    10

    Default Cancel open drawing

    Registered forum members do not see this ad.

    Is there a way to Cancel the open command ?
    What i have is this

    Code:
     
    Private Sub ACADApp_BeginOpen(FileName As String)
    If FileName = something Then
    'code for cancel open
    End If
    End Sub

  2. #2
    Super Member Raggi_Thor's Avatar
    Using
    AutoCAD 2008
    Join Date
    Aug 2007
    Location
    Trondheim, NORWAY
    Posts
    718

    Default

    I wasn't able to test your code.
    Do you run it in VBA inside acad?

    Maybe some SendKey and "Esc"?
    Mvh, Kvedja, Kind Regards,
    Ragnar Thor Mikkelsen
    http://www.DESIGNDATA.no/English.htm

  3. #3
    Super Member Raggi_Thor's Avatar
    Using
    AutoCAD 2008
    Join Date
    Aug 2007
    Location
    Trondheim, NORWAY
    Posts
    718

    Default

    Just curious, why?
    Maybe redefining the Open command is another possibility?
    Mvh, Kvedja, Kind Regards,
    Ragnar Thor Mikkelsen
    http://www.DESIGNDATA.no/English.htm

  4. #4
    Junior Member
    Using
    Map 3D 2006
    Join Date
    Oct 2007
    Posts
    10

    Default

    sorry but i was out.
    What i want is when someone tries to open a drawing at a specific path a message will ask the user if he wants the drawing to open in read-only or not state.
    So i thought that i could do this with the "BeginOpen" event.
    The code should do this.

    1.Check the path of the drawing that is about to open
    2.Ask if it should open read-only
    3.Then open the drawing

    About redefining the Open command i don't know how it can be done , maybe a little help.

  5. #5
    Super Member Raggi_Thor's Avatar
    Using
    AutoCAD 2008
    Join Date
    Aug 2007
    Location
    Trondheim, NORWAY
    Posts
    718

    Default

    Think about setting the property for theses files or folders to "Read only" in Windows Explorer. Isn't that easier?

    If you use Lisp to define a command like this:

    (defun c:OPEN()
    ...
    )

    Then you can use the command UNDEFINE to make AutoCAD forget about the normal OPEN command..
    Use REDEFINE to get back the normal command.
    Mvh, Kvedja, Kind Regards,
    Ragnar Thor Mikkelsen
    http://www.DESIGNDATA.no/English.htm

  6. #6
    Junior Member
    Using
    Map 3D 2006
    Join Date
    Oct 2007
    Posts
    10

    Default

    After a long search i found that you can't stop the open command from the "beginopen" event.
    The only thing you can do is redefine the open command.
    Raggi_Thor thanks for your help.

  7. #7
    Super Member Raggi_Thor's Avatar
    Using
    AutoCAD 2008
    Join Date
    Aug 2007
    Location
    Trondheim, NORWAY
    Posts
    718

    Default

    What about setting some folders or files (drawings) to read only for certain users? Isn't that what you really want?
    Mvh, Kvedja, Kind Regards,
    Ragnar Thor Mikkelsen
    http://www.DESIGNDATA.no/English.htm

  8. #8
    Junior Member
    Using
    Map 3D 2006
    Join Date
    Oct 2007
    Posts
    10

    Default

    Yes but what i want is to protect drawings from those who will have full access. Very often someone opens a drawing for viewing or to plot something , make changes and when he closes the drawing instead of pressing "no" to the question about saving , he presses "yes" and the drawing get all mess up.

    The only thing that i want now is to find a way to "browse" for a drawing through VBA. Can you help?

  9. #9
    Super Member Raggi_Thor's Avatar
    Using
    AutoCAD 2008
    Join Date
    Aug 2007
    Location
    Trondheim, NORWAY
    Posts
    718

    Default

    First I want to be sure you understand what I am saying about setting file properties in the Windows explorer.
    If you right click on a file or a folder and select Properties and then you can check the Read Only attribute. This can be set for all files in a folder and sub folders if you like.

    When you open a drawing that is read only, it behave exactly the way you want. The save command does not work as normally.
    Mvh, Kvedja, Kind Regards,
    Ragnar Thor Mikkelsen
    http://www.DESIGNDATA.no/English.htm

  10. #10
    Junior Member
    Using
    Map 3D 2006
    Join Date
    Oct 2007
    Posts
    10

    Default

    Registered forum members do not see this ad.

    I understand. But making the files read-only for everyone means that if you want to make changes you would have to go to the files properties and uncheck the read-only option.
    With network-users you can assign read-only privileges to certain users ,but what about others that have full access??? They can still modify a drawing by mistake. That is what i'm trying to prevent.

Similar Threads

  1. Can't open drawing
    By Benny in forum AutoCAD Drawing Management & Output
    Replies: 4
    Last Post: 6th Sep 2007, 12:04 am
  2. Open CAD drawing at specific path
    By MadMax in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 11th May 2007, 11:28 am
  3. Open drawing dialogue box
    By piaLarman in forum AutoCAD Drawing Management & Output
    Replies: 4
    Last Post: 2nd May 2007, 02:04 pm
  4. intercept a drawing open
    By klloyd in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 6th Mar 2007, 06:04 am
  5. Open a drawing to a named view
    By AutoCAD Tips Blog in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 28th Sep 2006, 03:50 am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts