努.力
发表于 2023-12-1 09:44:04
菜卷鱼 发表于 2023-12-1 08:43
我个人认为,用Lisp的话,圆盘改成宫格比较容易实现,判断点在pizza里比矩形里难一些
宫格前易后难,圆盘前难后易,各有千秋。
本题意在不用点击,把鼠标移出圆盘即触发,各向移动距离相等,如果用宫格,是不是只能用点击…
lijiao
发表于 2023-12-1 12:11:23
供你参考
http://bbs.mjtd.com/forum.php?mod=viewthread&tid=184663&highlight=%B2%CB%B5%A5
努.力
发表于 2023-12-2 17:00:36
经过一番折腾,改成以下效果:
1:分别从8个不同区域滑出滑盘之外,可以获得8个不同的返回值
2:左键点击8个不同的区域,可再获得8个不同的返回值
3:右键点击8个不同的区域,可再获得8个不同的返回值
4:当光标处于8个区域中任意一区域内,按下键盘……每个字母(或数字)键又可以获得8个不同返回值……
5:把滑盘直径设置大一些,套娃实现手势……
想着都爽歪歪……
目前存在问题:单击鼠标右键或按键盘,都出错,无返回值
实在是不知道是哪里写错,因此再次求助大神帮忙改正一下,在此谢过
(defun c:x(/ a)
(setq
a (diy 0.2 "爽歪歪" "←" "→" "↑" "↓" "↖" "↗" "↙" "↘")
;a (strcat a "+" (diy 0.2 "爽歪歪" "←" "→" "↑" "↓" "↖" "↗" "↙" "↘"));套娃
)
(princ a)
)
;(diy 0.07 ts 左滑 右滑 上滑 下滑 左上滑 右上滑左下滑 右下滑)
(defun diy(bs ts fx_z fx_y fx_s fx_x fx_zs fx_ys fx_zx fx_yx / *error* n an an0 bl gr jp grdral loop p0 pj xc gc hd aj)
(defun *error*(msg / *error*);出错处理
(setvar'cursorsize gb);恢复光标大小
(setvar'pickbox bk);恢复靶框大小
(redraw);更新
(setq aj nil)
)
;飞雪神光 2023-11-30 http://bbs.mjtd.com/thread-188998-1-1.html
;矢量线
;(grvecs (list 颜色 点 点 颜色 点 点))
;矢量线
;(grdraw 点 长度 角度 颜色)
(defun grdral(pt10 bj an0 co / an an1 pt pt1)
(setq
an (+ an0 (/ pi (/ n 2)))
an1 an0
pt (polar pt10 an1 bj)
)
(grdraw pt10 pt co)
(setq pt (polar pt10 an bj))
(grdraw pt10 pt co)
(repeat (/ n 2)
(setq
pt (polar pt10 an1 bj)
pt1 pt
an1 (+ an1 (* (/ (/ 360.0 32) 180.0) pi))
pt (polar pt10 an1 bj)
)
(grdraw pt1 pt co);滑盘外圈颜色
) )
;————————————————————
(if(= bs "")(setq bs 0.07)) ;屏幕高度的倍数
(setq
n 8 ;滑盘等分数
xc 160 ;非光标处滑盘颜色
gc 6 ;光标处滑盘颜色
p0 (cadr (grread *));滑盘中心点
gb (getvar'cursorsize);记录光标大小
bk (getvar'pickbox);记录靶框大小
loop t)
(setvar'cursorsize 1);设置光标大小
(setvar'pickbox 1);设置靶框大小
;————————————————————鼠标移动前绘制滑盘
(setq an0 (* pi 1.875))
(repeat n
(grdral p0 (*(getvar'viewsize)bs) an0 3)
(setq an0 (+ an0 (/ pi (/ n 2))))
)
(princ (setq ts (strcat "\n" ts
" 左滑:" fx_z
" 右滑:" fx_y
" 上滑:" fx_s
" 下滑:" fx_x
" 左上滑:" fx_zs
" 右上滑:" fx_ys
" 左下滑:" fx_zx
" 右下滑:" fx_yx
) )
);提示
;————————————————————
(while loop
;(if(/= ss "")(sssetfirst()ss));如果已选中对象则亮显它
(setq gr (grread t 8) aj (car gr) jp (cadr gr)
bl (*(getvar'viewsize)bs);滑盘大小(屏幕高度×倍数)
pj (distance p0 jp))
(cond
((= aj 3) (setq loop nil) (setq aj "左键") )
((= aj 25) (setq loop nil) (setq aj "右键") )
;————————————————————移动鼠标开始
((and (= aj 5)(> pj (* bl 0.07)));移动鼠标触发距离
(redraw);更新
;————————————————————鼠标移动后绘制滑盘
(setq an0 (* pi 1.875))
(repeat n
(grdral p0 bl an0 xc);非光标处滑盘颜色
(setq an0 (+ an0 (/ pi (/ n 2))))
)
(grdraw p0 jp 1);光标引线
;————————————————————8向滑动判断
(setq ts1 (strcat "\n " ts));提示
(setq an (angle p0 jp))
;(vl-string-subst "替换后的文字" "要替换的文字" wz);字符串替换,替换wz里指定的字符串
(cond
((< (* pi 0.125) an (* pi 0.375)) (grdral p0 bl (* pi 0.125) gc) (setq hd "右上滑")
(if (/= fx_ys "") (setq ts1 (vl-string-subst "" (strcat " " hd ":" fx_ys ) ts1))) (princ (strcat "\n " ts1 "\n " hd ":" fx_ys)) );↗
((< (* pi 0.375) an (* pi 0.625)) (grdral p0 bl (* pi 0.375) gc) (setq hd "上滑")
(if (/= fx_s "") (setq ts1(vl-string-subst "" (strcat " " hd ":" fx_s) ts1))) (princ (strcat "\n " ts1 "\n " hd ":" fx_s)) );↑
((< (* pi 0.625) an (* pi 0.875)) (grdral p0 bl (* pi 0.625) gc) (setq hd "左上滑")
(if (/= fx_zs "") (setq ts1(vl-string-subst "" (strcat " " hd ":" fx_zs) ts1))) (princ (strcat "\n " ts1 "\n " hd ":" fx_zs)) );↖
((< (* pi 0.875) an (* pi 1.125)) (grdral p0 bl (* pi 0.875) gc) (setq hd "左滑")
(if (/= fx_z "") (setq ts1(vl-string-subst "" (strcat " " hd ":" fx_z) ts1))) (princ (strcat "\n " ts1 "\n " hd ":" fx_z)) );←
((< (* pi 1.125) an (* pi 1.375)) (grdral p0 bl (* pi 1.125) gc) (setq hd "左下滑")
(if (/= fx_zx "") (setq ts1(vl-string-subst "" (strcat " " hd ":" fx_zx) ts1))) (princ (strcat "\n " ts1 "\n " hd ":" fx_zx)) );↙
((< (* pi 1.375) an (* pi 1.625)) (grdral p0 bl (* pi 1.375) gc) (setq hd "下滑")
(if (/= fx_x "") (setq ts1(vl-string-subst "" (strcat " " hd ":" fx_x) ts1))) (princ (strcat "\n " ts1 "\n " hd ":" fx_x)) );↓
((< (* pi 1.625) an (* pi 1.875)) (grdral p0 bl (* pi 1.625) gc) (setq hd "右下滑")
(if (/= fx_yx "") (setq ts1(vl-string-subst "" (strcat " " hd ":" fx_yx) ts1))) (princ (strcat "\n " ts1 "\n " hd ":" fx_yx)) );↘
((or (<= (* pi 1.875) an (* pi 2)) (<= 0 an (* pi 0.125)))(grdral p0 bl (* pi 1.875) gc) (setq hd "右滑")
(if (/= fx_y "") (setq ts1(vl-string-subst "" (strcat " " hd ":" fx_y) ts1))) (princ (strcat "\n " ts1 "\n " hd ":" fx_y)) );→
);————————————————————
(if (> pj (*(*(getvar'viewsize)bs)1)) (progn ;光标离开滑盘
(setq loop nil)
(setvar'cursorsize gb);恢复光标大小
(setvar'pickbox bk);恢复靶框大小
(redraw);更新
) )
);————————————————————移动鼠标结束
;————————————————————按键盘(grread)
((= aj 2)(setq loop nil)
(cond
((= jp 96) (setq aj "`"))
((or(= jp 113)(= jp 81)) (setq aj "q"))
((or(= jp 119)(= jp 87)) (setq aj "w"))
((or(= jp 101)(= jp 69)) (setq aj "e"))
((or(= jp 114)(= jp 82)) (setq aj "r"))
((or(= jp 116)(= jp 84)) (setq aj "t"))
((or(= jp 121)(= jp 89)) (setq aj "y"))
((or(= jp 117)(= jp 85)) (setq aj "u"))
((or(= jp 105)(= jp 73)) (setq aj "i"))
((or(= jp 111)(= jp 79)) (setq aj "o"))
((or(= jp 112)(= jp 80)) (setq aj "p"))
((= jp 91) (setq aj "["))
((= jp 93) (setq aj "]"))
((= jp 8) (setq aj "删除")) ;Backspace
((= jp 61) (setq aj "="))
((or(= jp 97)(= jp 65)) (setq aj "a"))
((or(= jp 115)(= jp 83)) (setq aj "s"))
((or(= jp 100)(= jp 68)) (setq aj "d"))
((or(= jp 102)(= jp 70)) (setq aj "f"))
((or(= jp 103)(= jp 71)) (setq aj "g"))
((or(= jp 104)(= jp 72)) (setq aj "h"))
((or(= jp 106)(= jp 74)) (setq aj "j"))
((or(= jp 107)(= jp 75)) (setq aj "k"))
((or(= jp 108)(= jp 76)) (setq aj "l"))
((= jp 59) (setq aj ";"))
((= jp 39) (setq aj "'"))
((or(= jp 122)(= jp 90)) (setq aj "z"))
((or(= jp 120)(= jp 88)) (setq aj "x"))
((or(= jp 99)(= jp 67)) (setq aj "c"))
((or(= jp 118)(= jp 86)) (setq aj "v"))
((or(= jp 98)(= jp 66)) (setq aj "b"))
((or(= jp 110)(= jp 78)) (setq aj "n"))
((or(= jp 109)(= jp 77)) (setq aj "m"))
((= jp 44) (setq aj ","))
((= jp 92) (setq aj "\\"))
((= jp 13) (setq aj "回车"))
((= jp 32) (setq aj "空格"))
((= jp 46) (setq aj "."))
((= jp 48) (setq aj 0))
((= jp 49) (setq aj 1))
((= jp 50) (setq aj 2))
((= jp 51) (setq aj 3))
((= jp 52) (setq aj 4))
((= jp 53) (setq aj 5))
((= jp 54) (setq aj 6))
((= jp 55) (setq aj 7))
((= jp 56) (setq aj 8))
((= jp 57) (setq aj 9))
((= jp 43) (setq aj "+"))
((= jp 45) (setq aj "-"))
((= jp 42) (setq aj "*"))
((= jp 47) (setq aj "/"))
((= jp 9) (setq aj "Tab")) ;Tab
;————————————————————Shift+
((= jp 123) (setq aj "{"))
((= jp 125) (setq aj "}"))
((= jp 58) (setq aj ":"))
((= jp 34) (setq aj "\""))
((= jp 60) (setq aj "<"))
((= jp 62) (setq aj ">"))
((= jp 63) (setq aj "?"))
((= jp 124) (setq aj "|"))
((= jp 126) (setq aj "~"))
((= jp 33) (setq aj "!"))
((= jp 64) (setq aj "@"))
((= jp 35) (setq aj "#"))
((= jp 36) (setq aj "$"))
((= jp 37) (setq aj "%"))
((= jp 94) (setq aj "^"))
((= jp 38) (setq aj "&"))
((= jp 40) (setq aj "("))
((= jp 41) (setq aj ")"))
((= jp 95) (setq aj "_"))
) )
;————————————————————
) );while
(setvar'cursorsize gb);恢复光标大小
(setvar'pickbox bk);恢复靶框大小
(redraw);更新
(if hd (setq aj (strcat hd aj)))
(princ "\n")
aj
)
xyp1964
发表于 2023-12-2 20:22:34
努.力
发表于 2023-12-2 20:37:02
路过的大神神们,帮忙看看程序是哪里问题,不能接受键盘和右键输入,就差最后一步啦
lijiao
发表于 2023-12-3 15:06:33
随便写了一个,可能与你的思路不一样
(defun grrev (/ ANG ANG0 CODE FANGWEI LOOP PT
PT0 QUYU REV SCALETS TS1 TS2 TS3
TS4 TS5 TS6 TS7 TS8 YUANPAN
)
(defun mat_mxv (m v /)
(mapcar '(lambda (r) (apply '+ (mapcar '* r v)))
m
)
)
(defun mat_trp (m /)
(apply 'mapcar (cons 'list m))
)
(defun mat_cen (m q /)
(mapcar '(lambda (r)
(mat_mxv (mat_trp q) r)
)
m
)
)
(setq yuanpan '(5
(0.0 0.0 0.0)
(0.915327 -0.379141 0.0)
(-0.379141 0.915327 0.0)
(0.379141 -0.915327 0.0)
(0.379141 0.915327 0.0)
(-0.379141 -0.915327 0.0)
(0.915327 0.379141 0.0)
(-0.915327 -0.379141 0.0)
(0.0 0.0 0.0)
(-0.915327 0.379141 0.0)
(-0.156434 0.987688)
(-0.45399 0.891007)
(-0.45399 0.891007)
(-0.707107 0.707107)
(-0.707107 0.707107)
(-0.891007 0.45399)
(-0.891007 0.45399)
(-0.987688 0.156434)
(-0.987688 0.156434)
(-0.987688 -0.156434)
(-0.987688 -0.156434)
(-0.891007 -0.45399)
(-0.891007 -0.45399)
(-0.707107 -0.707107)
(-0.707107 -0.707107)
(-0.45399 -0.891007)
(-0.45399 -0.891007)
(-0.156434 -0.987688)
(-0.156434 -0.987688)
(0.156434 -0.987688)
(0.156434 -0.987688)
(0.45399 -0.891007)
(0.45399 -0.891007)
(0.707107 -0.707107)
(0.707107 -0.707107)
(0.891007 -0.45399)
(0.891007 -0.45399)
(0.987688 -0.156434)
(0.987688 -0.156434)
(0.987688 0.156434)
(0.987688 0.156434)
(0.891007 0.45399)
(0.891007 0.45399)
(0.707107 0.707107)
(0.707107 0.707107)
(0.45399 0.891007)
(0.45399 0.891007)
(0.156434 0.987688)
(0.156434 0.987688)
(-0.156434 0.987688)
)
)
(setq quyu '(2
(0.0 0.0 0.0)
(0.915327 -0.379141 0.0)
(0.915327 0.379141 0.0)
(-1.61054e-15 -6.67109e-16 0.0)
(0.987688 0.156434 0.0)
(0.915327 0.379141 0.0)
(0.987688 -0.156434 0.0)
(0.987688 0.156434 0.0)
(0.915327 -0.379141 0.0)
(0.987688 -0.156434 0.0)
)
)
(setq ts1 '(1 (0.15808 -0.0956111 0.0) (0.15808 0.206223 0.0))
)
(setq ts2 '(1
(0.223258 -0.0956111 0.0)
(0.223258 0.206223 0.0)
(0.15808 -0.0956111 0.0)
(0.15808 0.206223 0.0)
)
)
(setq ts3 '(1
(0.288436 -0.0956111 0.0)
(0.288436 0.206223 0.0)
(0.223258 -0.0956111 0.0)
(0.223258 0.206223 0.0)
(0.15808 -0.0956111 0.0)
(0.15808 0.206223 0.0)
)
)
(setq ts4 '(1
(0.353613 0.206223 0.0)
(0.288436 -0.0956111 0.0)
1
(0.223258 0.206223 0.0)
(0.288436 -0.0956111 0.0)
1
(0.15808 -0.0956111 0.0)
(0.15808 0.206223 0.0)
)
)
(setq ts5 '(1
(0.288436 0.206223 0.0)
(0.223258 -0.0956111 0.0)
(0.15808 0.206223 0.0)
(0.223258 -0.0956111 0.0)
)
)
(setq ts6 '(1
(0.353613 -0.0956111 0.0)
(0.353613 0.206223 0.0)
(0.288436 0.206223 0.0)
(0.223258 -0.0956111 0.0)
(0.15808 0.206223 0.0)
(0.223258 -0.0956111 0.0)
)
)
(setq ts7 '(1
(0.288436 0.206223 0.0)
(0.223258 -0.0956111 0.0)
(0.15808 0.206223 0.0)
(0.223258 -0.0956111 0.0)
(0.418791 -0.0956111 0.0)
(0.418791 0.206223 0.0)
(0.353613 -0.0956111 0.0)
(0.353613 0.206223 0.0)
)
)
(setq ts8 '(1
(0.483969 -0.0956111 0.0)
(0.483969 0.206223 0.0)
(0.288436 0.206223 0.0)
(0.223258 -0.0956111 0.0)
(0.15808 0.206223 0.0)
(0.223258 -0.0956111 0.0)
(0.418791 -0.0956111 0.0)
(0.418791 0.206223 0.0)
(0.353613 -0.0956111 0.0)
(0.353613 0.206223 0.0)
)
)
(setq pt0 (cadr (grread t)))
(setq loop t)
(while loop
(setq pt (grread t))
(setq code (car pt)
pt (cadr pt)
)
(redraw)
(cond
((= code 5)
(setq scale (* (getvar 'viewsize) 0.2))
(GRVECS yuanpan
(list (list scale 0 0 (car pt0))
(list 0 scale 0 (cadr pt0))
(list 0 0 scale 0)
'(0 0 0 1)
)
)
;;;绘制圆盘
(setq ang (angle pt0 pt))
(setq ang0 (/ (* ang 180.0) pi))
(setq fangwei (cond
((<= 22.5 ang0 67.5) (setq ts ts2) 2)
((<= 67.5 ang0 112.5) (setq ts ts3) 3)
((<= 112.5 ang0 157.5) (setq ts ts4) 4)
((<= 157.5 ang0 202.5) (setq ts ts5) 5)
((<= 202.5 ang0 247.5) (setq ts ts6) 6)
((<= 247.5 ang0 292.5) (setq ts ts7) 7)
((<= 292.5 ang0 337.5) (setq ts ts8) 8)
(t (setq ts ts1) 1)
)
)
(setq ang0 (/ (* (1- fangwei) 45 pi) 180.0))
(GRVECS quyu
(mat_cen (list (list scale 0 0 (car pt0))
(list 0 scale 0 (cadr pt0))
(list 0 0 scale 0)
'(0 0 0 1)
)
(list (list (cos ang0) (* -1 (sin ang0)) 0. 0.)
(list (sin ang0) (cos ang0) 0. 0.)
'(0. 0. 1. 0.)
'(0. 0. 0. 1.)
)
)
)
;;;绘制区域
(GRVECS ts
(list (list scale 0 0 (car pt))
(list 0 scale 0 (cadr pt))
(list 0 0 scale 0)
'(0 0 0 1)
)
)
;;;绘制提示
(if (> (distance pt0 pt) scale)
(setq loop nil
rev(list 5 fangwei)
)
)
)
;;;移动鼠标
((= code 3)
(setq ang (angle pt0 pt))
(setq ang0 (/ (* ang 180.0) pi))
(setq fangwei (cond
((<= 22.5 ang0 67.5) (setq ts ts2) 2)
((<= 67.5 ang0 112.5) (setq ts ts3) 3)
((<= 112.5 ang0 157.5) (setq ts ts4) 4)
((<= 157.5 ang0 202.5) (setq ts ts5) 5)
((<= 202.5 ang0 247.5) (setq ts ts6) 6)
((<= 247.5 ang0 292.5) (setq ts ts7) 7)
((<= 292.5 ang0 337.5) (setq ts ts8) 8)
(t (setq ts ts1) 1)
)
)
(setq loop nil
rev(list 3 fangwei)
)
)
;;;点击鼠标左键
(t
(setq loop nil
rev(list code pt)
)
)
)
)
(redraw)
rev
)
飞雪神光
发表于 2023-12-3 15:26:19
(defun c:x(/ a)
(setq
a (diy 0.2 "爽歪歪" "←" "→" "↑" "↓" "↖" "↗" "↙" "↘")
;a (strcat a "+" (diy 0.2 "爽歪歪" "←" "→" "↑" "↓" "↖" "↗" "↙" "↘"));套娃
)
(princ a)
(princ)
)
;(diy 0.07 ts 左滑 右滑 上滑 下滑 左上滑 右上滑左下滑 右下滑)
(defun diy(bs ts fx_z fx_y fx_s fx_x fx_zs fx_ys fx_zx fx_yx / *error* n an an0 bl gr jp grdral loop p0 pj xc gc hd aj)
(defun *error*(msg / *error*);出错处理
(setvar'cursorsize gb);恢复光标大小
(setvar'pickbox bk);恢复靶框大小
(redraw);更新
(setq aj nil)
)
;飞雪神光 2023-11-30 http://bbs.mjtd.com/thread-188998-1-1.html
;矢量线
;(grvecs (list 颜色 点 点 颜色 点 点))
;矢量线
;(grdraw 点 长度 角度 颜色)
(defun grdral(pt10 bj an0 co / an an1 pt pt1)
(setq
an (+ an0 (/ pi (/ n 2)))
an1 an0
pt (polar pt10 an1 bj)
)
(grdraw pt10 pt co)
(setq pt (polar pt10 an bj))
(grdraw pt10 pt co)
(repeat (/ n 2)
(setq
pt (polar pt10 an1 bj)
pt1 pt
an1 (+ an1 (* (/ (/ 360.0 32) 180.0) pi))
pt (polar pt10 an1 bj)
)
(grdraw pt1 pt co);滑盘外圈颜色
)
)
;————————————————————
(if(= bs "")(setq bs 0.07)) ;屏幕高度的倍数
(setq
n 8 ;滑盘等分数
xc 160 ;非光标处滑盘颜色
gc 6 ;光标处滑盘颜色
p0 (cadr (grread *));滑盘中心点
gb (getvar'cursorsize);记录光标大小
bk (getvar'pickbox);记录靶框大小
loop t
princpd t
princpd1 1
princpd2 2
)
(setvar'cursorsize 1);设置光标大小
(setvar'pickbox 1);设置靶框大小
;————————————————————鼠标移动前绘制滑盘
(setq an0 (* pi 1.875))
(repeat n
(grdral p0 (*(getvar'viewsize)bs) an0 3)
(setq an0 (+ an0 (/ pi (/ n 2))))
)
(princ (setq ts (strcat ts " 左滑:" fx_z " 右滑:" fx_y " 上滑:" fx_s " 下滑:" fx_x " 左上滑:" fx_zs " 右上滑:" fx_ys " 左下滑:" fx_zx " 右下滑:" fx_yx)));提示
;————————————————————
(while loop
;(if(/= ss "")(sssetfirst()ss));如果已选中对象则亮显它
(setq
gr (grread t 8)
aj0 (car gr)
jp (cadr gr)
)
(cond
((= aj0 3) (setq loop nil) (setq aj "左键") )
((= aj0 25) (setq loop nil) (setq aj "右键") )
((= aj0 5) ;移动鼠标触发距离
(setq
bl (*(getvar'viewsize)bs);滑盘大小(屏幕高度×倍数)
pj (distance p0 jp)
)
(if (> pj (* bl 0.07))
(progn
(redraw);更新
;————————————————————鼠标移动后绘制滑盘
(setq an0 (* pi 1.875))
(repeat n
(grdral p0 bl an0 xc);非光标处滑盘颜色
(setq an0 (+ an0 (/ pi (/ n 2))))
)
(grdraw p0 jp 1);光标引线
;————————————————————8向滑动判断
(setq ts1 (strcat "\n " ts)) ;提示
(setq an (angle p0 jp))
;(vl-string-subst "替换后的文字" "要替换的文字" wz);字符串替换,替换wz里指定的字符串
;(print (list princpd1 princpd2))
(cond
((< (* pi 0.125) an (* pi 0.375))
(grdral p0 bl (* pi 0.125) gc) (setq hd "右上滑")
(if (/= fx_ys "") (setq ts1 (vl-string-subst "" (strcat " " hd ":" fx_ys) ts1)))
(if (= princpd1 princpd2)
(if princpd
(progn
;(princ (strcat "\n " ts1 "\n " hd ":" fx_ys))
(princ (strcat "\n " hd ":" fx_ys))
(setq princpd nil)
)
)
(setq princpd t princpd1 princpd2)
)
(setq princpd2 1)
);↗
((< (* pi 0.375) an (* pi 0.625))
(grdral p0 bl (* pi 0.375) gc) (setq hd "上滑")
(if (/= fx_s "") (setq ts1 (vl-string-subst "" (strcat " " hd ":" fx_s) ts1)))
(if (= princpd1 princpd2)
(if princpd
(progn
;(princ (strcat "\n " ts1 "\n " hd ":" fx_s))
(princ (strcat "\n " hd ":" fx_s))
(setq princpd nil)
)
)
(setq princpd t princpd1 princpd2)
)
(setq princpd2 2)
);↑
((< (* pi 0.625) an (* pi 0.875))
(grdral p0 bl (* pi 0.625) gc) (setq hd "左上滑")
(if (/= fx_zs "") (setq ts1 (vl-string-subst "" (strcat " " hd ":" fx_zs) ts1)))
(if (= princpd1 princpd2)
(if princpd
(progn
(princ (strcat "\n "hd ":" fx_zs))
(setq princpd nil)
)
)
(setq princpd t princpd1 princpd2)
)
(setq princpd2 3)
);↖
((< (* pi 0.875) an (* pi 1.125))
(grdral p0 bl (* pi 0.875) gc) (setq hd "左滑")
(if (/= fx_z "") (setq ts1 (vl-string-subst "" (strcat " " hd ":" fx_z) ts1)))
(if (= princpd1 princpd2)
(if princpd
(progn
(princ (strcat "\n " hd ":" fx_z))
(setq princpd nil)
)
)
(setq princpd t princpd1 princpd2)
)
(setq princpd2 4)
);←
((< (* pi 1.125) an (* pi 1.375))
(grdral p0 bl (* pi 1.125) gc) (setq hd "左下滑")
(if (/= fx_zx "") (setq ts1 (vl-string-subst "" (strcat " " hd ":" fx_zx) ts1)))
(if (= princpd1 princpd2)
(if princpd
(progn
(princ (strcat "\n " hd ":" fx_zx))
(setq princpd nil)
)
)
(setq princpd t princpd1 princpd2)
)
(setq princpd2 5)
);↙
((< (* pi 1.375) an (* pi 1.625))
(grdral p0 bl (* pi 1.375) gc) (setq hd "下滑")
(if (/= fx_x "") (setq ts1 (vl-string-subst "" (strcat " " hd ":" fx_x) ts1)))
(if (= princpd1 princpd2)
(if princpd
(progn
(princ (strcat "\n " hd ":" fx_x))
(setq princpd nil)
)
)
(setq princpd t princpd1 princpd2)
)
(setq princpd2 6)
);↓
((< (* pi 1.625) an (* pi 1.875))
(grdral p0 bl (* pi 1.625) gc) (setq hd "右下滑")
(if (/= fx_yx "") (setq ts1 (vl-string-subst "" (strcat " " hd ":" fx_yx) ts1)))
(if (= princpd1 princpd2)
(if princpd
(progn
(princ (strcat "\n " hd ":" fx_yx))
(setq princpd nil)
)
)
(setq princpd t princpd1 princpd2)
)
(setq princpd2 7)
);↘
((or (<= (* pi 1.875) an (* pi 2)) (<= 0 an (* pi 0.125)))(grdral p0 bl (* pi 1.875) gc) (setq hd "右滑")
(if (/= fx_y "") (setq ts1 (vl-string-subst "" (strcat " " hd ":" fx_y) ts1)))
(if (= princpd1 princpd2)
(if princpd
(progn
(princ (strcat "\n " hd ":" fx_y))
(setq princpd nil)
)
)
(setq princpd t princpd1 princpd2)
)
(setq princpd2 8)
);→
);————————————————————
(if (> pj (* (* (getvar 'viewsize) bs) 1))
(progn ;光标离开滑盘
(setq loop nil)
(setvar'cursorsize gb);恢复光标大小
(setvar'pickbox bk);恢复靶框大小
(redraw);更新
)
)
)
(setq aj ":盘外")
)
);————————————————————移动鼠标结束
;————————————————————按键盘(grread)
((= aj0 2)
(setq loop nil)
(cond
((= jp 96) (setq aj "`"))
((or(= jp 113)(= jp 81)) (setq aj "q"))
((or(= jp 119)(= jp 87)) (setq aj "w"))
((or(= jp 101)(= jp 69)) (setq aj "e"))
((or(= jp 114)(= jp 82)) (setq aj "r"))
((or(= jp 116)(= jp 84)) (setq aj "t"))
((or(= jp 121)(= jp 89)) (setq aj "y"))
((or(= jp 117)(= jp 85)) (setq aj "u"))
((or(= jp 105)(= jp 73)) (setq aj "i"))
((or(= jp 111)(= jp 79)) (setq aj "o"))
((or(= jp 112)(= jp 80)) (setq aj "p"))
((= jp 91) (setq aj "["))
((= jp 93) (setq aj "]"))
((= jp 8) (setq aj "删除")) ;Backspace
((= jp 61) (setq aj "="))
((or(= jp 97)(= jp 65)) (setq aj "a"))
((or(= jp 115)(= jp 83)) (setq aj "s"))
((or(= jp 100)(= jp 68)) (setq aj "d"))
((or(= jp 102)(= jp 70)) (setq aj "f"))
((or(= jp 103)(= jp 71)) (setq aj "g"))
((or(= jp 104)(= jp 72)) (setq aj "h"))
((or(= jp 106)(= jp 74)) (setq aj "j"))
((or(= jp 107)(= jp 75)) (setq aj "k"))
((or(= jp 108)(= jp 76)) (setq aj "l"))
((= jp 59) (setq aj ";"))
((= jp 39) (setq aj "'"))
((or(= jp 122)(= jp 90)) (setq aj "z"))
((or(= jp 120)(= jp 88)) (setq aj "x"))
((or(= jp 99)(= jp 67)) (setq aj "c"))
((or(= jp 118)(= jp 86)) (setq aj "v"))
((or(= jp 98)(= jp 66)) (setq aj "b"))
((or(= jp 110)(= jp 78)) (setq aj "n"))
((or(= jp 109)(= jp 77)) (setq aj "m"))
((= jp 44) (setq aj ","))
((= jp 92) (setq aj "\\"))
((= jp 13) (setq aj "回车"))
((= jp 32) (setq aj "空格"))
((= jp 46) (setq aj "."))
((= jp 48) (setq aj 0))
((= jp 49) (setq aj 1))
((= jp 50) (setq aj 2))
((= jp 51) (setq aj 3))
((= jp 52) (setq aj 4))
((= jp 53) (setq aj 5))
((= jp 54) (setq aj 6))
((= jp 55) (setq aj 7))
((= jp 56) (setq aj 8))
((= jp 57) (setq aj 9))
((= jp 43) (setq aj "+"))
((= jp 45) (setq aj "-"))
((= jp 42) (setq aj "*"))
((= jp 47) (setq aj "/"))
((= jp 9) (setq aj "Tab")) ;Tab
;————————————————————Shift+
((= jp 123) (setq aj "{"))
((= jp 125) (setq aj "}"))
((= jp 58) (setq aj ":"))
((= jp 34) (setq aj "\""))
((= jp 60) (setq aj "<"))
((= jp 62) (setq aj ">"))
((= jp 63) (setq aj "?"))
((= jp 124) (setq aj "|"))
((= jp 126) (setq aj "~"))
((= jp 33) (setq aj "!"))
((= jp 64) (setq aj "@"))
((= jp 35) (setq aj "#"))
((= jp 36) (setq aj "$"))
((= jp 37) (setq aj "%"))
((= jp 94) (setq aj "^"))
((= jp 38) (setq aj "&"))
((= jp 40) (setq aj "("))
((= jp 41) (setq aj ")"))
((= jp 95) (setq aj "_"))
)
)
)
);while
(setvar'cursorsize gb);恢复光标大小
(setvar'pickbox bk);恢复靶框大小
(redraw);更新
(if hd (setq aj (strcat hd aj)))
(princ "\n")
aj
)
努.力
发表于 2023-12-3 16:08:21
飞雪神光 发表于 2023-12-3 15:26
非常感谢大神的再次帮助,可否提示一下,究竟是那里导致右键和键盘出错的?
努.力
发表于 2023-12-3 16:09:34
lijiao 发表于 2023-12-3 15:06
随便写了一个,可能与你的思路不一样
非常感谢大神分享不同的思路
飞雪神光
发表于 2023-12-3 17:53:14
努.力 发表于 2023-12-3 16:08
非常感谢大神的再次帮助,可否提示一下,究竟是那里导致右键和键盘出错的?
aj变量冲突