Selecting thru a viewport

Discussion in 'AutoCAD' started by sbrusco, Feb 10, 2005.

  1. sbrusco

    sbrusco Guest

    This snippett prompts the user to select an entity, while in either
    model space or paper space, and returns a list like that returned
    by ENTSEL. The entity selected should exist in mspace but could be
    selected through a vport while in pspace.

    It works fine while in mspace and even works from pspace IF there is
    only one vport. If there is more than one vport, it trys to select
    from the vport that was most recently active instead of the vport
    that the cursor is over.

    How do I determine which vport the cursor is 'theoretically' picking 'through'?

    Additionally, how can I ignore entities in pspace?

    Of course, any coding criticism is also appreciated.



    (DEFUN ObjSelTrans (/ enName obj prmpt pt1ms pt1ps )
    ;; do not localize 'sca'
    (SETQ prmpt "\nSelect Object to be tagged")
    (COND
    ((= 1 (GETVAR "TILEMODE")) ;tiled space - aka model space
    (WHILE (NOT (SETQ obj (ENTSEL prmpt)))
    )
    )
    ((= 1 (GETVAR "CVPORT")) ;paperspace
    (PROGN
    ;; get the point in paperspace
    (SETQ pt1ps (GETPOINT prmpt))
    (SETQ pt1ms (TRANS (TRANS pt1ps 3 2) 2 0)) ;translate to mspace
    (COMMAND "._mspace") ;change to mspace
    (SETQ enName (SSNAME (SSGET pt1ms) 0)) ;find ent in mspace
    (COMMAND "._pspace") ;change back to pspace
    (SETQ sca (GETVAR "PSLTSCALE"))
    (SETQ obj (LIST enName pt1ps))
    )
    )
    ;; in a viewport
    (T ;model space thru paperspace viewport
    (WHILE (NOT (SETQ obj (ENTSEL prmpt)))
    )
    )
    )
    )
     
    sbrusco, Feb 10, 2005
    #1
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.