@danglar wrote:
.... Works perfect, like I need ....
But, if you'll pardon my butting in, seems a lot more complicated than necessary. In addition, I would argue that you don't need the diagonal Line at all. [It could be worth including if you make the Solid a different color, or put it on a different Layer, and want the diagonal edge of it bounded in the same way the rectangle's sides define its other edges.] And, I would not go for the wacky Block name, such as A$Cc4a95499, that you'll get as a result, but would require the User to give the thing a name with some meaning.
Given that it starts with the assumption that the last thing drawn was a rectangle, see whether this will do the same for you [with the addition of soliciting a meaningful Block name]:
(vl-load-com); if needed
(defun c:cross3 (/ rect p1 bn)
(setq rect (entlast))
(command
"solid"
"_none" (setq p1 (vlax-curve-getStartPoint rect))
"_none" (vlax-curve-getPointAtParam rect 1)
"_none" (vlax-curve-getPointAtParam rect 2)
"" ""
"_.block" (setq bn (lisped "BlockName")) "_none" p1 rect (entlast) ""
"_.insert" bn "_none" p1 "" "" ""
); command
(princ)
);defun
The drawing of the rectangle itself could also be built into the front of that, for a single consolidated command, and consider that the RECTANG command now has a Rotation option that could help out with that.
Kent Cooper, AIA