(defun
c:hplc (/ color en ha hp hs lname ltable sset)
(setq
old_cmdecho (getvar
"cmdecho"))
(setvar "cmdecho" 0)
(initget
"ANSI37 AR-CONC AR-SAND EARTH")
(setq
ptname (getkword "\nSelect Pattern Name [ANSI37/AR-CONC/AR-SAND/EARTH]
:<ANSI37>"))
(if (= ptname "")(setq ptname "ANSI37"))
(setq
hp (getvar "hpname"))
(setvar
"hpname" ptname) ;<-- hatch pattern name
(setq
ha (getvar "hpassoc"))
(setvar
"hpassoc" 1) ;<-- set hatch associative
(setq
hs (getvar "hpscale"))
(setvar "hpscale" 2.0) ;<-- set hatch pattern scale
(if
(and
(setq e (car (entsel "\nSelect
entity for layer name: ")))
(setq e (tblsearch "layer"
(cdr (assoc 8 (entget e)))))
(setq lyn (cdr (assoc 2 e)))
(setq
sset
(ssget "_X"
(list
(cons 0 "LWPOLYLINE") ;<--
lightweight polylines only
(cons 70 1) ;<--
closed polylines
(cons 410 (getvar
"CTAB")) ;<-- current space
(cons 8 lyn) ;<-- layer
name;"Layer1,Layer2,Layer3"<--desired layer names, separated by
comma
)
)
)
)
(while
(setq en (ssname sset 0))
(setq lname (cdr (assoc 8 (entget en))))
(setq ltable (tblsearch "layer"
lname))
(setq color (cdr (assoc 62 ltable)))
(command "._-hatch"
"_S" en "" "")
(command "._change"
(entlast)
""
"_PR"
"_Layer"
lname
"_Color"
"BYLAYER"
""
)
(ssdel en sset)
)
(alert
" Polyline Object is Don't Closed ")
)
(setvar
"hpname" hp) ;<-- restore hatch patter name
(setvar
"hpassoc" ha) ;<-- restore hatch asociativity
(setvar
"hpscale" hs) ;<-- restore hatch patter scale
(setvar
"cmdecho" old_cmdecho)
(princ)
)
(prompt
"\nEnter HPLC to start Hatch Polyline Closed by Layer")
(princ)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น