how to activate drawing by means of Vlisp

Discussion in 'AutoCAD' started by íÁËÓÉÍ óÔÁÒËÉÏ×, Jan 8, 2004.

  1. Hi!
    I have two drawing in my AutoCAD-dwg1 and dwg2.At first dwg 1 is active.I
    want to make active dwg2 - thats why I do so

    (vl-activate dwg2)
    In the result my dwg2 becomes active, but in visual lisp IDE is a waiting
    cursor(clock) and the part of my code after (vl-activate dwg2) does not
    performs.When I make dwg1 active in AutoCAD - and retern to VL IDE cursor
    becomes normal but the program does not complete.
    Why?
    (
     
    íÁËÓÉÍ óÔÁÒËÉÏ×, Jan 8, 2004
    #1
  2. íÁËÓÉÍ óÔÁÒËÉÏ×

    Steve Jones Guest

    That's just the way it is. Search for 'separate namespace' in the help
    files.
    Once you switch to another document the routine will stop.
    You can, however, manipulate dwg2 from dwg1. Do you have to make dwg2 active
    in your routine?

    Steve
     
    Steve Jones, Jan 8, 2004
    #2
  3. íÁËÓÉÍ óÔÁÒËÉÏ×

    Mike Weaver Guest

    Your routine will have to be run in a separate namespace.
     
    Mike Weaver, Jan 8, 2004
    #3
  4. the aim of my program-to apply vlax-zoomextents method to all opened
    files(in this case dwg1 and dwg2). To do so I must activate each document
    and apply vlax-zoomextents becouse this method applyes only to active
    document.
    And when I make active dwg2 my program paused-what can I do to continue it?
     
    íÁËÓÉÍ óÔÁÒËÉÏ×, Jan 9, 2004
    #4
  5. this works for me:

    (defun f:activate (dwg / i ret)
    (cond
    ((not dwg))
    ((not (findfile dwg)))
    ((= (setq dwg (strcase dwg)) (strcase (vla-get-FullName (fx:doc)))))
    ((not (setq i (f:doc_item dwg))))
    (T
    (f:cmd (list "_.vbastmt" (strcat "AcadApplication.Documents(" (itoa i) ").Activate")))
    (setq ret dwg)
    )
    );cond
    ret)

    (defun f:doc_item (f / i ret)
    (setq i 0)
    (vlax-map-Collection (vla-get-Documents (fx:acad))
    '(lambda (doc)
    (if (= (strcase f) (strcase (vla-get-FullName doc)))
    (setq ret i)
    )
    (setq i (1+ i))
    )
    )
    ret
    )

    fx:acad and fx:doc are the acad app and current document

    Peter
     
    petersciganek, Jan 9, 2004
    #5
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.