Why dont you just setup a template file with all your standard layers created in it?


Registered forum members do not see this ad.
hey again guys
I'm looking for a little lisp that i can expand on to suit our standard layers
I'm looking for a lisp that can setup new layers in a drawing - names - colors and linetypes
But if a layer name already exists dont ask the user to redefine
Is there an existing lisp that someones knows about?
Cheers
Why dont you just setup a template file with all your standard layers created in it?
You can get it jumpin' You can get it pumpin' You can get it chasing a cow. Matter o' fact, I got it now.


I have already set up one - but everyone wants a simple button to import layers.
Thanks though
\![]()


and i would rather set it up using a lisp for adding layers than bringing in a template
Any ideas?
Whats the function in a lisp to bring in a layer set its color and linetype
and i'll write the rest and post it back for you to pick it to pieces and advise me on all the errors i make
ha
Cheers
Last edited by russell84; 3rd Mar 2008 at 03:37 am.




It would be easier to drag the layers from your template using Design Center, but this should get you started...
Code:(command "-layer" "m" "layername" "c" "color" "" "l" "linetype" "" "")


i was thinking of using something like this to import layers and set them up - but doing this for each layer would be alot of work for the pc - is there a easier way of doing it or should i just resolve to creating a lisp to import a template file and delete it thus setting up all layers etc
any ideas?
Cheers
Code:(if(not(tblsearch "LTYPE" "EX_GAS")) (command "-linetype" "_l" "EX_GAS" "services" "") ); end if (if(not(tblsearch "LAYER" "EXSRV_GAS")) (command "-layer" "new" "EXSRV_GAS" "Color" 251 "EXSRV_GAS" "LTYPE" "EX_GAS" "EXSRV_GAS" "") );end if
Look at this function:
And try it with list '(("LayerName1" Color)...):Code:(defun CreateLayers(layLst / layCol nLay) (vl-load-com) (setq layCol(vla-get-Layers (vla-get-ActiveDocument (vlax-get-Acad-object)))) (foreach itm layLst (if (not(vl-catch-all-error-p (setq nLay(vl-catch-all-apply 'vla-Add (list layCol(car itm)))))) (vla-put-Color nLay(cadr itm)) ); end if ); end foreach (princ) ); end of CreateLayers
Code:(CreateLayers '(("MyLayer1" 1)("MyLayer2" 2)("MyLayer3" 3)))


Thankyou once again asmi - i will look at this method
Cheers mate

So how can the routine load linetypes? i see from the code you can specify the layer, colour, and line type name...does it pull from the acadiso.lin? or acad.lin? can you specify where it loads from?
Just starting to learn lisps ...
thanks!
Bookmarks