customizing when closing a drawing

Discussion in 'AutoCAD' started by ldelpilar, Aug 20, 2004.

  1. ldelpilar

    ldelpilar Guest

    i want
    to create a routine in CAD where when I close a drawing it will complete a command or two. for example, instead of saving and purging before I close a drawing I would like to just close my drawing and have CAD do it for me....can anyone help?
     
    ldelpilar, Aug 20, 2004
    #1
  2. ldelpilar

    larry Guest

    you can try using reactors ( :vlr-beginclose )
    or add a customize button that will say ^C^C_qsave;(or your lisp
    command );close



    command or two. for example, instead of saving and purging before I close a
    drawing I would like to just close my drawing and have CAD do it for
    me....can anyone help?
     
    larry, Aug 20, 2004
    #2
  3. ldelpilar

    Jürg Menzi Guest

    Hi ldelpilar
    Sometimes I want also...
    Ok, as Larry says you need a reactor to do this. Add the following code
    to your acaddoc.lsp or create a new acaddoc.lsp in the AutoCAD environment.
    Code:
    (vl-load-com)
    
    (or Me:Dwr
    (setq Me:Dwr (VLR-DWG-Reactor
    nil
    '((:VLR-beginClose . MeBeginCloseStuff))
    )
    )
    )
    
    (or Me:Dmr
    (setq Me:Dmr (VLR-DocManager-reactor
    nil
    '((:VLR-documentToBeDestroyed . MeDoCloseStuff))
    )
    )
    )
    
    (defun MeBeginCloseStuff (Rea Arg)
    (AddYourFunctionHere) ;<-!!!
    (princ)
    )
    
    (defun MeDoCloseStuff (Rea Arg)
    (mapcar 'VLR-remove (list Me:Dmr Me:Dwr))
    (setq Me:Dmr nil Me:Dwr nil)
    (princ)
    )
    
    Note:
    Read the Help files 'Reactor Use Guidelines' carefully!

    Cheers
     
    Jürg Menzi, Aug 21, 2004
    #3
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.