See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Default layer color when opening drawings

  1. #1
    Active Member
    Join Date
    2009-07
    Posts
    95
    Login to Give a bone
    0

    Default Default layer color when opening drawings

    Is it possible to make it so that certain layers in AutoCAD are automatically set to a certain color when you open a drawing. I'm not talking about going into the Layer Properties Manager once in the drawing. Say I want the Defpoints layer to be color 30 automatically when I open a drawing, no matter what it was set to in that drawing prior to opening it. Is there a way to set that color automatically?

    Thanks in advance

  2. #2
    Certified AUGI Addict cadtag's Avatar
    Join Date
    2000-12
    Location
    Cairo - no, not Illinois
    Posts
    5,069
    Login to Give a bone
    0

    Default Re: Default layer color when opening drawings

    look into acaddoc.lsp, and S::STARTUP

  3. #3
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    1

    Default Re: Default layer color when opening drawings

    1+

    I use AcadDoc.lsp for this as well, by passing a list of lists who's elements represent the desired LAYER name, color, linetype, etc, where the Layers Collextion Object's vla-Add Method will get-or-create the resultant LAYER Object.

    Just be sure to also Pop the database to prevent being prompted to save changes.


    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  4. #4
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    1

    Default Re: Default layer color when opening drawings

    +2 on using acaddoc.lsp
    Keeping your templates layers and styles in order is important as well.

    Changing the color is fine, but remember the Defpoints layer is for AutoCAD dimension use only, not for anything else. Add a noplot work or construction line layer of your own if that's what you need.

    There have been links about Defpoints layer issues as long as the internet has been around.

    This link explains with references: http://forums.augi.com/showthread.ph...=1#post1266702

    This old one from Mike Perry references a few more links worth looking at: http://forums.augi.com/showthread.ph...l=1#post662501

  5. #5
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Default layer color when opening drawings

    Quote Originally Posted by beardking View Post
    ..... I want the Defpoints layer to be color 30 automatically when I open a drawing, no matter what it was set to in that drawing prior to opening it. .
    Here is a quick down and dirty way.
    Put this in your AcadDoc.lsp, presuming you're not already altering/defining S::Startup in there somewhere else.

    Code:
    (defun-q mystartup ()
      (vl-cmdf "._layer" "_N" "Defpoints" "_C" "30" "Defpoints" "")
    )
    (setq s::startup (append s::startup mystartup))

    Quote Originally Posted by BlackBox
    Just be sure to also Pop the database to prevent being prompted to save changes.
    I have to disagree on this. Personally, I want to be prompted if anything has changed, even if it's something I did.
    Last edited by rkmcswain; 2016-08-09 at 01:00 PM. Reason: edited
    R.K. McSwain | CAD Panacea |

  6. #6
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Default layer color when opening drawings

    Quote Originally Posted by rkmcswain View Post
    I have to disagree on this. Personally, I want to be prompted if anything has changed, even if it's something I did.
    I used to want that as well; back when I worked in a heavily standardized office, where the necessities were already addressed via single, monolithic template... And before I learned what preferences within said standard, I preferred to work with (i.e., layer "0" color, certain drawing-saved sysvars, etc).

    Today, I suffer the benefit of not having any such standard, where most of the folks here end up doing their own thang (despite myriad pleas), and subsequently elect to not want to be repeatedly prompted for save for just opening another's drawing (in adjacent project, when inheriting a project, etc).

    The user who authors AcadDoc.lsp should choose what best serves their needs (if not that of their users).

    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  7. #7
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Default layer color when opening drawings

    Quote Originally Posted by BlackBox View Post

    The user who authors AcadDoc.lsp should choose what best serves their needs (if not that of their users).

    Cheers
    Didn't mean to imply one way is right and the other wrong, just that there is a choice.
    R.K. McSwain | CAD Panacea |

  8. #8
    AUGI Addict jpaulsen's Avatar
    Join Date
    2002-04
    Location
    Colorado
    Posts
    2,020
    Login to Give a bone
    0

    Default Re: Default layer color when opening drawings

    Quote Originally Posted by BlackBox View Post
    Just be sure to also Pop the database to prevent being prompted to save changes.
    I have never heard this term and now I am curious. I started a new thread HERE so I don't hijack this one.

  9. #9
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Default layer color when opening drawings

    Quote Originally Posted by rkmcswain View Post
    Didn't mean to imply one way is right and the other wrong, just that there is a choice.
    No worries; while 'choice' is an inherent part of how I approach things, doesn't mean that I shouldn't reiterate/acknowledge from time to time.


    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  10. #10
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: Default layer color when opening drawings

    Using acaddoc.lsp without s::startup
    Code:
    (setq activedocument (vla-get-activedocument acadobject)
          LayerTable (vla-get-layers activedocument))
    (if (tblobjname "LAYER" "Defpoints")
    	(vlax-put-property (vla-item LayerTable "Defpoints") 'Color 30)
    	(vla-put-color (vla-add LayerTable "Defpoints") 30)
    )
    (setq activedocument nil LayerTable nil)

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 4
    Last Post: 2015-11-03, 02:24 PM
  2. Replies: 4
    Last Post: 2015-02-16, 07:53 PM
  3. AEC - default style - default layer - strange lines
    By chopsuey in forum ACA General
    Replies: 2
    Last Post: 2011-08-20, 01:21 AM
  4. Search text within drawings, without actually opening drawings
    By Animesh Kundu in forum AutoCAD General
    Replies: 3
    Last Post: 2008-02-29, 05:34 PM
  5. Set Default directory when opening drawings
    By pk.107812 in forum AutoCAD Customization
    Replies: 2
    Last Post: 2006-10-06, 04:00 PM

Posting Permissions

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