Im working in my second lisp. Its a very simple series of commands: with some objects rotate in a random space, the idea is to put the ucs with a face of the objects, copy them, return in the world ucs and paste the original objets oriented in the world ucs.
(DEFUN c:CW1 ( / P1 P2 P3 P4 P5 ) (SETQ P1 (GETPOINT "\nSelect first UCS point")) (SETQ P2 (GETPOINT "\nSelect second UCS point")) (SETQ P3 (GETPOINT "\nSelect third UCS point")) ;click the 3 ucs points (SETQ P4 (GETPOINT "\nSelect base point of the copy objects")) ;click the base point (command "_ucs" "_3p" "_non" P1 "_non" P2 "_non" P3) ; rotate the ucs in the objects plane (command "_select" pause ) ; select objects to copy (command "_copybase" "_non" P4 "_p" "" ) (command "_ucs" "_w") ; return in world ucs (SETQ P5 (GETPOINT "\nSelect base point to paste the objects")) ;click the base point (command "_pasteclip" "_non" P5 ) ; paste objects in the world ucs (PRINC) )
but when i paste the objects are invisible and i paste them in a custom position in the layer (also if its asking me the base point in the copybase command.
Im a rookie, i must forgive something, so i will be glad for any help.
thanks a lot, i will study the transormation.
If you could also answer me about some doubts about your lisp i willa appreciate a lot:
1 - at the beginning you put an (and) with all inside. Why? The meaning?
2 - I was repeating a (command) with all my autocad commads, and you only put one for all. With only one (command), works better or is it only a way to do it more compact?
3 - The pasteclip command is with a "\\" that i dont understand. Also because i dont see a getpoint to insert the paste. What will it happen if i will put another command below the pasteclip?
There may be a negligible improvement to performance by reducing the number of command expressions, but ultimately, only one command expression is required and so there is no need for more.
The backslash (note that a single backslash is represented by "\\" in AutoLISP, as "\" is an Escape Character) is the macro operator for "pause for user input"; you can alternatively use the 'pause' symbol, but this is not a protected symbol and thus has the potential to be redefined.