Jump to content

Right click option to LISP program


Dayananda

Recommended Posts

you would need the GRREAD function. Just a simple example :


(defun c:rotdwg ( / inp)
  (princ "\nRotate drawing +90 gr. (+ or LMouse) or back -90 gr. (- or RMouse) : ")
  (setq inp (grread))
  (if (or (equal (car inp) 25) (equal inp (list 2 45))) ; right mousebutton or '-'
    (vl-catch-all-apply 'vl-cmdf (list ".move" "all" "" "0,0" "@-285,-1.25" ".rotate" "all" "" "5,5" "-90"))
    (vl-catch-all-apply 'vl-cmdf (list ".rotate" "all" "" "5,5" "90" ".move" "p" "" "0,0" "@285,1.25")))
  (vl-catch-all-apply 'vl-cmdf (list ".zoom" "all"))
  (princ)
)

  • Like 1
Link to comment
Share on other sites

Another method: Observe the following for a right mouse button context menu in a simple (getxx) call. Paste this in at the command prompt, then right click in the graphics screen.

 

(initget "One Two Three")
(setq opt (Getkword "\nSelect Option [One/Two/Three]: ")) ; Putting the Keywords in [] tells AutoLISP to make a context Menu.

 

Edited by pkenewell
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...