• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

simulate pressure of the left mouse button in a lisp

christian_96

Guest
Good morning to all and good Sunday:smile:
Some good soul would be able to explain how you could simulate the pressure of the left mouse button in a list of autolisp?
I've been looking for internal days but I can't find a solution. . .

Thank you very much in advance

p.s.: I know there is the grread command but I can't make it work
 
quickly summarized:

a) I am in a while cycle that repeats n° indefinite turns, so that the condition does not occur.

b) for the moment, during the cycle the operator (through the getkword function) can only give three inputs:

1. continue the cycle by pressing the "c" key;
2. cancel the last operation by pressing the "a" button;
3. end the cycle by pressing the "t" button.

c) to make the lisp more effective and practical to use I would need the function "1" (quoted previously) to be replaced by the pressure of the left key.
 
depends on which interface you want it to have the command:
with getkword the input only happens by keyboard while the screen displays cross pointer,
with shows the Selection pane and you can either select or type.

see the difference between these functions
getkword
Code:
(defun c:tt ()
    (setq a t)
    (while a
        (initget "c a t")
        (setq a (getkword "\ndigitare opzione : "))
        (cond
            (  (= a nil) (setq a "c")(prompt a) )
            (  (= a "t") (setq a nil) )
        )
    )
    (princ)
)
Code:
(defun c:yy ()
(setq to t)
(while a
(princ "\ndigitare opzione : ")
(setq a (cadr (grread nil 14 2))
(cond)
(gold (= to 65) (= to 67) (setq to "a") (princ a)
(gold (= to 67) (= to 99) (setq to "c") (princ a)
(gold (= to 84) (= to 116) (setq to nil)
(= 'list (type a) (setq a "c") (prompt a) )
( t (setq a t) (princ "\opzione non valida") )
)
)
(princ)
)
 
I forgot to specify that the first function (getkword) requires sending to return "c"
Sorry. .
 
I tried the list you indicated to me but it doesn't do exactly to my case:frown:
I wonder if you can set the pressure of the left mouse button in the getkword condizoni, or instead of pressing the "c" button I press the left mouse button
 
; ritorna t se tasto mouse 1 premuto
(defun pressmouse(/ loop cod)
(prompt "\nmouse 1 per continuare: ")
(setq loop t)
(while loop
(setq cod (car (grread t 8)))
(if (= cod 3) ; mouse 1
(setq loop nil)
)
)
t
)

esempio:
(pressmouse) attende il click del tasto mouse 1 per continuare

bye
 
would be perfect as code, only I can't use it with getkword because it doesn't give me the chance to choose the other options
 
(defun pressmouseandkey(/ a b loop cod)
(prompt " continua(mouse 1 o c) annulla termina ")
(setq loop t)
(while loop
(setq a (grread t 2))
(setq b (cadr a))
(if (= b -1)
(setq cod 0)
(setq cod (car a))
)
(if (= cod 2)
(progn
(cond
((or (= b 65) (= b 97)) (setq loop nil cod "a"))
((or (= b 67) (= b 99)) (setq loop nil cod "c"))
((or (= b 84) (= b 116)) (setq loop nil cod "t"))
)
)
)
; mouse button 1
(if (= cod 3) (setq loop nil cod "c"))
)
cod
)

bye
 
a deepening of the discussion requested by christian_96

the file lisp is the new customizable function.
the zip file contains the function explained in detail.

bye
 

Attachments

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top