Results 1 to 4 of 4

Thread: How do I pass a selection on to LISP?

  1. #1
    100 Club dfuehrer's Avatar
    Join Date
    2004-11
    Posts
    130
    Login to Give a bone
    0

    Default How do I pass a selection on to LISP?

    Hello everyone,

    With my limited knowledge of LISP, I am attempting to write a lisp that will change the orientation of what is displayed inside of a paperspace viewport. After a great amount of searching here, I finally discovered that the DVIEW --> TWist command does what I am looking for. Rotating the UCS around the Z axes, and then using plan +[ENTER] will zoom/extents everytime! My wish is to kep the viewport scale the same, only rotate the view. DVIEW seems to do this for me. Alright, enough history, here is where I am at...

    I am able to get my code to run correctly, but if there is more than one viewport on the layout tab, it always seems to default to the last one that was active. So I have attemped to further modify my code to prompt me for which VP I want. So far, so good. It asks me, and I pick the one I want. here is where I am lost...

    After I choose which VP I want, it is still defaulting to the last active viewport anyway!

    Are there any LISP gurus out there that would be willing to help out a fellow AutoCAD user? Here is the code I have so far:

    Code:
    (defun c:r0 ()
    	(SETVAR "CMDECHO" 0)
    	(SETQ SCMDE (GETVAR "CMDECHO"))
    	(setq ss (car (entsel "\nSelect a object")))
    	(setq ss1 (entget ss))
    	(command "_.MSPACE")
    	(command "dview" "" "tw" "0" "")
    	(command "rea")
    	(command "_.PSPACE")
    	(princ))
    Also, how would I write this, to also prompt me for the angle when I select the viewport, rather than have one routine for each angle (as you can see, I am only rotating it to the 0 angle at the moment...)?

    Thanks in advance!

    Don
    Last edited by Opie; 2007-09-18 at 04:10 PM. Reason: [CODE] tags added

  2. #2
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: How do I pass a selection on to LISP?

    Maybe something like
    Code:
    (defun c:r0 (/ ss VpId ss1)
    	(SETVAR "CMDECHO" 0)
    	(SETQ SCMDE (GETVAR "CMDECHO"))
    	(setq ss (car (entsel "\nSelect viewport to rotate view: ")))
            (setq VpId (cdr (assoc 69 (entget ss))))
    	(setq ss1 (entget ss))
    	(command "_.MSPACE")
            (setvar "cvport" VpId)
    	(command "_.dview" "" "tw" (getreal "\n Enter twist angle desired: ") "")
    	(command "_.regenall")
    	(command "_.PSPACE")
    	(princ))

  3. #3
    100 Club dfuehrer's Avatar
    Join Date
    2004-11
    Posts
    130
    Login to Give a bone
    0

    Default Re: How do I pass a selection on to LISP?

    THANK YOU TIM! That does exactly what I am looking for! You have just made my afternoon!

    Have a beer, on me!

  4. #4
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: How do I pass a selection on to LISP?

    Quote Originally Posted by dfuehrer View Post
    THANK YOU TIM! That does exactly what I am looking for! You have just made my afternoon!
    You're welcome. Glad it works the way you want it.

    Quote Originally Posted by dfuehrer View Post
    Have a beer, on me!
    You can have that beer for me, as I don't drink.

Similar Threads

  1. Pass vba selection set to lisp or command line?
    By KevinBarnett in forum VBA/COM Interop
    Replies: 11
    Last Post: 2019-02-15, 04:23 PM
  2. Replies: 23
    Last Post: 2011-02-08, 01:38 PM
  3. choice selection in lisp
    By prose in forum AutoLISP
    Replies: 7
    Last Post: 2009-01-12, 12:47 PM
  4. Pass a selection set to a program
    By ccowgill in forum AutoLISP
    Replies: 4
    Last Post: 2007-05-18, 01:43 PM
  5. Replies: 5
    Last Post: 2007-04-30, 08:14 PM

Posting Permissions

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