Jump to content

Recommended Posts

Posted

I am quite busy, of course, like everyone, I have loads of work needing to get done so I thought I would make this quick post. Hopefully someone with the available time can help out! I basically need a simple routine to change colors from our old standards to our new standards.

 

I am sure it is most likely the simplest routine but if someone could post one and save me a little bit of time I would appreciate it.

 

An example would be layer: TEXT, which with our old standards for 30+ years has been the 'GREEN', we have now changed that and are using color '104' which is more of a turtle green, anyways thats what the boss wants so that's what the boss gets.

 

Currently when we open a drawing that was drawn, say, 10 years ago, it has all of our old layers and their respective old colors.

 

I just need a lisp that would run every time we open a drawing for editing or revisions that would automatically search for the layers and change their properties (colors)..

Posted

Did you want to batch process a folder of drawings?

Posted

I wouldn't see anything wrong with batch processing to expedite the whole ordeal. but we have so many drawings and sometimes do no revisit for months or years. Is there any way we can write something to just run at start up when opening an existing drawing to change the color for layer "TEXT" to "104". The "TEXT" layer is the layer that I really need to address because it dominates in our office standard templates.

Posted (edited)

Try this:

(defun c:clc ( / col ent lst )
   (setq lst
      '([highlight]
           ("TEXT"          104)
           ("YourLayerHere" 123)[/highlight]
       )
   )
   (foreach lay lst
       (if (setq ent (tblobjname "layer" (car lay)))
           (progn
               (setq ent (entget ent)
                     col (assoc 62 ent)
               )
               (entmod (subst (cons 62 (if (minusp (cdr col)) (- (cadr lay)) (cadr lay))) col ent))
           )
       )
   )
   (princ)
)

Populate the highlighted list with layer name & colours, matching the format shown.

Edited by Lee Mac
Posted

Much obliged guys that did the trick Lee. Blessings.

Posted
Much obliged guys that did the trick Lee. Blessings.

 

You're most welcome :)

Posted

I know that Lee has already helped you out with this,

but there are also a couple OOTB solutions for this, one being using the LAYTRANS command.

It is a great and I think underutilized command, perfect for situations like this.

Or you could use a .dws (drawing standards file) to do the same thing.

 

Glad Lee got you squared away, he usually does! :beer:

Posted

Lee how can I modify to add this piece to my startup routine? Remove DEFUN? Please assist. Thanks

Posted

Hey Gad can you elaborate on the LAYTRANS feature? I am checking it out now, any other details or steps to take to get it done that way?

Posted

Would the Standards Checker not take care of this?

Posted

Sorry ReMark I should have been more specific. I want to add it to my startup.lsp to execute automatically. I do not want to execute by typing a command in the command line. Thanks

Posted
Lee how can I modify to add this piece to my startup routine? Remove DEFUN? Please assist. Thanks

 

Hi tmelancon,

 

Follow these steps carefully:

 

  • Start a new blank drawing in AutoCAD

 

  • At the command-line, type
    (findfile "acaddoc.lsp")


 

  • If the above returns a filepath, navigate to the file in Windows Explorer and open the file.

 

  • If the above returns nil, open notepad and save a file to your AutoCAD Support Path with filename acaddoc.lsp
    (ensure 'Save as Type' is set to 'All Files').

 

  • Copy the code I have provided to your acaddoc.lsp file (new or existing).

 

  • On a new line after the code, type
    (c:clc)


 

  • Save the acaddoc.lsp file.

Done!

Posted

Thanks for the response Lee, I just needed the little piece of code at the end. I knew I was missing something. Props!

Posted
Hey Gad can you elaborate on the LAYTRANS feature? I am checking it out now, any other details or steps to take to get it done that way?

As it just so happens Shaan has posted a pretty comprehensive description of this feature today ...

http://www.cadtutor.net/forum/showthread.php?80447-AutoCAD-Layer-Translator-Saves-Time-Converting-Files-to-CAD-Standard-Layers.

 

If you load the lisp into your Startup Suite, per ReMark's suggestion it autoloads.

 

Standards Checker using your .dws file does the job too.

And clearly whatever Lee suggests will do it too, in spades!

Posted

Thanks Dadgad, the only thing I was missing was the line at the end where it actually executes the command following the code. Simple fix I was overlooking. Thanks all for everything. God bless!

  • 10 years later...
Posted

Namaste,

Can anyone please help me out with a lisp / command which identifies the bar diameter and changes the layer & color of the bars

For ex: 8mm green, 10mm blue, 12mm orange 16mm magenta, 20mm red, 25mm flourecent green.

 

Thank you for your valuable time.

Best regards,

PNP

 

PS: i am using another lisp to give the length of the each bar dia and multiply them manually by 2 (usually we will have 2 bars in a beam ) to get the overall length for boq purposes.

Posted

Are you able to post an example drawing to show the bars and diameters?

Posted (edited)

Did you post this somewhere else I am sure responded. 

 

You sure did 
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-change-layer-of-lines-based-on-bar-diameter/td-p/12690254

 

It is best to stick with one forum as it gets confusing what is the last answer as on other forum solutions have been offered.

 

So please anyone no posts here unless get real stuck.

Edited by BIGAL

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...