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

0 Members and 1 Guest are viewing this topic.

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Color of Attributes in blocks
« Reply #30 on: August 15, 2007, 07:39:10 PM »
what he is saying is you wouldn't need to add a 1 to the revised block name, as you are performing a 1:1 replacement...only me thinks you got that already
Be your Best


Michael Farrell
http://primeservicesglobal.com/

PHX cadie

  • Water Moccasin
  • Posts: 1902
Re: Color of Attributes in blocks
« Reply #31 on: August 15, 2007, 08:02:22 PM »
 :oops:
My mistake. I should keep the Y (as to replace) and have the same block name.

If I remove all the "1" behind the names, will all blocks in the code be inserted? It seems only the first one is, sect-marker.
Acad 2013 and XM
Back when High Tech meant you had an adjustable triangle

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Color of Attributes in blocks
« Reply #32 on: August 15, 2007, 08:24:39 PM »
post a copy of your code so we can see what you are doing
Be your Best


Michael Farrell
http://primeservicesglobal.com/

PHX cadie

  • Water Moccasin
  • Posts: 1902
Re: Color of Attributes in blocks
« Reply #33 on: August 15, 2007, 08:34:00 PM »
Code: [Select]
-insert SECT-MARKER=SECT-MARKER y [esc]
-insert det-MARKER=det-MARKER y [esc]
-insert BUB-DN-RIGHT=BUB-DN-RIGHT y [esc]
ATTSYNC N *

It should insert 3 blocks right?

Let me know if I start to get annoying 
Till this AM I didn't know how to post codes  :-)
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 #34 on: August 15, 2007, 08:44:11 PM »
phx,
forget the script for a moment .. what do you think this does ?
Code: [Select]
(DEFUN c:test ()
    (COMMAND "-insert" "CROSS2=c:/Alphabet Soup")(COMMAND)
    (COMMAND "-insert" "MARKER=c:/Alphabet Soup")(COMMAND)   
    (COMMAND "ATTSYNC" "N" "*")
)
« Last Edit: August 15, 2007, 08:46:59 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.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Color of Attributes in blocks
« Reply #35 on: August 15, 2007, 08:46:45 PM »
Then this ..

Code: [Select]
(DEFUN c:test ()
    (COMMAND "-insert" "SECT-MARKER=c:/SECT-MARKER")
    (COMMAND)
    (COMMAND "-insert" "det-MARKER=c:/det-MARKER")
    (COMMAND)
    (COMMAND "-insert" "BUB-DN-RIGHT=c:/BUB-DN-RIGHT")
    (COMMAND)
    (COMMAND "ATTSYNC" "N" "*")
)
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.

PHX cadie

  • Water Moccasin
  • Posts: 1902
Re: Color of Attributes in blocks
« Reply #36 on: August 15, 2007, 08:57:06 PM »
phx,
forget the script for a moment .. what do you think this does ?
Code: [Select]
(DEFUN c:test ()
    (COMMAND "-insert" "CROSS2=c:/Alphabet Soup")(COMMAND)
    (COMMAND "-insert" "MARKER=c:/Alphabet Soup")(COMMAND)   
    (COMMAND "ATTSYNC" "N" "*")
)

Thinkin:

lsp inserting 2 blocks, one that will be named "cross2" the other "marker" both coming from Alphabet Soup.dwg. 2 block, 2 names, same dwg
attsync: updates the attributes, by any name (*)

The 2nd should replace 3 existing block of the same name and update atts

maybe?
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 #37 on: August 15, 2007, 09:02:10 PM »
close,

In this case it replaces the DEFINITION of the blocks cross2 and marker with the contents of Alphabet Soup.dwg

Any inserts in the drawing are updated with the new definition

the Attsync updates the attributes.


Clear ?
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.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Color of Attributes in blocks
« Reply #38 on: August 15, 2007, 09:07:29 PM »
try this

Save this as Test-ReplaceBlock.lsp to c:\
Code: [Select]
(DEFUN c:Test-ReplaceBlock ()
    (COMMAND "-insert" "SECT-MARKER=c:/SECT-MARKER")
    (COMMAND)
    (COMMAND "-insert" "det-MARKER=c:/det-MARKER")
    (COMMAND)
    (COMMAND "-insert" "BUB-DN-RIGHT=c:/BUB-DN-RIGHT")
    (COMMAND)
    (COMMAND "ATTSYNC" "N" "*")
)

Save this as Batch_Stuff.lsp to c:\
Code: [Select]
(DEFUN C:batch_Stuff ()
;;;;;;;;;;;;;;;;;;;;;;;;;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
        (SETQ scrline (STRCAT "open"            " "
                              n2                " "
                              "(load\"c:Test-ReplaceBlock\")"
                              " "               "Test-ReplaceBlock"
                              " "               "qsave"
                              " "               "close"
                             )
        )
        (WRITE-LINE scrline scrfile)
        (PRINC)
    )
    (CLOSE scrfile)
    (COMMAND "script" "c:\\scrfile")
    (PRINC "\n***Batch complete.***")
    (PRINC)
)

put your revised blocks in c:\
in a new drawing, load and run Batch_Stuff.lsp
Select the folder with the drawing to change ( it will change ALL drawings)
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.

PHX cadie

  • Water Moccasin
  • Posts: 1902
Re: Color of Attributes in blocks
« Reply #39 on: August 15, 2007, 09:10:06 PM »
Yes, first example defines the blocks

How'd I do on second?

Sorry I have go (6PM). Hopefully no traffic, kiss the wife, kick the kids, back in 45 min. PLs don't think I'm leaving, this is important to me & Thanks
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 #40 on: August 15, 2007, 11:28:08 PM »
 :-o

I have one dwg to experiment with and test-replaceblock worked like a charm.

I can't wait to try the batch file. Just wanted you to know it took me 1 day to go through ~ 1/2 the stack I have to revise. Tomorrow the other 1/2 will take what?....30 seconds. I am in your debt.

Just curious, how long did it take to write batch_stuff?

I really need to learn this stuff.
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 #41 on: August 15, 2007, 11:34:44 PM »
I've run complicated batches at excess of 1000 / hour.

Work till morning tea time then take 4 days off ... well not quite, but you know what I mean ...

The batch_stuff file is essentially as posted in a previous post by deegeecee http://www.theswamp.org/index.php?topic=18200.msg221683#msg221683  with your stuff added ( one line only )

« Last Edit: August 15, 2007, 11:36:01 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.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Color of Attributes in blocks
« Reply #42 on: August 15, 2007, 11:50:31 PM »
Yes, first example defines the blocks

How'd I do on second?

Sorry I have go (6PM). Hopefully no traffic, kiss the wife, kick the kids, back in 45 min. PLs don't think I'm leaving, this is important to me & Thanks


Yes, and yes and pat the dog for me will you ?

I was in a long Messenger convo' (we use headsets for meetings) with a remote co-worker, so I'm pleased you were'nt waiting for me :-)
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.

PHX cadie

  • Water Moccasin
  • Posts: 1902
Re: Color of Attributes in blocks
« Reply #43 on: August 16, 2007, 12:49:04 PM »
9:48AM in Arizona........do believe its time for tea !   :wink:
Acad 2013 and XM
Back when High Tech meant you had an adjustable triangle

deegeecees

  • Guest
Re: Color of Attributes in blocks
« Reply #44 on: August 16, 2007, 01:15:18 PM »
Just curious, how long did it take to write batch_stuff?

I created that in 2002 out of necessity, took about an hour of trial/error. I have other forms of batch processes in VBA for plotting/zipping, and tons of ObjectDBX stuff. But sadly, I hardly get to play with them anymore.