; Alert when a rectangle is drawn over the specified overall-limited length
; Author: Grrr / Grrr1337
; https://www.theswamp.org/index.php?topic=58227.0
; ----------------------
; ---- Main section ----
(defun C:StartReactor
nil (_ExIncludeRtr t
) (princ) ) (defun C:StopReactor
nil (_ExIncludeRtr
nil) (princ) )
(defun _ExIncludeRtr
( b
/ rtrName limitLength d
) (setq rtrName
"RectangleLimitLength") (alert (strcat "`Rectangle Limit Length` Reactor is active\nLimit is: " (itoa limitLength
) " units.")) )
)
); defun
; ---------------------------
; ---- Callbacks section ----
(defun test:CB
( rtr arg
/ lockModes limitLength e o h len
)
)
); or
(Rectangle-p e)
(>= len limitLength)
(LM:popup "Warning"
"• Warning •"
"\nYou have drawn a rectangle"
"\nWith approx length of " (rtos len
2 2) " units" )
("")
); cond
); strcat
(+ 0 48 4096)
); LM:popup
); progn
); and
); defun test:CB
; ------------------------------
; ---- Subfunctions section ----
;; Popup - Lee Mac
;; A wrapper for the WSH popup method to display a message box prompting the user.
;; ttl - [str] Text to be displayed in the pop-up title bar
;; msg - [str] Text content of the message box
;; bit - [int] Bit-coded integer indicating icon & button appearance
;; Returns: [int] Integer indicating the button pressed to exit
(defun LM:popup
( ttl msg bit
/ wsh rtn
) )
)
)
; Rectangle-p - Lee Mac
; http://www.theswamp.org/index.php?topic=40249.msg455137#msg455137
(defun Rectangle
-p
( ent
/ elist p1 p2 p3 p4
) (= 4 (cdr (assoc 90 elist
))) ;; Does it have 4 vertices? (not (HasBulge elist
)) ;; Arc segments? (mapcar '
set '
(p1 p2 p3 p4
) ;; Collect the Vertices for further investigation )
)
)
)
(defun HasBulge
( elist
/ pair
) )
)
)