ectech Posted April 28, 2010 Posted April 28, 2010 Dear All, I would like to hatch all closed polyline in different layer and make it in different color. anyone know how to do that ? Thanks ! Quote
MSasu Posted April 28, 2010 Posted April 28, 2010 Basically, may use: (setq ClosedPlinesSSet (ssget "_X" (LIST '(0 . "LWPOLYLINE") '(70 . 1))) ;select all closed polylines CrIndex 0) (repeat (sslength ClosedPlinesSSet) ;parse selection set items (setvar "CECOLOR" (itoa (1+ CrIndex))) ;change current color (command "_HATCH" "_U" 45 1 "_N" (ssname ClosedPlinesSSet CrIndex) "") ;apply hatch (setq CrIndex (1+ CrIndex)) ;go to next entity ) Regards, Quote
fixo Posted April 28, 2010 Posted April 28, 2010 Dear All, I would like to hatch all closed polyline in different layer and make it in different color. anyone know how to do that ? Thanks ! Here is another one (defun C:hat (/ color en ha hp hs lname ltable sset) (setq hp (getvar "hpname")) (setvar "hpname" "ANSI37") ;<-- 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 (setq sset (ssget "_X" (list (cons 0 "LWPOLYLINE") ;<-- lightweight polylines only (cons 70 1) ;<-- closed polylines (cons 410 (getvar "CTAB")) ;<-- current space (cons 8 "Layer1,Layer2,Layer3,Layer4,Layer5")))) ;<--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)) (setvar "hpname" hp) ;<-- restore hatch patter name (setvar "hpassoc" ha) ;<-- restore hatch asociativity (setvar "hpscale" hs) ;<-- restore hatch patter scale (princ) ) (prompt "\n\t\t>>>\tType HAT to execute\t<<<") (prin1) ~'J'~ Quote
alanjt Posted May 1, 2010 Posted May 1, 2010 This thread may be of interest. http://www.cadtutor.net/forum/showthread.php?p=317755 Quote
Lee Mac Posted May 1, 2010 Posted May 1, 2010 This thread may be of interest. http://www.cadtutor.net/forum/showthread.php?p=317755 Did he not like the answers in that thread then? Quote
alanjt Posted May 1, 2010 Posted May 1, 2010 Did he not like the answers in that thread then? WTF?! I didn't even notice it was the same person. I guess the post is pointless. He'll probably never respond to this one either. Quote
Baber62 Posted September 11, 2012 Posted September 11, 2012 Hi Fixo, The last line should be changed to (princ) not (prin1). I was wondering if the routine could be modified so that if the area has already been hatched it does not get hatched again. I have tried the routine it work beautifully except the drawings I am working on already have some hatches in them and when I run the routine the same area gets hatched again. I look forward to your response with great anticipation. Quote
Lee Mac Posted September 11, 2012 Posted September 11, 2012 The last line should be changed to (princ) not (prin1). Why? ........ Quote
ectech Posted September 12, 2012 Author Posted September 12, 2012 I'm so sorry later for reply, thank you very much for all of your help ! I like this answers very very much. Did he not like the answers in that thread then? Quote
ectech Posted September 12, 2012 Author Posted September 12, 2012 Thank you for MSasu, fixo, alanjt and Lee Mac. Forgive me later for reply, I don't why I haven't recieve any email from this post before. That why I haven't reply this post. Both of you is very kindly and helpful. Yours code is very very useful. Quote
martinle Posted September 12, 2012 Posted September 12, 2012 Here is another one (defun C:hat (/ color en ha hp hs lname ltable sset) (setq hp (getvar "hpname")) (setvar "hpname" "ANSI37") ;<-- 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 (setq sset (ssget "_X" (list (cons 0 "LWPOLYLINE") ;<-- lightweight polylines only (cons 70 1) ;<-- closed polylines (cons 410 (getvar "CTAB")) ;<-- current space (cons 8 "Layer1,Layer2,Layer3,Layer4,Layer5")))) ;<--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)) (setvar "hpname" hp) ;<-- restore hatch patter name (setvar "hpassoc" ha) ;<-- restore hatch asociativity (setvar "hpscale" hs) ;<-- restore hatch patter scale (princ) ) (prompt "\n\t\t>>>\tType HAT to execute\t<<<") (prin1) ~'J'~ Fixo Hello! Your Lisp works great! How could I change it if I just hatching (not two superimposed) would make per Polylinienumgrenzung in a selectable color? Thanks for your help! Best regards Martin Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.