Author Topic: Color of Attributes in blocks  (Read 8865 times)

0 Members and 1 Guest are viewing this topic.

PHX cadie

  • Water Moccasin
  • Posts: 1902
Re: Color of Attributes in blocks
« Reply #15 on: August 15, 2007, 11:09:30 AM »
Whoa   :-o

All you guys are just too darn good!

I am in awe, THANKS!
Acad 2013 and XM
Back when High Tech meant you had an adjustable triangle

deegeecees

  • Guest
Re: Color of Attributes in blocks
« Reply #16 on: August 15, 2007, 11:20:04 AM »
If you want to run one of the examples in a batch, this works fairly well. Just need to add the commands where it it says "COMMANDS FOR BATCH GO HERE".

Code: [Select]
(DEFUN C:batch_anything ()

;;;;;;;;;;;;;;;;;;;;;;;;;Select directory to be processed

(setq dfil (getfiled "Select A File In The Directory You Want To Batch Process" "p:/" "dwg" 0))
(setq wutdir (vl-filename-directory dfil))
(setq wutfiles (vl-directory-files wutdir "*.dwg"))

(setq scrfile (open "c:\\scrfile.scr" "w"))
(close scrfile)
(setq scrfile (open "c:\\scrfile.scr" "a"))

(foreach n wutfiles
(setq n2 (strcat "\""wutdir "\\" n "\""))
(setq n2 (vl-string-translate "\\" "\\" n2))
(setq scrline (strcat "open" " " n2 " " "(load\"batch_core\")" " " "batch_insert" " " "qsave" " " "close"));;;;;;;COMMANDS FOR BATCH GO HERE
(write-line scrline scrfile)
(princ)
)

(close scrfile)
(command "script" "c:\\scrfile")

(princ "\n***Batch complete.***")
(princ)


);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DEFUN

ronjonp

  • Needs a day job
  • Posts: 7526
Re: Color of Attributes in blocks
« Reply #17 on: August 15, 2007, 11:31:14 AM »
This will put all attributes to color bylayer (if the layer is not locked) and update the block definition.

Spawned from:
http://www.theswamp.org/index.php?topic=16987.msg206466#msg206466

Code: [Select]
(defun c:rjp-att2bylayer (/ blkobj lays ss)
  (setq lays (vla-get-layers
       (vla-get-activedocument (vlax-get-acad-object))
     )
ss   (ssget "x" '((0 . "INSERT") (66 . 1)))
  )
  (if ss
    (progn
      (setq ss
     (mapcar 'vlax-ename->vla-object (mapcar 'cadr (ssnamex ss)))
      )
      (mapcar
'(lambda (b)
   (if (eq (vla-get-lock (vla-add lays (vla-get-layer b)))
   :vlax-false
       )
     (progn
       (mapcar
'(lambda (a)
    (vla-put-color a 256)
  )
(vlax-invoke b 'getattributes)
       )
       (vlax-for blkobj (vla-item
  (vla-get-blocks
    (vla-get-activedocument
      (vlax-get-acad-object)
    )
  )
  (vla-get-name b)
)
(mapcar
   '(lambda (c)
      (vla-put-color blkobj 256)
    )
   (vlax-invoke b 'getattributes)
)
       )
     )
     (princ (strcat "\n Block "
    (vla-get-name b)
    " on locked layer "
    (vla-get-layer b)
    " not updated..."
    )
     )
   )
)
ss
      )
    )
  )
  (princ)
)

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CADaver

  • Guest
Re: Color of Attributes in blocks
« Reply #18 on: August 15, 2007, 11:52:01 AM »
If you want to run one of the examples in a batch, this works fairly well. Just need to add the commands where it it says "COMMANDS FOR BATCH GO HERE".
ahh cool, that's a keeper

A long time ago I built a "dummy" profile with a "dummy" menu that had nothing in it and a "dummy" MNL.  When I need to batch something, I'll modify the "dummy" MNL for the functions (including "save" and "close"), then just open a directory worth of files.

deegeecees

  • Guest
Re: Color of Attributes in blocks
« Reply #19 on: August 15, 2007, 12:09:16 PM »
ahh cool, that's a keeper

Thanks. With all the support I've gotten over the years, I figured I could give something back once in a while (although my expertise is basically hack mode).

PHX cadie

  • Water Moccasin
  • Posts: 1902
Re: Color of Attributes in blocks
« Reply #20 on: August 15, 2007, 12:42:25 PM »
OK, I'm back in this because you guys are having way too fun  :-D

Problem 1 I did not mention:
Bylayer will not work because all the text attributes are forced yellow

Problem 2:
the sections have various names, ie bubble-left-up, bubble-up-left, etc, prob ~6 names for the sections bubbles depending on orientation.
So, will a script file with multiple file names work?

-insert oldblock=newblock
-insert oldblock1=newblock1
-insert oldblock2=newblock2 y [esc]
attsync oldblock


Don't think(?) using layers will work, (because they are blocks). Need to experiment w/ that one.

Right now I'm refedit, attsync, which knocks out 4-6 at a time, (tremendous help). You guys could prob use batchs/scripts and get this done in an hour.Its my lack of knowledge
 :oops:
Acad 2013 and XM
Back when High Tech meant you had an adjustable triangle

CADaver

  • Guest
Re: Color of Attributes in blocks
« Reply #21 on: August 15, 2007, 12:51:41 PM »
Mulitple redefines should work a breeze in a script or a function
ATTSYNC will work with wildcards so ATTSYNC N * will sync 'em all.

When you redefine the block, move the attributes to a layer and make it whatever color you want.  ATTSYNC should overide the forced color.
« Last Edit: August 15, 2007, 12:52:53 PM by CADaver »

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Color of Attributes in blocks
« Reply #22 on: August 15, 2007, 12:57:14 PM »
ATTSYNC should overide the forced color.

It will ....
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

ronjonp

  • Needs a day job
  • Posts: 7526
Re: Color of Attributes in blocks
« Reply #23 on: August 15, 2007, 01:12:17 PM »
Quote
Problem 1 I did not mention:
Bylayer will not work because all the text attributes are forced yellow

Then your attributes were put on a wrong layer? If you run my routine, the attributes color should match the color of the layer they reside on...

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

PHX cadie

  • Water Moccasin
  • Posts: 1902
Re: Color of Attributes in blocks
« Reply #24 on: August 15, 2007, 01:45:35 PM »
Hate agrue w/ Mr. Computer, but....

This is my script:
Code: [Select]
-insert SECT-MARKER=SECT-MARKER1 y [esc]
attsync SECT-MARKER


This is Mr. Computers reply:

Code: [Select]
-Command: _SCRIPT
Enter script file name <H:\Client\Phoenix_PHXC\7360A10\DWGS\XREF
Files\91-S-017-EPSSECS.scr>: "C:\Greg\MISC\LISP\UP05.SCR"

Command: -insert Enter block name or [?] <SECTION-MARKER1>:
SECT-MARKER=SECT-MARKER1
"SECT-MARKER1.dwg": Can't find file in search path:
  C:\Documents and Settings\GDavis\My Documents\ (current directory)
  H:\Client\Phoenix_PHXC\7360A10\DWGS\XREF Files\
  L:\AutoCAD 2005\R16.1\enu\Support\
  L:\
  L:\BLOCKS\Symbol Manager\
  C:\Documents and Settings\carollo\Application Data\Autodesk\AutoCAD
2005\R16.1\enu\support\
  C:\Program Files\AutoCAD 2005\support\
  C:\Program Files\AutoCAD 2005\fonts\
  L:\FONTS\
  C:\Program Files\AutoCAD 2005\help\
  C:\Program Files\AutoCAD 2005\express\
  C:\Program Files\AutoCAD 2005\support\color\
  L:\LISP\
  L:\VBA\
  C:\Greg\MISC\
  C:\Greg\MISC\Bitmaps\
  C:\Greg\MISC\LISP\
  C:\Greg\
  L:\AutoCAD 2005\R16.1\enu\Support\Color\
  C:\Program Files\AutoCAD 2005\
*Invalid*

  C:\Greg\                                                                            .......yes it is
  H:\Client\Phoenix_PHXC\7360A10\DWGS\XREF Files\       .......yes it is


 :|  (but is my first attempt)

Acad 2013 and XM
Back when High Tech meant you had an adjustable triangle

PHX cadie

  • Water Moccasin
  • Posts: 1902
Re: Color of Attributes in blocks
« Reply #25 on: August 15, 2007, 02:13:11 PM »
 :oops:

<Note to self use correct file name>

 :oops:

Sorry,
Now to really screw things up  :evil:
Acad 2013 and XM
Back when High Tech meant you had an adjustable triangle

PHX cadie

  • Water Moccasin
  • Posts: 1902
Re: Color of Attributes in blocks
« Reply #26 on: August 15, 2007, 05:32:19 PM »
No mass damage yet
It seems as though:

Code: [Select]
-insert SECT-MARKER=SECT-MARKER1 y [esc]
-insert det-MARKER=det-MARKER1 y [esc]
-insert BUB-DN-RIGHT=BUB-DN-RIGHT1 y [esc]
ATTSYNC N *

only inserts the first line (SECT-MARKER). It asks for a y scale and insertion point and inserts only the revised SECT-MARKER.
What am I missing?
Acad 2013 and XM
Back when High Tech meant you had an adjustable triangle

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Color of Attributes in blocks
« Reply #27 on: August 15, 2007, 05:59:40 PM »
you do know that both blocks can have the same name, don't you ?

(command "-insert" "SECT-MARKER=c:/SECT-MARKER" )(command)


so you don't need the "Y"


« Last Edit: August 15, 2007, 06:13:43 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Color of Attributes in blocks
« Reply #28 on: August 15, 2007, 06:49:42 PM »
Kerry, if the user wasn't around say prior to R10 they are not aware of the Block=Block command
Be your Best


Michael Farrell
http://primeservicesglobal.com/

PHX cadie

  • Water Moccasin
  • Posts: 1902
Re: Color of Attributes in blocks
« Reply #29 on: August 15, 2007, 07:33:58 PM »
you do know that both blocks can have the same name, don't you ?

(command "-insert" "SECT-MARKER=c:/SECT-MARKER" )(command)

so you don't need the "Y"

Yes, in the code I put a number 1 behind each revised block name. Is that what youre refering to?

I dont understand about the "Y". <edit....now I see it>
Acad 2013 and XM
Back when High Tech meant you had an adjustable triangle