Morning all!
I've needed to use a standard Acad command within a LISP routine a couple of times. I'm familiar with the idea of using (command "stuff"), (vl-cmdf "stuff") & (command-s "stuff"). I'm also aware that one can use (initcommandversion) to make things behave. However, commands don't seem to behave properly when actually used open-endedly within a LISP itself. For example, take the following code:
(defun C:cts ( / )
(princ "\nStart of test")
(command "COPY")
(princ "\nEnd of test")
(princ)
);defun
The idea being I want to copy whatever I want, as many times as I want, however I want. What actually happens is:
Command: cts
Start of testCOPY
Select objects:
End of test
Select objects: Specify opposite corner: 2 found
Select objects:
Specify base point or [Displacement/Multiple] <Displacement>:
Specify second point or [Array] <use first point as displacement>:
Command: Specify opposite corner or [Fence/WPolygon/CPolygon]:
So the code continues to run, seems to finish & THEN runs the COPY command. In this example, not the end of the world, in the middle of a serious LISP, a real nuisance.
Does anyone know of a way to make this work properly?
I appreciate there are work-arounds, most of which would lose some functionality of the command, or essentially involve re-writing the command itself... Not what I'm after!
Thanks in advance!