masterfal Posted September 14, 2018 Posted September 14, 2018 Hi, i'm trying to set up a lisp routine that lets me move selected objects a specific distance in specific direction eg - typing up50 moves selected objects vertically 50000 (i'd like to be able to skip the base point selection as its somewhat irrelevant. and if it could use the selected objects as opposed to asking for which objects to move that would also save some time) failed attempt below.. (defun c:UP50 () (command "MOVE" pause "" pause @50000<90)) any help appreciated! Quote
satishrajdev Posted September 14, 2018 Posted September 14, 2018 Try this (defun c:UP50 () (command "MOVE" pause "" pause "@50000<90")) Quote
masterfal Posted December 7, 2018 Author Posted December 7, 2018 the code above works but only for selecting 1 object at a time.. can it be amended to allow for multiple objects (or even better currently selected objects)? Quote
Tharwat Posted December 7, 2018 Posted December 7, 2018 (edited) Hi, (defun c:up50 (/ ss) (if (setq ss (ssget "_:L-I")) (command "_.MOVE" ss "" "_non" '(0. 0.) "_non" '(0. 5000.)) ) (princ) ) Edited December 7, 2018 by Tharwat Quote
Grrr Posted December 7, 2018 Posted December 7, 2018 Hi @Tharwat, You don't need the second ssget prompt, since the "_:L-I" mode will try to obtain the implied selection (if theres one) else it will prompt for a new selection, hence simulating (ssget "_:L"). Quote
Tharwat Posted December 7, 2018 Posted December 7, 2018 3 minutes ago, Grrr said: Hi @Tharwat, You don't need the second ssget prompt, since the "_:L-I" mode will try to obtain the implied selection (if theres one) else it will prompt for a new selection, hence simulating (ssget "_:L"). Apparently you did not read what the OP wrote in their second reply. 6 hours ago, masterfal said: the code above works but only for selecting 1 object at a time.. can it be amended to allow for multiple objects (or even better currently selected objects)? Quote
Grrr Posted December 7, 2018 Posted December 7, 2018 (edited) 27 minutes ago, Tharwat said: Apparently you did not read what the OP wrote in their second reply. I see, but what I'm saying (in my previous post) is that theres no difference in the behaviour between: (setq ss (ssget "_:L-I")) and: (or (setq ss (ssget "_:L-I")) (setq ss (ssget "_:L")) ) hence including the (setq ss (ssget "_:L")) and wrapping it within the or function is redundant. Edited December 7, 2018 by Grrr 1 Quote
Tharwat Posted December 7, 2018 Posted December 7, 2018 Aha, you are right. Thank you for pointing this out to me. 1 Quote
BIGAL Posted December 8, 2018 Posted December 8, 2018 Something to think about is that you can have a reactor that looks at say the 1st character and then looks at the distance required eg u5000 is move 5000 up, R250 move 250 to right what I am saying is that rxxxx can be any distance you like, the reactor detects that an error has occured, L345 is not a valid command so checks the error looks for "L" then pulls the distance out 345. I use this for fillet circle offset, If I type C23 it will draw a circle with radius 23. Its a bit of code I have used for around 3 years now and should work nicely for what you want. It will have to be modified for move so have a go if you get stuck post again. Command reactor C O F etc.lsp Quote
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.