Christina_ Posted April 9, 2015 Share Posted April 9, 2015 Hello Cad Users, I am Christina new to CadTutor and Lisp. I’m 14 year student with much affection for AutoCad & Autolisp. And I have a question about Layers… Found this very nice tutor from Expert Lee Mac and will like to know how to have a description by the layers? (defun _layer4 ( 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:test4 ( / ) (foreach item '( ("Layer7" 4 "HIDDEN" 40 1) ("Layer8" 3 "Continuous" 90 0) ("Layer9" 2 "PHANTOM" 20 1) ) (apply '_layer4 item) ) (princ) ) Thank you to read this, Christina Quote Link to comment Share on other sites More sharing options...
pBe Posted April 9, 2015 Share Posted April 9, 2015 (edited) Hello Cad Users,I am Christina new to CadTutor and Lisp. I’m 14 year student with much affection for AutoCad & Autolisp. Christina Hi Christina , Welcome to CADTutor. Now that's the spirt! And I have a question about Layers… Found this very nice tutor from Expert Lee Mac and will like to know how to have a description by the layers? ARe you wanting to add layer descriptions? only to the newly created layers? or even existing ones? Quick hack (defun _layer4 ( name colour linetype lineweight plot des) (if (null (tblsearch "LAYER" name)) [color="blue"](progn[/color] (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) ) ) [color="blue"](command "-layer" "_Description" des name "")[/color] [color="blue"])[/color] ) ) (defun c:test4 ( / ) (foreach item '( ("Layer7" 4 "HIDDEN" 40 1 [color="blue"]"whoopie"[/color]) ("Layer8" 3 "Continuous" 90 0 [color="blue"]"hello")[/color] ("Layer9" 2 "PHANTOM" 20 1 [color="blue"]"banana cake"[/color]) ) (apply '_layer4 item) ) (princ) ) Edited April 9, 2015 by pBe Quote Link to comment Share on other sites More sharing options...
Christina_ Posted April 9, 2015 Author Share Posted April 9, 2015 Hi pBe, I will be very happy by new layers, i search few days for this Have try with: (if description (list (list -3 (list "AcAecLayerStandard" (cons 1000 "") (cons 1000 description))))) but no succes The idea by existing ones make me very curious... Thank you for reply! Quote Link to comment Share on other sites More sharing options...
pBe Posted April 9, 2015 Share Posted April 9, 2015 Oh I see, you want a non command line approach. I never really did try to figure out how to add description thru dictionaries. But that will a first for me too. You may try (vla-put-description layerobject "description") but you may need to overhaul the code you posted above. The idea by existing ones make me very curious.. I know right? But like i said, you may have to re-write the entire code. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 9, 2015 Share Posted April 9, 2015 Hi Christina & welcome to CADTutor Please try the following: (defun _layer4 ( lay col lin lwt plt des ) (if (null (tblsearch "LAYER" lay)) (progn (regapp "AcAecLayerStandard") (entmake (append (list '(000 . "LAYER") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord") '(070 . 0) (cons 2 lay) (cons 6 (if (tblsearch "LTYPE" lin) lin "Continuous" ) ) (cons 062 col) (cons 290 plt) (cons 370 lwt) ) (if des (list (list -3 (list "AcAecLayerStandard" (cons 1000 "") (cons 1000 des) ) ) ) ) ) ) ) ) ) (defun c:test4 ( / ) (foreach item '( ("Layer7" 4 "HIDDEN" 40 1 "My Hidden Layer") ("Layer8" 3 "Continuous" 90 0 "My Continuous Layer") ("Layer9" 2 "PHANTOM" 20 1 "My Phantom Layer") ) (apply '_layer4 item) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Christina_ Posted April 9, 2015 Author Share Posted April 9, 2015 @ pBe, now I will search about your idea to edit when the Layer exist @ Lee Mac, Happy to meet the master of Lisp, we know about your knowledge even in Belgium! Yes, finally its works, my daddy will happy too! I have always use regapp on the wrong place… Both very thank you for the Welcome and to solve my problem! Christina Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 9, 2015 Share Posted April 9, 2015 You are too kind Christina! - Thank you for your flattering compliments. I'm pleased the code is working well for you, and that you are happy with the outcome. All the best. Quote Link to comment Share on other sites More sharing options...
pBe Posted April 10, 2015 Share Posted April 10, 2015 Please try the following: (progn (regapp "AcAecLayerStandard") (....) (if des (list (list -3 (list "AcAecLayerStandard" (cons 1000 "") (cons 1000 des) ) ) ... So that's how its done. Thank you Lee Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 10, 2015 Share Posted April 10, 2015 So that's how its done. Thank you Lee No worries pBe Quote Link to comment Share on other sites More sharing options...
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.