+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 24
  1. #1
    Junior Member
    Using
    AutoCAD 2014
    Join Date
    Jun 2016
    Posts
    18

    Default LISP for create new layer on open dwg

    Registered forum members do not see this ad.

    Hi I've been looking for a LISP that will create a new layer with a given name ("DATA EXTRACTION") every time I open up a dwg (unless that layer already exists) and make that layer current. I have found a couple of similar LISP routines but they don't do just that.
    Any help much appreciated.

  2. #2
    Luminous Being tzframpton's Avatar
    Computer Details
    tzframpton's Computer Details
    Computer:
    HP Zbook
    Discipline
    Multi-disciplinary
    tzframpton's Discipline Details
    Occupation
    BIM Specialist
    Discipline
    Multi-disciplinary
    Details
    Full Virtual Design and Construction BIM services for the MEP engineering and construction industries.
    Using
    Revit 2018
    Join Date
    Mar 2006
    Location
    Dallas, TX - USA
    Posts
    9,058

    Default

    You can create this layer in your Template instead.
    Tannar Z. Frampton ™ | Frampton & Associates, Inc.

  3. #3
    Quantum Mechanic ReMark's Avatar
    Computer Details
    ReMark's Computer Details
    Operating System:
    Windows 7 Pro 64-bit
    Computer:
    Thinkmate
    Motherboard:
    Intel DX58SO2 LGA1366 X58
    CPU:
    Intel i7-960 Quad-core 3.20GHz 8MB cache
    RAM:
    12GB (3x4GB) PC3-106000 DDR3
    Graphics:
    nVidia Quadro K4200, 4GB GDDR5
    Primary Storage:
    150GB Velocipraptor 10,000 rpm
    Secondary Storage:
    none
    Monitor:
    Dell P24LLH - 24" wide screen LCD
    Discipline
    See details...
    ReMark's Discipline Details
    Occupation
    CAD Draftsman/Designer...chemical manufacturing.
    Discipline
    See details below.
    Details
    I work for a specialty chemical manufacturer. I do a little bit of everything from P&IDs to civil to architectural and structural.
    Using
    AutoCAD 2018
    Join Date
    Nov 2005
    Location
    Norwalk, CT USofA
    Posts
    46,506

    Default

    Could the OP be referring to already existing drawings?
    "I have only come here seeking knowledge. Things they wouldn't teach me of in college." The Police

    Eat brains...gain more knowledge!

    I'm now a full member of the Society for the Promotion of Mediocrity in CAD. Standards? We don't need no stinkin' standards! Take whatever advice I offer and do the opposite.

  4. #4
    Luminous Being tzframpton's Avatar
    Computer Details
    tzframpton's Computer Details
    Computer:
    HP Zbook
    Discipline
    Multi-disciplinary
    tzframpton's Discipline Details
    Occupation
    BIM Specialist
    Discipline
    Multi-disciplinary
    Details
    Full Virtual Design and Construction BIM services for the MEP engineering and construction industries.
    Using
    Revit 2018
    Join Date
    Mar 2006
    Location
    Dallas, TX - USA
    Posts
    9,058

    Default

    Good point ReMark.
    Tannar Z. Frampton ™ | Frampton & Associates, Inc.

  5. #5
    Junior Member
    Using
    AutoCAD 2014
    Join Date
    Jun 2016
    Posts
    18

    Default

    Yes it is with existing drawings.

  6. #6
    Luminous Being Dadgad's Avatar
    Using
    AutoCAD 2013
    Join Date
    Nov 2011
    Location
    At the confluence of worthlessness & invaluability
    Posts
    5,976

    Default

    Welcome to CADTutor James.

    A lisp could certainly do this, but you would do well to look at the following lisp from Lee Mac's wonderful website.

    http://www.lee-mac.com/layerdirector.html

    Thanks Lee!

    I have this placed in my start up lisp folder, so that it is always running in the background.
    Anybody who doesn't follow suit is doing themselves and their company a huge disservice.
    They are wasting time, energy and by extension money.

    As with most things in life, and especially in technical drawings, there is much to be said for consistency.
    Everything getting placed on the appropriate layers automagically, even if the layers don't exist, without the need to create or even monitor the current layer?
    What's not to like?
    Being accurate?

    Take it around the block, you'll be glad you did!
    Volume and repetition do not validate opinions forged in the absence of thought.

  7. #7
    Super Member
    Using
    not specified
    Join Date
    Dec 2004
    Location
    YUL
    Posts
    587

    Default

    Put this into your acaddoc.lsp file
    Code:
    (if (tblsearch "layer" "DATA EXTRACTION")
        (command "-layer" "s" "DATA EXTRACTION" "")
        (command "-layer" "m" "DATA EXTRACTION" "")
      )

  8. #8
    Junior Member
    Using
    AutoCAD 2014
    Join Date
    Jun 2016
    Posts
    18

    Default

    Thanks I will try that lisp tomorrow and let you know how it goes.
    I have used Lee Mac's lisps including the layer director. It is a great timesaver if you are designing stuff but for me I'm mainly manipulating architect or structural dwgs and extracting data for setting out. I'm very impressed by anyone who can produce a lisp routine because I haven't got a scooby how they work.....

  9. #9
    Junior Member
    Using
    AutoCAD 2014
    Join Date
    Jun 2016
    Posts
    18

    Default

    errrrrrr where is my acaddoc lisp file????

  10. #10
    Super Member
    Using
    not specified
    Join Date
    Dec 2004
    Location
    YUL
    Posts
    587

    Default

    Registered forum members do not see this ad.

    If you don't have one, take this one (attached) and place it in the support folder of your autocad installation
    Attached Files

Similar Threads

  1. Change Layer and Create New Layer If Needed LISP
    By PaulS00 in forum AutoLISP, Visual LISP & DCL
    Replies: 11
    Last Post: 1st Dec 2017, 06:02 pm
  2. Searching for a lisp to create a new layer coded by LEE
    By asos2000 in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 29th Oct 2012, 06:06 pm
  3. create layer lisp
    By MikeP in forum AutoLISP, Visual LISP & DCL
    Replies: 11
    Last Post: 27th Jul 2011, 04:06 pm
  4. Replies: 4
    Last Post: 5th Jan 2011, 07:39 pm
  5. Find and/or Create a Layer using LISP
    By FindAPath in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 13th Jul 2006, 10:04 pm

Tags for this Thread

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