;;; Create closed area Hatch Ceiling 60x60cm. already drawn by polyline with option to offset this polyline
;;; Created by Igal Averbuh 2017

(defun c:phx ( / hpn )
(setq hpn (getvar 'hpname))

(setvar 'hpname "net")
(setvar "osmode" 167)

(setvar "HPORIGINMODE" 1) ; 1 - Uses the bottom-left corner of the rectangular extents of the hatch boundaries

; 2 - Uses the bottom-right corner of the rectangular extents of the hatch boundaries

; 3 - Uses the top-right corner of the rectangular extents of the hatch boundaries

; 4 - Uses the top-left corner of the rectangular extents of the hatch boundaries

; 5 - Uses the center of the rectangular extents of the hatch boundaries

;(setq sc (getdist "\nSet Initial Hatch Scale: "))
(command "_.pline")
(while (< 0 (getvar 'cmdactive)) (command "\\"))

(setvar 'OFFSETDIST
(cond ((getdist (strcat "\nSpecify offset distance: If zero take 0.001 : ")))
((getvar 'OFFSETDIST))
)
)

(setq ent (entlast))
(command "_.offset" "_E" "_Y" (getvar 'OFFSETDIST) ent pause "")

(command "_.offset" "_E" "_N" "" "")

(COMMAND "-hatch" "p" "net" "480" "0" "s" "l" "" "")

(while (< 0 (getvar 'cmdactive)) (command ""))
(setvar "HPORIGINMODE" 0)
(princ)
(command "_.change" "L" "" "P" "C" "Bylayer" "")
)

(defun c:p60 ( /)
(c:phx)

)
(c:p60)