BLOACH85 Posted March 26, 2009 Posted March 26, 2009 Hey guys im currently working on a lisp to create standard layers but here is my two problems. I want it to automatically envoke at each drawing startup to create the layers. also if the layer allready exists i want it to overwrite it. Is there any way to do this? Quote
Lee Mac Posted March 26, 2009 Posted March 26, 2009 Well, to make it run at the startup of each drawing session, just make a call to it in your ACADDOC.lsp file Quote
Lee Mac Posted March 26, 2009 Posted March 26, 2009 also if the layer allready exists i want it to overwrite it Do you mean delete that layer and everything on it and create your one, or just change some properties of the old one? Quote
BLOACH85 Posted March 26, 2009 Author Posted March 26, 2009 Well pretty much if its there i dont want to completely delete it and everything on it, Just change properties so all draftsmen are using fully uniformed layers. Let me ask you another question, I have a computer up here that will not load a custom linetype that is in the acad.lin all other linetypes load but the user defined will not. its in the right place on the search path but am i missing something? I have been working on it all morning. Quote
Lee Mac Posted March 26, 2009 Posted March 26, 2009 I'm not sure about your linetype issue, but for the layers, something in this format would do the trick: (defun c:layupd (/ oldcmd laylist) (setq oldcmd (getvar "CMDECHO")) (setvar "CMDECHO" 0) (setq laylist '(("LAYER1" "4" "CONTINUOUS") ("LAYER2" "3" "HIDDEN"))) (foreach lay laylist (if (not (tblsearch "LAYER" (car lay))) (command "-layer" "m" (car lay) "C" (cadr lay) (car lay) "") (command "-layer" "C" (cadr lay) (car lay) "")) (if (tblsearch "LTYPE" (caddr lay)) (command "-layer" "LT" (caddr lay) (car lay) "") (princ (strcat "\n" (caddr lay) " Linetype could not be found!")))) (setvar "CMDECHO" oldcmd) (princ)) (c:layupd) This will update the layers as specified in the layer list at the top, this will update colour and linetype, but can be modified if necessary. Quote
Se7en Posted March 26, 2009 Posted March 26, 2009 Word of advice: entmake will return nil if layer exists so you will need to have two conditions: 1. entmake new layers 2. entmod existing layers not correctly defined. Quote
Lee Mac Posted March 26, 2009 Posted March 26, 2009 Word of advice:entmake will return nil if layer exists so you will need to have two conditions: 1. entmake new layers 2. entmod existing layers not correctly defined. Just using the "command call" seems to work Quote
Se7en Posted March 26, 2009 Posted March 26, 2009 Sure it does. Command works good. But if you want to create a thousand layers or so in the blink of an eye, your going to need something a bit more beefy then just command. *wink* Quote
Lee Mac Posted March 26, 2009 Posted March 26, 2009 Sure it does. Command works good. But if you want to create a thousand layers or so in the blink of an eye, your going to need something a bit more beefy then just command. *wink* Hehe ok, cheers John 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.