@yanndellamaggiora wrote:
It would also be interesting to have the options of the standard rectangle command (dimension, rotation, etc.)
You can have all the options in that command by using (command-s) to run it, and it will keep taking input until the command is completed. Taking parts from various other messages and incorporating that:
(defun c:RH (/ olay); = Rectangle with Hatch
(setq olay (getvar 'clayer))
(command "_.layer" "m" "Rectangle" "c" "6" "" "")
(command-s "_.rectang")
(command
"_.layer" "_make" "Hatch" "_color" 254 "" ""
"_.-hatch" "_select" (entlast) "" "_properties" "ANSI31" "1" "0" ""
)
(setvar 'clayer olay)
(prin1)
)
There's no need for variables for the corners, and you can see it forming as you move the cursor after giving it a first corner -- no (getpoint) or (getcorner) functions are needed, because the command's own prompts cover it all.
Also, there's no need to assign Continuous as a linetype to a new Layer -- that is the default. Only if the Layer might already exist but with the "wrong" linetype would you need to assign that.
[A nit-picky item: The real command name is RECTANG. RECTANGLE works, but is only an alias.]
Kent Cooper, AIA