乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 48|回复: 8

[编程交流] Include a "shift-down" alterna

[复制链接]

3

主题

8

帖子

5

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-5 18:18:55 | 显示全部楼层 |阅读模式
I've tried googling this but come up empty handed.
 
Is it possible to make a routine that does one thing normally, but something else when you keep the shift key pressed?
 
Just like the "trim" command executes an "extend" command when shift is presed.
 
My particular example is a routine that copies objects in along only the z-axis. But it would be sweet if i could keep chift pressed when selecting my reference point and copy it  to same z-value but getting the x and y coordinates from my reference.
 
Yes i know this can be achived by regular commands using .x and .y or two separate commands, and so on but the reason we love our lisps is because we are lazy,
回复

使用道具 举报

rlx

21

主题

1505

帖子

1551

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
81
发表于 2022-7-5 18:30:40 | 显示全部楼层
I believe it is not possible to capture shift. But you could use (grread) to toggle your selection mode, for example to use the tab key to toggle between to modes. A grread example from not so long ago can be found here : http://www.cadtutor.net/forum/showthread.php?93966-Rotation-with-options-on-imput&highlight=rotate
 
 
You could use grread to capture whether you pressed a key or selected a point. If you pressed tab , change selection mode , if you selected a point , use that point for a getcorner selection.
 
 
Another way would be to let your routine detect the direction you make your selection , just like a window or crossing selection.
 
 
It's just for information / learning only , i'm sure there will be better examples to be found here or elsewhere.
 
 
gr. Rlx
回复

使用道具 举报

21

主题

155

帖子

135

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
105
发表于 2022-7-5 18:37:08 | 显示全部楼层
 
Perish the thought !
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 18:41:55 | 显示全部楼层
You can capture shift & ctrl using the Express Tools (acet-sys-shift-down) & (acet-sys-control-down) functions.
回复

使用道具 举报

rlx

21

主题

1505

帖子

1551

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
81
发表于 2022-7-5 18:53:33 | 显示全部楼层
 
 
Good tip! (for those who have ET on their pc).
 
 
gr. Rlx
回复

使用道具 举报

3

主题

8

帖子

5

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-5 18:58:47 | 显示全部楼层
Thanks so much all of you. Got busy with other stuff but looked into the grread wich looks like it can do something acceptable.
Or maybe i should just go with what lee mac says cause his advice always seems like best practice.
回复

使用道具 举报

3

主题

8

帖子

5

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-5 19:07:10 | 显示全部楼层
Ok was easy and works lika a charm. Will post here, could possibly come in handy for someone:
 
  1. (defun c:mx ()(setq obj (ssget ))(setq P1 ( getpoint "\nPick basepoint : "))(setq P2 ( getpoint "\nPick X-value point : "))(if (acet-sys-shift-down);If shift-down(command "_.Move" obj "" P1 ".x" P1 P2)        ;If not shift-down(command "_.Move" obj "" P1 ".x" P2 P1)        );;(princ))
回复

使用道具 举报

rlx

21

主题

1505

帖子

1551

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
81
发表于 2022-7-5 19:12:26 | 显示全部楼层
 
 
I know of external commands that can capture certain keys (and much more) but I can't rely with my programs on 3rd party apps to be installed. Once I decided to go basic (visual basic) and some releases later it was no longer installed standard. So that's why I try to be as generic as possible. Even here at work , some people do E&I , some do piping , some of those use CadWorx... and they all have there special needs.
 
 
If you do have ET on your pc and everybody else does too , do what Lee says and live happily everafter :-)
 
 
Gr. Rlx
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 19:19:56 | 显示全部楼层
Happy to help
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-12 20:07 , Processed in 0.479509 second(s), 70 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表