Lee Mac Posted January 4, 2012 Posted January 4, 2012 Thx ..lee mac, you are really something, you helped me a lot. ( I figured couple days ago your code/tutorial ) You're very welcome Loque, I'm delighted that you could understand my tutorial and make progress with your program. Quote
Loque Posted January 8, 2012 Author Posted January 8, 2012 (edited) Hi there again... I hit some kind of a wall so to say... here is the code : (defun _grad ( name colour linetype lineweight plot ) (if (null (tblsearch "LAYER" name)) (entmake (list '(0 . "LAYER") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord") '(70 . 0) (cons 2 name) (cons 6 (if (tblsearch "LTYPE" linetype) linetype "Continuous" ) ) (cons 62 colour) (cons 290 plot) (cons 370 lineweight) ) ) ) ) (defun c:grad ( / ) (foreach item '( ("001_TK25" 7 "Continuos" 5 1) ("002_DOF_OKVIR" 7 "Continuous" 5 1) ("003_DOF" 7 "Continuous" 5 1) ("009A_ZP" 94 "Continuous" 5 1) ("009B_ZPL" 94 "Continuous" 5 1) ("009_Z " 94 "Continuous" 5 1) ("010A_POVR_ZAHTJEVA" 1 "Continuous" 5 1) ("010_BROJ_ZAHTJEV" 7 "Continuous" 5 1) ("010_BROJ_ZAHTJEVA" 7 "Continuous" 5 1) ("011A_UKINUTO_BROJ" 6 "Continuous" 5 1) ("011A_UKINUTO_GP_IZRAĐ" 6 "Continuous" 5 1) ("011A_UKINUTO_HATCH " 6 "Continuous" 5 1) ("011B_DODANO_GP_POSTOJEĆE" 92 "Continuous" 5 1) ("011_DODANO_BROJ" 250 "Continuous" 5 1) ("011_DODANO_GP_IZRAĐ" 4 "Continuous" 5 1) ("020_GR_RH" 28 "Continuous" 5 1) ("021_GR_KZŽ" 26 "Continuous" 5 1) ("022_GR_JLS" 24 "Continuous" 5 1) ("023A_IME_NASELJA" 7 "Continuous" 5 1) ("023_GRA_NASELJA" 22 "Continuous" 5 1) ("030A_HATCH_IZGR" 50 "Continuous" 5 1) ("030B_IZGRAĐENO_GP_VINOGRADI" 14 "Continuous" 5 1) ("030_IZGRAĐENO_GP" 7 "Continuous" 5 1) ("031A_HATCH_NEIZGRA" 2 "Continuous" 5 1) ("031B_PLANIRANO_GP_CESTE" 94 "Continuous" 5 1) ("031_PLANIRANO_GP" 7 "Continuous" 5 1) ("032A_IKTEGO_HATCH" 7 "Continuous" 5 1) ("032_IKTEGO_LINE" 250 "Continuous" 5 1) ("033_OZNAKE_POSTOJE 250 "Continuous" 5 1) ("034_GRANICE_PLAN" 250 "Continuous" 5 1) ("035A_PUPU_OZNAKE" 250 "Continuous" 5 1) ("035_GRANICE_UPU" 253 "Continuous" 5 1) ("036A_PRIRODA_LINE" 96 "Continuous" 5 1) ("036B_PRIRODA_HATCH" 92 "Continuous" 5 1) ("036C_KULTURNA_LINE" 5 "Continuous" 5 1) ("036D_KULTURNA_HATCH" 150 "Continuous" 5 1) ("040A_ZAHTJEVI_HATCH" 3 "Continuous" 5 1) ("040B_ZAHTJEVI_PRIHVAT 5 "Continuous" 5 1) ("040C_ZAHTJEV_ODOBREN" 1 "Continuous" 5 1) ("040_ZAHTJEVI" 6 "Continuous" 5 1) ("041_ISPRAVAK" 14 "Continuous" 5 1) ("050_GP_PPU_STARI_PLAN" 150 "Continuous" 5 1) ("051_LEGENDA" 7 "Continuous" 5 1) ("052_SJEVER_MJERILO" 7 "Continuous" 5 1) ("1_KC_BROJ" 1 "Continuous" 5 1) ("1_KC_MEDJA 1 "Continuous" 5 1) ("1_KC_MEDJA_1000" 5 "Continuous" 5 1) ("1_KC_MEDJA_2000" 5 "Continuous" 5 1) ("1_KC_MEDJA_2880" 5 "Continuous" 5 1) ("1_KC_MEDJA_KO" 6 "Continuous" 5 1) ("1_KC_MEDJA_SPOR" 1 "Continuous" 5 1) ("2_K_BROJ" 30 "Continuous" 5 1) ("2_ZG" 4 "Continuous" 5 1) ("2_ZG_BROJ" 4 "Continuous" 5 1) ("3_UPORABA" 5 "Continuous" 5 1) ("3_UPORABA_BROJ 5 "Continuous" 5 1) ("4_SL_00" 8 "Continuous" 5 1) ("4_SL_01" 8 "Continuous" 5 1) ("4_SL_04" 8 "Continuous" 5 1) ("4_SL_06" 8 "Continuous" 5 1) ("4_SL_11" 8 "Continuous" 5 1) ("4_SL_14" 8 "Continuous" 5 1) ("4_SL_15" 8 "Continuous" 5 1) ("4_SL_17" 8 "Continuous" 5 1) ("4_SL_18" 8 "Continuous" 5 1) ("5_TOPONIMI_10" 6 "Continuous" 5 1) ("5_TOPONIMI_20" 6 "Continuous" 5 1) ("5_TOPONIMI_30" 6 "Continuous" 5 1) ("5_TOPONIMI_60" 6 "Continuous" 5 1) ("5_TOPONIMI_70" 6 "Continuous" 5 1) ("8_TOCKE" 190 "Continuous" 5 1) ) (apply '_grad item) ) (princ) ) so what happens when I try to load the wisp with the shortcut ("grad"). It says basically this "; error: too many arguments" an it creates just half oh the layers. So, does anyone know the solution to this? One more thing, when i write, for instance ("031_PLANIRANO_GP" 255,22,20, "Continuous" 5 1) (for instance I want on several layers true colors) i creates this error ; error: bad DXF group: (62 . 255,5,1) even says that when i put 420 instead 62. Edited January 8, 2012 by Loque Quote
Lee Mac Posted January 8, 2012 Posted January 8, 2012 so what happens when I try to load the wisp with the shortcut ("grad"). It says basically this "; error: too many arguments"an it creates just half oh the layers. So, does anyone know the solution to this? Are you writing your code using a code editor with code highlighting? (such as the Visual LISP IDE provided with AutoCAD?). If you were, you could easily see the problem: With code highlighting it is obvious that you are missing a few quotes from here and there, e.g. "033_OZNAKE_POSTOJE Concerning the Visual LISP IDE, here are a few short tutorials I have written, and here are some more from AfraLISP. One more thing, when i write, for instance ("031_PLANIRANO_GP" 255,22,20, "Continuous" 5 1) (for instance I want on several layers true colors) i creates this error ; error: bad DXF group: (62 . 255,5,1) even says that when i put 420 instead 62. To use a True colour value you will need to use DXF Group 420 and convert the RGB values to a 24-bit True Colour integer. Here are my Colour Conversion Functions. Quote
Loque Posted January 8, 2012 Author Posted January 8, 2012 No, I used your code that you so nicely explained on page 3, I just adjusted a bit by putting some layers in it. I did figure that I missed couple of quotes after I double checked the code but thx anyway. To use a True colour value you will need to use DXF Group 420 and convert the RGB values to a 24-bit True Colour integer. I did replace value 62 with 420 but I obviously (on second attempt but I didn't post it here) did not convert the values to 24-bit True color integer coz I didn't know how. Which line should I change in code to accept True colors as well as index colors. Btw nice site...It helped me a lot (visited like couple a weeks ago) and I did recommend your page to a couple of my friends. Quote
Lee Mac Posted January 8, 2012 Posted January 8, 2012 No, I used your code that you so nicely explained on page 3, I just adjusted a bit by putting some layers in it. I did figure that I missed couple of quotes after I double checked the code but thx anyway. I suggest you re-read my post more carefully - I wasn't referring to which code you were using, but rather which editor you were using to write your code. I did replace value 62 with 420 but I obviously (on second attempt but I didn't post it here) did not convert the values to 24-bit True color integer coz I didn't know how. Which line should I change in code to accept True colors as well as index colors. I offered a link to my Colour Conversion functions which demonstrate how to convert between various colour values. You are looking to convert from RGB values to a True Colour value, so I would recommend you use the LM:RGB->True function. Depending on how you want to pass the RGB values (i.e. as a comma-delimited string or otherwise), you may also need to use my String to List function to parse the RGB values. Or, you can add the extra Red, Green, Blue arguments and just supply the colour argument with nil when passing a these values to the function. Btw nice site...It helped me a lot (visited like couple a weeks ago) and I did recommend your page to a couple of my friends. Thanks, glad it helps. Quote
SLW210 Posted January 9, 2012 Posted January 9, 2012 Loque, You think you might someday edit post #6 to include CODE TAGS? Quote
Loque Posted January 10, 2012 Author Posted January 10, 2012 Loque, You think you might someday edit post #6 to include CODE TAGS? Sure, no problem. I believe it's fixed now. Quote
bitslapped Posted June 18, 2012 Posted June 18, 2012 Would it be possible to have a simple command to create a function with all setting as default except name and color, where the color chart pops up when required? e.g. newlayer "Enter the layer name": .L_somelayer Thanks for considering! Quote
irneb Posted June 18, 2012 Posted June 18, 2012 Quick one: (defun c:SetLayer (/ name col) (if (setq name (getstring t "New layer name: ")) (if (tblsearch "LAYER" name) (progn (prompt "Layer already exists, set as current.") (setvar "CLayer" name)) (if (setq col (acad_colordlg 7 nil)) (progn (entmake (list '(0 . "LAYER") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord") '(70 . 0) (cons 2 name) (cons 62 col))) (prompt "Layer created and set current.") (setvar "CLayer" name))))) (princ)) 1 Quote
bitslapped Posted June 18, 2012 Posted June 18, 2012 Thanks irneb. It worked exactly as I expected. Brilliant! Quote
irneb Posted June 18, 2012 Posted June 18, 2012 Pleasure! Though it's slightly different from the OP's request. Quote
Madruga_SP Posted January 12, 2013 Posted January 12, 2013 @Lee Mac Thanks for the excellent tutorial! Helped me a lot. @Irné bitslapped said: Thanks irneb. It worked exactly as I expected. Brilliant! Thanks. Your code worked like a charm. :notworthy: Regards. Quote
Lee Mac Posted January 12, 2013 Posted January 12, 2013 @Lee MacThanks for the excellent tutorial! Helped me a lot. Thanks, you're welcome! Quote
fixo Posted January 12, 2013 Posted January 12, 2013 This may be useful too, I use it often Create layer with Description: http://www.theswamp.org/index.php?topic=33041.msg384927#msg384927 Quote
darkorange Posted February 28, 2013 Posted February 28, 2013 @ Lee mac Thanks for the help and for availability for quick answers! I am trying to make a lisp from yours step but it not assumes the linetypes i want! If you anyone please can take a look and leave an clue:) Thanks in advance too helpers (defun _cmb ( name colour linetype lineweight plot ) (if (null (tblsearch "LAYER" name)) (entmake (list '(0 . "LAYER") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord") '(70 . 0) (cons 2 name) (cons 6 (if (tblsearch "LTYPE" linetype) linetype "Continuous" ) ) (cons 62 colour) (cons 290 plot) (cons 370 lineweight) ) ) ) ) (defun c:cmb ( / ) (foreach item '( ("TOPO_Anexo" 7 "Continuous" 25 1) ("TOPO_Arranque_casa" 7 "DASHDOT" 30 1) ("TOPO_Arranque_muro" 7 "DASHDOT" 15 1) ("TOPO_Bus" 140 "Continuous" 13 1) ("TOPO_Caminho" 252 "DASHED" 18 1) ("TOPO_Caminho_Ferro" 7 "Continuous" 15 1) ("TOPO_Caminho_Florestal" 64 "DASHED" 13 1) ("TOPO_Cotas" 7 "Continuous" 13 1) ("TOPO_Cotas_Soleira" 6 "Continuous" 13 1) ("TOPO_Curvas_Nivel" 41 "Continuous" 15 1) ("TOPO_Curvas_Nivel_Mestras" 22 "Continuous" 20 1) ("TOPO_EDP" 6 "Continuous" 5 1) ("TOPO_Edificio" 7 "Continuous" 30 1) ("TOPO_Equipamentos_desportivos" 252 "Continuous" 30 1) ("TOPO_Equipamentos_religiosos" 7 "Continuous" 30 1) ("TOPO_Escadas" 252 "Continuous" 5 1) ("TOPO_Escola" 7 "Continuous" 30 1) ("TOPO_Estação_CP" 8 "Continuous" 15 1) ("TOPO_Guia_Baía" 32 "Continuous" 9 1) ("TOPO_Guia_jardim" 3 "Continuous" 15 1) ("TOPO_Gás" 4 "Continuous" 5 1) ("TOPO_Hospital" 7 "Continuous" 30 1) ("TOPO_Igreja" 7 "Continuous" 30 1) ("TOPO_Iluminação" 7 "Continuous" 15 1) ("TOPO_Limites_Terreno" 150 "DASHED" 30 1) ("TOPO_Linhas_Água" 5 "LINHA_DAGUA" 15 1) ("TOPO_Mobiliário Urbano" 253 "Continuous" 15 1) ("TOPO_Muros" 1 "Continuous" 15 1) ("TOPO_Outros_Planimetricos" 8 "Continuous" 15 1) ("TOPO_PTelecom" 200 "Continuous" 5 1) ("TOPO_Passagem_Inf" 22 "DASHED" 13 1) ("TOPO_Passagem_Sup" 22 "Continuous" 13 1) ("TOPO_Passagem_nivel" 8 "DASHED" 15 1) ("TOPO_Passeio_cguia" 6 "Continuous" 13 1) ("TOPO_Passeio_sguia" 7 "Continuous" 13 1) ("TOPO_Patamar" 252 "Continuous" 13 1) ("TOPO_Publicidade_Informação" 3 "Continuous" 5 1) ("TOPO_Ruínas" 2 "Hidden" 30 1) ("TOPO_Saneamento" 7 "Continuous" 5 1) ("TOPO_Sarjeta" 7 "Continuous" 5 1) ("TOPO_TVCabo" 8 "Continuous" 5 1) ("TOPO_Talude" 72 "Continuous" 15 1) ("TOPO_Texto_Legenda" 7 "Continuous" 15 1) ("TOPO_Topografia" 42 "Continuous" 5 1) ("TOPO_Toponimia" 7 "Continuous" 15 1) ("TOPO_Trama" 7 "Continuous" 5 1) ("TOPO_Trânsito" 30 "Continuous" 13 1) ("TOPO_Valeta" 5 "Continuous" 15 1) ("TOPO_Vedação_Rede" 252 "FENCELINE2" 15 1) ("TOPO_Vegetação" 64 "Continuous" 13 1) ("TOPO_Via_Berma" 4 "Continuous" 20 1) ("TOPO_Via_Eixo" 1 "DASHDOT" 13 1) ("TOPO_Águas_Pluviais" 5 "Continuous" 5 1) ) (apply '_cmb item) ) (princ) ) Sorry for my english i'm portuguese.... Quote
Lee Mac Posted February 28, 2013 Posted February 28, 2013 Hi darkorange, are the linetypes loaded in your drawing? Quote
darkorange Posted February 28, 2013 Posted February 28, 2013 no they aren't!its a new drawing only load Bylayer,Byblock and continuous.... isn't possible to load then automatic?i will try to search for that! Quote
darkorange Posted February 28, 2013 Posted February 28, 2013 thanks lee mac i got it i created a new template with my linetypes loaded:) 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.