+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
  1. #1
    Senior Member
    Using
    Civil 3D 2008
    Join Date
    Feb 2008
    Posts
    294

    Default Import Standard Layers

    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

  2. #2
    Senior Member azzro10's Avatar
    Computer Details
    azzro10's Computer Details
    Operating System:
    XP Pro
    Using
    AutoCAD 2010
    Join Date
    Dec 2007
    Location
    Melbourne, Australia
    Posts
    311

    Default

    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.

  3. #3
    Senior Member
    Using
    Civil 3D 2008
    Join Date
    Feb 2008
    Posts
    294

    Default

    I have already set up one - but everyone wants a simple button to import layers.


    Thanks though
    \

  4. #4
    Senior Member
    Using
    Civil 3D 2008
    Join Date
    Feb 2008
    Posts
    294

    Default

    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.

  5. #5
    Forum Deity
    Using
    Civil 3D 2008
    Join Date
    Sep 2006
    Location
    Pittsburgh, PA, USA
    Posts
    3,581

    Default

    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" "" "")
    



  6. #6
    Senior Member
    Using
    Civil 3D 2008
    Join Date
    Feb 2008
    Posts
    294

    Default

    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

  7. #7
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    Look at this function:

    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
    And try it with list '(("LayerName1" Color)...):

    Code:
    (CreateLayers '(("MyLayer1" 1)("MyLayer2" 2)("MyLayer3" 3)))

  8. #8
    Senior Member
    Using
    Civil 3D 2008
    Join Date
    Feb 2008
    Posts
    294

    Default

    Thankyou once again asmi - i will look at this method

    Cheers mate

  9. #9
    Full Member
    Computer Details
    N_461's Computer Details
    Operating System:
    XP SP3
    Computer:
    Dell Precision PWS490
    CPU:
    Intel Xeon 5150 2.66GHz
    RAM:
    3GB
    Graphics:
    256mb
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Location
    Calgary
    Posts
    54

    Default Layer lisp

    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!

  10. #10
    Super Member fixo's Avatar
    Computer Details
    fixo's Computer Details
    Operating System:
    Windows 7
    Motherboard:
    E7500
    CPU:
    Intel(R)Core(TM)2 DUO CPU 2.93HGz
    RAM:
    4098 Gb
    Graphics:
    1024 Gb
    Using
    AutoCAD 2009
    Join Date
    Jul 2005
    Location
    Pietari, Venäjä
    Posts
    1,586

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by N_461 View Post
    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!
    Check MEASUREINIT system variable
    See Help

    ~'J'~
    The soul is healed by being with children. - Fyodor Dostoyevsky, novelist (1821-1881)

Similar Threads

  1. Import Layers And Linetypes From Another Dwg
    By studiorat in forum AutoCAD General
    Replies: 6
    Last Post: 5th May 2011, 01:57 am
  2. import line and layers
    By studiorat in forum AutoCAD Drawing Management & Output
    Replies: 3
    Last Post: 4th Jan 2008, 08:05 pm
  3. Convert Layers to Standard
    By Rhayes in forum AutoCAD Drawing Management & Output
    Replies: 1
    Last Post: 18th Sep 2007, 09:40 pm
  4. set standard colors for DIM, HID and VIS layers
    By hassebassie in forum AutoCAD 3D Modelling & Rendering
    Replies: 3
    Last Post: 20th Jul 2006, 02:13 pm
  5. Possible to import and export layers?
    By bdelph in forum AutoCAD Drawing Management & Output
    Replies: 1
    Last Post: 28th Apr 2005, 03:00 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts