@mkroll9in5in hi,
here is a very nice one called XBAR 🤣
xbar starts with asking you...
(line 50) "Bar offset distance" which is the distance away from face/edge
(line 51) "Bar width" the width of the bar.
these value are saved as default for the duration of the current session.
(line 52) Select object(s): select lines (yes you can select multiple rectangles) to attach the bars.
Note:
the size the bar will be drawn is the outside of the rectangle. if the xbar cannot identifies the rectangle it will skip that face/edge.
i keep it Classic AutoLISP for it will be compatible with R2024 LT but i do not have LT so hope it will work.
enjoy,
Moshe
; Attach Bar to Lines
(defun c:xbar (/ askdist opposite_bar_side ; local function
oset wth ss l ename elist p10 p11 p12 ang lay p0 p1 p2 p3)
(defun askdist (msg def / ask)
(initget (+ 2 4))
(if (not (setq ask (getdist (strcat "\n" msg " <" (rtos def 2) ">: "))))
(setq ask def)
(setq def ask)
); if
); askdist
; return a point, the opposite size of bar
(defun opposite_bar_side (ent cen start_ang rad / _genRays _genPoints ; local function
points^ ss1 e t10 t11)
; anonymous functions
(setq _genRays (lambda (dir n / lst) (reverse (repeat 6 (setq lst (cons (+ (* (/ pi 3) (setq n (1+ n))) dir) lst))))))
(setq _genPoints (lambda () (mapcar (function (lambda (ang) (polar cen ang rad))) (_genRays start_ang -1))))
(if (and
(setq ss1 (ssget "_cp" (_genPoints) '((0 . "line"))))
(= (sslength ss1) 2)
)
(progn
(ssdel ent ss1) ; remove current handled object
(setq e (entget (ssname ss1 0)))
(setq t10 (cdr (assoc '10 e)) t11 (cdr (assoc '11 e)))
(if (> (distance cen t10) (distance cen t11)) t10 t11)
); progn
); if
); opposite_bar_side
; here start c:xbar
(setvar "cmdecho" 0)
(command "._undo" "_begin")
(if (= (getvar "userr1") 0.0)
(setvar "userr1" 1.0)
)
(if (= (getvar "userr2") 0.0)
(setvar "userr1" 2.5)
)
(if (and
(setvar "userr1" (setq oset (askdist "Bar offset distance" (getvar "userr1"))))
(setvar "userr2" (setq wth (askdist "Bar width" (getvar "userr2"))))
(setq ss0 (ssget '((0 . "line"))))
)
(repeat (setq l (sslength ss0))
(setq elist (entget (setq ename (ssname ss0 (setq l (1- l))))))
(setq p10 (cdr (assoc '10 elist)))
(setq p11 (cdr (assoc '11 elist)))
(setq ang (angle p10 p11))
(if (setq p12 (opposite_bar_side ename p10 (angle p10 p11) (+ oset wth)))
(progn
(setq ang (+ (angle p10 p12) pi))
(setq lay (cdr (assoc '8 elist)))
(setq p0 (polar p10 ang oset))
(setq p1 (polar p11 ang oset))
(setq p2 (polar p1 ang wth ))
(setq p3 (polar p0 ang wth ))
(command "._pline" "_none" p0 "_none" p1 "none" p2 "none" p3 "_close")
(command "._chprop" "_si" (entlast) "_layer" lay "")
); progn
); if
); repeat
); if
(command "._undo" "_end")
(setvar "cmdecho" 1)
(princ)
); c:xbar