autolisp Posted January 5, 2011 Share Posted January 5, 2011 (edited) Dear Sir, It’s possible to add dialog box to create layer My query is pick architecture. Create only architecture layer Crete layer category example Category 1) Civil Cv-Dim Layer Cv-Hatch Layer 2) Architecture Ar-Dim Layer Ar-Hatch Layer 3) Electric El-Dim Layer El-Wire Layer (defun MakeLayer ( name colour linetype lineweight willplot bitflag description ) ;; © Lee Mac 2010 (or (tblsearch "LAYER" name) (entmake (append (list (cons 0 "LAYER") (cons 100 "AcDbSymbolTableRecord") (cons 100 "AcDbLayerTableRecord") (cons 2 name) (cons 70 bitflag) (cons 290 (if willplot 1 0)) (cons 6 (if (and linetype (tblsearch "LTYPE" linetype)) linetype "CONTINUOUS" ) ) (cons 62 (if (and colour ( (cons 370 (fix (* 100 (if (and lineweight ( ) ) ) ) (if description (list (list -3 (list "AcAecLayerStandard" (cons 1000 "") (cons 1000 description)) ) ) ) ) ) ) ) (defun c:MakeLayers nil (vl-load-com) ;; © Lee Mac 2010 ;; Specifications: ;; Description Data Type Remarks ;; ----------------------------------------------------------------- ;; Layer Name STRING Only standard chars allowed ;; Layer Colour INTEGER may be nil, -ve for Layer Off, Colour ;; Layer Linetype STRING may be nil, If not loaded, CONTINUOUS. ;; Layer Lineweight REAL may be nil, 0 ;; Plot? BOOLEAN T = Plot Layer, nil otherwise ;; Bit Flag INTEGER 0=None, 1=Frozen, 2=Frozen in VP, 4=Locked ;; Description STRING may be nil for no description ;; Function will return list detailing whether layer creation is successful. ( (lambda ( lst / lts ) (setq lts (vla-get-Linetypes (vla-get-ActiveDocument (vlax-get-acad-object)))) (mapcar 'cons (mapcar 'car lst) (mapcar (function (lambda ( x ) (and (caddr x) (or (tblsearch "LTYPE" (caddr x)) (vl-catch-all-apply 'vla-load (list lts (caddr x) "acad.lin")) ) ) (apply 'MakeLayer x) ) ) lst ) ) ) '( ; Name Colour Linetype Lineweight Plot? BitFlag Description ( "CEN" 6 "CENTER" 0.18 T 0 nil ) ( "DIMS" -1 nil 0.18 T 1 "Dimensions" ) ( "HAT" 3 nil 0.18 T 5 nil ) ( "HID" 4 "HIDDEN" 0.15 T 0 "Hidden" ) ( "LOGO" 176 nil 0.09 T 0 "For Logo" ) ( "OBJ" -2 nil 0.40 T 3 nil ) ( "PAPER" 5 "PHANTOM" nil nil 6 nil ) ( "PHAN" 6 "PHANTOM" 0.18 T 0 nil ) ( "TITLE" 176 nil nil T 1 "For Title" ) ( "TXT" 7 nil nil T 0 nil ) ) ) ) Edited January 5, 2011 by autolisp changed code-tags Quote Link to comment Share on other sites More sharing options...
ReMark Posted January 5, 2011 Share Posted January 5, 2011 Wouldn't it be easier to create all the layers you need in your template as well as have all the linetypes and text styles pre-loaded? Quote Link to comment Share on other sites More sharing options...
Tiger Posted January 5, 2011 Share Posted January 5, 2011 There is a reason why I changed your tags to Code-tags so that the code is wrapped and scroll-able so that you don't have to scroll by a mile of lisp-text every time you check the thread. But each to his own I guess. Sorry for interfering. Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted January 5, 2011 Share Posted January 5, 2011 The code Lee created I am sure was meant to be one size fits all and not specific to one's needs. You will have to figure those changes out for yourself. Quote Link to comment Share on other sites More sharing options...
Atwist Posted January 5, 2011 Share Posted January 5, 2011 Hello Autolisp, Mayby is this what your looking for http://www.jefferypsanders.com/autolisp_CLAY.html 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.