Marco HK Posted June 9, 2019 Share Posted June 9, 2019 (edited) For least keyboard entry work I would like to create 3 shortcuts one each for X, Y, Z axis so that when I click on any of them I will be prompted to select an object and then a distance value, the object will then be moved or copied by the distance supplied along the axis represented by the shortcut. Edited June 9, 2019 by Marco HK Info added Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 9, 2019 Share Posted June 9, 2019 (edited) There may be a way of using Reactors so you could type x56 meaning move an object 56 units same with any entry x345 x34 etc Y and Z same y99 z56 moves in z direction. Only hiccup with what I have done is you can not do negative as the - is used to designate the decimal point so x3-5 is move 3.5 units but you could add a extra into the command. xn45 meaning negative. It uses the fact that an error has occurred and command does not exist but traps it and pulls the value out of it. Here is the code for x y just add Z note an error message may appear that is due to using error trapping. ; Enter the filet radius as part of a command line entry f100 offset O234 circle c123-45 ; changed to x move y & z to be added ; note - is used for decimal point ; original code and methology by Alan H ; assistance and code that worked by Lee-Mac ; OCT 2015 ( (lambda nil (vl-load-com) (foreach obj (cdar (vlr-reactors :vlr-command-reactor)) (if (= "ahmove-reactor" (vlr-data obj)) (vlr-remove obj) ) ) (vlr-command-reactor "ahmove-reactor" '((:vlr-unknowncommand . ahmove-reactor-callback))) ) ) (defun movex ( ) (setq xval (distof (substr com 2) 2)) (if (< 0.0 xval) (progn (setq pt1 (list 0.0 0.0 0.0)) (setq pt2 (list xval 0.0 0.0)) (setq ent (entsel "select object")) (vla-sendcommand ahmove-reactor-acdoc "_.Move !ent !pt1 !pt2 ") ;(command "move" ent "" pt1 pt2) for Briscad (setq pt1 nil pt2 nil ent nil) ) ) ) (defun movey ( ) (setq yval (distof (substr com 2) 2)) (if (< 0.0 yval) (progn (setq pt1 (list 0.0 0.0 0.0)) (setq pt2 (list 0.0 yval 0.0)) (setq ent (entsel "select object")) (vla-sendcommand ahmove-reactor-acdoc "_.Move !ent !pt1 !pt2 ") ;(command "move" ent "" pt1 pt2) for Briscad (setq pt1 nil pt2 nil ent nil) ) ) ) (defun ahmove-reactor-callback ( obj com ) (setq com (vl-string-translate "-" "." (strcase (car com)))) (cond ( (and (wcmatch com "~*[~X.0-9]*") (wcmatch com "X*") (wcmatch com "~X*X*") (wcmatch com "~*.*.*") ) ; and (movex) ) ( (and (wcmatch com "~*[~Y.0-9]*") (wcmatch com "Y*") (wcmatch com "~Y*Y*") (wcmatch com "~*.*.*") ) ; and (movey) ) ) ; master cond ) ; defun (if (not ahmove-reactor-acdoc) (setq ahmove-reactor-acdoc (vla-get-activedocument (vlax-get-acad-object))) ) Edited June 10, 2019 by BIGAL Quote Link to comment Share on other sites More sharing options...
SLW210 Posted June 10, 2019 Share Posted June 10, 2019 I have moved your thread to the AutoLISP, Visual LISP & DCL Forum since it seems programming will be needed. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.