(defun dgrid
( tx ducts empty
/ width left up fleft fup tx vx lx
) )
)
)
lastDuctRef
(last ducts
) ;(lastDuct ducts empty) ducts
(vl
-remove
-if '
(lambda (a
) (member a empty
)) ducts
) ; remove emptys ;ducts (if (= "SINGLE-CONDUIT" (dxf "ROUTE_CONST" routeDetails))
; (list "AA")
; ducts)
base (shiftdown
((and (= dir
"e") (= tdir
"e")) ;; if the direction of the duct grid and which way we want the text justified dont match, we need to move the base point either way inspt
)
((and (= dir
"w") (= tdir
"w")) inspt
)
((and (= dir
"e") (= tdir
"w")) (shiftleft inspt (+ width (* width maxw)))
)
((and (= dir
"w") (= tdir
"e")) ;; test.. 'east east' (shiftright inspt (+ width (* width maxw)))
)
)
(+ (* maxh width) (/ width 2))
)
)
(foreach i ducts
(makeDuct i i base dir
)) (makeLeader lastDuctRef base dir)
'((90 . 3) (63 . 256))
)
)
)
(defun makeDuct
(pos ref base dir
/ ip b ductRef ductType width
) (shiftup (shiftleft base (* width y)) (* width x))
(shiftup (shiftright base (* width y)) (* width x))
)
(* -1 (/ (- maxw 1) 2.0))
(/ (- maxw 1) 2.0)
)
b
(if (and (< y
26) (> y
-1) (< x
26) (> x
-1)) (insertDuct ref ip
)) ductBlocks
(cons b ductBlocks
) )
)
)
)
)
)
)
)
(defun makeLeader
(pos base dir
/ ip
) ip
(shiftup (shiftleft base (* maxw (/ width 2))) (+ (* width x) (/ width 2)))
(shiftup (shiftright base (/ width 2)) (+ (* width x) (/ width 2)))
)
)
(setq pt1
(shiftup ip
1.6) pt2 (shiftup (shiftdown ip (/ width 2)) 0.3)
pt3 (shiftleft (shiftdown ip (/ width 2)) 0.09)
ldrobj
(vlax-invoke space 'addleader ptlist txtobj acLineWithArrow
) )
)
(defun insertDuct
(ref ip
) "DUCT" 1 1 1 0))
(LM:vl-setattributevalue theblock "DUCTREF" ref)
theblock
)
(defun shiftright
( pt dist
/ p1 p2 p3
) (list (+ (car pt
) dist
) (cadr pt
) 0.0))