TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: serge_c on March 13, 2015, 03:11:36 AM
-
It will be very usefull for a lot of engineersand not only to make a lisp wich will remember the last type number for a comand ...
For example should work like for comand offset , you enter first time the number , and than the program remember it and next time when you do again comand offset just with clicking duble space it remember automaticaly..
So what is the idea : same thing for comand copy , move and strench ...
But I think it gonna be better if each comand it will have their own remember number ..
I think this it will gain o lot of time ...
Phanks in advance !!!
-
Great idea! ( i have not got an answer..)
-
some of my friends told me that in some of olds versions I dont know it wich precise, it remember automaticaly ,when you type the comand, typing Up arrow , and it appear last type number
It should work like this :
If I MOVE COPY and STRENCH something by 100 units, then use the MOVE COPY or STRENCH command again, the default value will show as <100> so you don't need to type it again.
-
Offset has this built in with the variable "filletrad" but in relation to move, copy, stretch I don't see the point and actually see it as a hindrance. If you are constantly moving something 100 units, why not just insert or draw it correctly?
If you are copying 100 units, utilize arrayrect
-
I said 100 for example , I need this more for Strench comand, but move and copy comand just eventualy , sometime I need it too .
-
Offset has this built in with the variable "filletrad" ...
For offset, I would say the variable is called "offsetdist" and my suggestion doesn't support offset... Maybe you can try searching www.lee-mac.com ; I think he wrote something like Dynamic Offset, or Double offset... Anyway you can write your own version if you really want it... For MOVE, COPY in 3D & ROTATE in 2D, I strongly suggest that you use my version of MOCORO (move+copy+rotate) posted here :
http://www.theswamp.org/index.php?topic=40547.msg481693#msg481693
It's very useful and it's written just for this task - copying, moving multiple times the same entity/entities... Now when I write this, maybe it's not exactly what you're searching "probably you want to do the same operation performed in more tasks / different entity/ies but with the same vector of translation"... So you need to write simply lisp, something like this :
(defun c:mcs-vec ( / cmde vc p0 p1 cc ss bp ep ec )
(setq cmde (getvar 'cmdecho))
(setvar 'cmdecho 0)
(terpri)
(prompt "\nMOVE, COPY, STRETCH with the same vector of translation")
(terpri)
(if v
(progn
(initget "Yes No")
(setq vc (getkword (strcat "\nUse already stored vector in memory ( " (rtos (car v) 2 8) " , " (rtos (cadr v) 2 8) " , " (rtos (caddr v) 2 8) " ) [Yes/No] <Yes - ENTER> : ")))
(if (eq vc "No")
(progn
(setq p0 (getpoint "\nPick or specify start point of vector : "))
(setq p1 (getpoint p0 "\nPick or specify end point of vector : "))
(setq v (mapcar '- p1 p0))
)
)
)
(progn
(setq p0 (getpoint "\nPick or specify start point of vector : "))
(setq p1 (getpoint p0 "\nPick or specify end point of vector : "))
(setq v (mapcar '- p1 p0))
)
)
(initget 1 "Copy Move Stretch")
(setq cc (getkword "\nSpecify command type [Copy/Move/Stretch] : "))
(prompt "\nSelect objects for specified command : ") (princ cc)
(setq ss (ssget "_:L"))
(while (not ss)
(prompt "\nEmpty sel.set... Select objects for specified command : ") (princ cc) (prompt " again...")
(setq ss (ssget "_:L"))
)
(setq bp '(0.0 0.0 0.0))
(setq ep v)
(cond
( (eq cc "Copy")
(command "_.COPY" ss "" "_non" bp "_non" ep)
(while (> (getvar 'cmdactive) 0) (command ""))
)
( (eq cc "Move")
(command "_.MOVE" ss "" "_non" bp "_non" ep)
(while (> (getvar 'cmdactive) 0) (command ""))
)
( (eq cc "Stretch")
(command "_.STRETCH" ss "" "_non" bp "_non" ep)
(while (> (getvar 'cmdactive) 0) (command ""))
)
)
(initget "Yes No")
(setq ec (getkword "\nErase stored vector from memory [Yes/No] <No> : "))
(if (eq ec "Yes")
(setq v nil)
)
(setvar 'cmdecho cmde)
(princ)
)
Posted code is untested, an quickly written so if it's wrong look for debugging tutorial at www.lee-mac.com
HTH, M.R.
-
@ ribarm: Why prompt for a base point? I think you can use '(0.0 0.0 0.0) instead.
-
@ ribarm: Why prompt for a base point? I think you can use '(0.0 0.0 0.0) instead.
You're right Roy, code updated above...
-
Indeed, ealier version of autocad had This. You could toggle to previous commands using the arrow. It was a Great functions. Why and when This was lost i do not know. AutoDesk just destroyed it during one of the updates..