Here is a piece of code i found that does sort of what i need. The issues with this are that first, it doesnt allow me to select a profile, only a polyline. Second, id like to add the conditional statements that change the hatch depending on grade of slope. Any ideas?
Code:
;select point on proposed bed profile
;create rectangle/polyline
(defun c:hoff (/ cl dist hi e p1 ss pt)
(setq echo (getvar 'cmdecho))
(setvar 'cmdecho 0)
(setq cl (getvar "clayer"))
(if (setq dist (cond ((getdist (strcat "\n Specify offset distance <"
(rtos (if (not hi)
(setq hi 0.5)
)
2
2
)
">:"
)
)
)
(t hi)
)
)
(progn (setq hi dist)
(if (not (tblsearch "LAYER" "CLASHING_HATCH"))
(entmakex '((0 . "LAYER")
(100 . "AcDbSymbolTableRecord")
(100 . "AcDbLayerTableRecord")
(2 . "CLASHING_HATCH")
(70 . 0)
(62 . 140)
(6 . "Continuous")
)
)
)
(command "_-layer" "on" "CLASHING_HATCH" "")
(command "_-layer" "thaw" "CLASHING_HATCH" "")
(setvar 'clayer "CLASHING_HATCH")
(setq e (entsel "\nSelect object to offset: "))
(command "._COPY" e "" "" "")
(setq f (car e))
(setq p1 (getpoint "\n Side to offset? "))
(command "_.offset" "_Layer" "_Current" dist f p1 "")
(progn (setq b (entlast))
(setvar "peditaccept" 1)
(command "pedit" "m" "l" e "" "j" "j" "a" "2" "")
)
;; progn
)
)
;;;;;;;;;;;;;;;;;;;
(setq el (entlast))
;; Selection set of objects to hatch
(setq ss (ssadd))
(ssadd f ss)
(ssadd b ss)
(command "_-boundary" p1 "")
(if (/= el (entlast))
(command "_-hatch" "_S" ss "" "_P" "ANSI31" "0.025" "90" "_T" "60" "_DR" "B" "_LA" "HATCH" "")
)
;(command "erase" el "")
;; Put offset object on defpoints layer rather than erase ;; pb i'm sticking them on a layer which gets deleted once a drawing if finalised
; (entmod (subst '(8 . "defpoints") (assoc 8 (entget el)) (entget el)))
;;;;;;;;;;;;;;;;;;;
(setvar 'cmdecho echo)
(setvar "clayer" cl)
(command "_-layer" "off" "CLASHING_HATCH" "")
(princ)
)
;create depth of rec/pline
;make rectangle/pline run length of proposed bed profile
;make hatch layer conditional upon slope percent
(cond ((= >5% Profile label "lines") (setq 8. "G-MATC-LINE")))
(cond (( =<5% Profile label "lines") (setq 8. "G-PROF-TTLB")))
;print total length of each individual hatch layers
)