Author Topic: BLOCKS BYLAYER  (Read 2417 times)

0 Members and 1 Guest are viewing this topic.

dubb

  • Swamp Rat
  • Posts: 1105
BLOCKS BYLAYER
« on: April 20, 2005, 11:42:23 AM »
I CANT FIND THIS ONE HERE, BUT IS THERE A ROUTINE TO MAKE ALL BLOCKS IN A DRAWING TO  BYLAER?

daron

  • Guest
BLOCKS BYLAYER
« Reply #1 on: April 20, 2005, 11:43:27 AM »
Wouldn't filter blocks work or
(ssget "x" '((0 . "INSERT")))

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
BLOCKS BYLAYER
« Reply #2 on: April 20, 2005, 11:44:31 AM »
Do you mean the definitions or the instances? Or both?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

dubb

  • Swamp Rat
  • Posts: 1105
BLOCKS BYLAYER
« Reply #3 on: April 20, 2005, 11:46:36 AM »
THAT DIDNT SEEM TO WORK...I HAVE BLOCKS IN A DRAWING BUT WHEN I REFEDIT THEM THEY ARE NOT BYLAYER. I USE THIS DRAWING AS A BACKGROUND FOR ANOTHER DRAWING.

ronjonp

  • Needs a day job
  • Posts: 7529
BLOCKS BYLAYER
« Reply #4 on: April 20, 2005, 12:18:02 PM »
If bylayer you mean they do not inherit the color of the layer they are on...try this:

http://www.theswamp.org/phpBB2/viewtopic.php?p=47069#47069

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

dubb

  • Swamp Rat
  • Posts: 1105
BLOCKS BYLAYER
« Reply #5 on: April 20, 2005, 12:38:39 PM »
Quote from: ronjonp
If bylayer you mean they do not inherit the color of the layer they are on...try this:

http://www.theswamp.org/phpBB2/viewtopic.php?p=47069#47069

Ron


i dont think that one worked.i found this program off the internet

Code: [Select]
;****************************************************************************************
; UPDATE BLOCK COLOR (updblkcl.lsp)
; PRE-INSERTED BLOCK DEFINITION CLEAN-UP UTILITY
;
; This routine is especially usefull to redefine pre-inserted blocks whose
; entity colors need to be changed to BYLAYER.
;
;       This routine allows the user to update the color of
; all entities within a block to a single color (exam: color=BYLAYER)
; without the user having to explode the symbol.  By default the layer name of
; all entities are NOT changed. The routine changes the original
; definition of the block within the current drawing.
;
; To use this routine the user is asked to specify a single
; color to place all entities of a selected block(s).
;
; The user is next prompted to select one or more blocks to update. The routine
; then redefines all entities of the block to the color specified.
;
; When the user regenerates the drawing she/he will find that all
; occurances of the block have been redefined.  This is because the
; original definition of the block is changed!!!
;
;       by CAREN LINDSEY, July 1996
;****************************************************************************************
;

;INTERNAL ERROR HANDLER
(defun err-ubc (s) ; If an error (such as CTRL-C) occurs
; while this command is active...
(if (/= s "Function cancelled")
  (princ (strcat "\nError: " s))
)
(setq *error* olderr) ; Restore old *error* handler
(princ)
);err-ubc

(DEFUN C:BBL (/ BLK CBL CBL2 C ACL ALY NLY NCL)

(setq olderr *error* *error* err-ubc)
(initget "?")
        (while
(or (eq (setq C (getint "\nEnter new color number/<?>: ")) "?")
   (null C)
   (> C 256)
   (< C 0)
);or
(textscr)
(princ "\n                                                     ")
(princ "\n                 Color number   |   Standard meaning ")
(princ "\n                ________________|____________________")
(princ "\n                                |                    ")
(princ "\n                       0        |      <BYBLOCK>     ")
(princ "\n                       1        |      Red           ")
(princ "\n                       2        |      Yellow        ")
(princ "\n                       3        |      Green         ")
(princ "\n                       4        |      Cyan          ")
(princ "\n                       5        |      Blue          ")
(princ "\n                       6        |      Magenta       ")
(princ "\n                       7        |      White         ")
(princ "\n                    8...255     |      -Varies-      ")
(princ "\n                      256       |      <BYLAYER>     ")
(princ "\n                                               \n\n\n")
(initget "?")
);while


(PROMPT "\nPick blocks to update. ")

(SETQ SS (SSGET '((0 . "INSERT"))))
(SETQ K 0)
(WHILE (< K (SSLENGTH SS))
        (setq CBL (tblsearch "BLOCK" (CDR (ASSOC 2 (ENTGET (SETQ BLK (SSNAME SS K)))))))
        (SETQ CBL2 (CDR (ASSOC -2 CBL)))
(WHILE (BOUNDP 'CBL2)
(SETQ EE (ENTGET CBL2))

;Update layer value
  (SETQ NCL (CONS 62 C))
(SETQ ACL (ASSOC 62 EE))
(IF (= ACL nil)
(SETQ NEWE (APPEND EE (LIST NCL)))
(SETQ NEWE (SUBST NCL ACL EE))
);if
(ENTMOD NEWE)

(SETQ CBL2 (ENTNEXT CBL2))
);end while
(ENTUPD BLK)
(SETQ K (1+ K))
);end while
(setq *error* olderr)
(princ)
);end updblkcl
       




it seems to do the job.....

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
BLOCKS BYLAYER
« Reply #6 on: April 20, 2005, 01:37:00 PM »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.