Author Topic: Change the same details of a number of drawing titleblocks  (Read 9199 times)

0 Members and 1 Guest are viewing this topic.

hyposmurf

  • Guest
Change the same details of a number of drawing titleblocks
« on: October 20, 2005, 04:08:09 PM »
There are about 500 drawings that have been produced, weve been asked to change the titleblocks details.Ive so far come with the idea of creating  new block with a new name TITLEMS,the original is called TITLE say.Im thinking of then doing the following:

Open the drawing with title block to be changed
Insert the new title block TITLEMS and then delete it(somewhere on the swamp I think there was a lisp to insert and delete a block).Ive found the following LISP

Code: [Select]
; Delete a specified block(s) and return the number deleted.
; created by: Lamar Crowe

(Defun C:DELBLK (/ N A E)
    (prompt "\nÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»")
    (prompt "\nº     This routine will delete a specified block          º")
    (prompt "\nº  from the current drawing regardless of how many        º")
    (prompt "\nº  are nested in the drawing.                             º")
    (prompt "\nº                                                         º")
    (prompt "\nº     The speed at which the block is deleted is          º")
    (prompt "\nº  determined by the size of the drawing, so be patient.  º")
    (prompt "\nÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ")
        (Setq N (Strcase (Getstring "\n\TITLEMS")))
        (Setq A 0)
        (Setq E (Entnext))
            (While E
              (If (= N (cdr (Assoc 2 (Entget E))))(progn
                    (Entdel E)
                    (Setq A (1+ A))
                    )
              )
         (Setq E (Entnext E)))
    (Prompt "\n")
    (prompt (Itoa A))
    (prompt " blocks deleted"\n)
    (Princ)
)

but it just keeps throwing up,the same error:
 0; error: too many arguments

Can anyone suggest what I should do for this part?


Once Ive sussed out the delete block on insertion part Im intending to run the following macro:
^C^C-BLOCKREPLACE;TITLE;TITLEMS;;
This will replace the block with the one I wnat and leave the attributes in tact.Final thing I intend to do is maybe include the whole sequence of events in a script for all the drawings.

V-Man

  • Bull Frog
  • Posts: 343
  • I exist therefore I am! Finally Retired!
Re: Change the same details of a number of drawing titleblocks
« Reply #1 on: October 20, 2005, 04:15:43 PM »

If the new titleblock is the same name you can use this snippet to redefine (reinsert) with the new changes.

Code: [Select]
(defun c:rtb ()
(command "-insert" "TITLEMS=""Your path here""/TITLEMS")(command)
(command ".regen")
(princ)
)
AutoCAD 9 - 2023, AutoCADMap 2008 - 2010, Revit 2012 - 2022, Autocad Civil 3D 2023

deegeecees

  • Guest
Re: Change the same details of a number of drawing titleblocks
« Reply #2 on: October 20, 2005, 04:17:47 PM »
Try this for your batch, its a bit dated but it works. I'm working on some batch stuff with ObjectDBX, but haven't had the time to complete em.
BatchAnything

hyposmurf

  • Guest
Re: Change the same details of a number of drawing titleblocks
« Reply #3 on: October 20, 2005, 05:18:52 PM »
Thanks to you both I tried your batch anything was a bit confused as to how it al works and then received the following error when I selected my new block:
Command: (load"BATCH_STUFF") ; error: LOAD failed: "BATCH_STUFF"
Command: BATCH_STUFF Unknown command "BATCH_STUFF".  Press F1 for help.#
I tried another way with the lisp and this eems to work to,jjust so long as the new titleblock is in the support directory.

(defun c:rtb ()
(command "-insert" "TITLEMS=")(command)
(command ".regen")
(princ)
)


deegeecees

  • Guest
Re: Change the same details of a number of drawing titleblocks
« Reply #4 on: October 20, 2005, 05:24:25 PM »
Sorry, I didn't comment anything in that. The "BATCH_STUFF" is another lisp proggy with all the things you'd like to do with your drawings. So, with that said, create a lisp routine that does what you want, and call it "batch_stuff", or change the name of BATCH_STUFF in batch_anything.lsp to match the one you make. Clear as mud?

deegeecees

  • Guest
Re: Change the same details of a number of drawing titleblocks
« Reply #5 on: October 20, 2005, 05:33:10 PM »
Try this

- Move all files to work on in a single (temporary) directory. They should be the ONLY files in it.
- Create a file called      batch_stuff.lsp    and put this in it:
Code: [Select]
(defun c:rtb ()
(command "-insert" "TITLEMS=")(command)
(command ".regen")
(princ)
)
- Save the file
- From AutoCad command, type:
Code: [Select]
(load"batch_anything")- Then type: batch_anything, and a dialog box will appear
- Select ANY DWG FILE in the directory you placed the drawings in, and select "Open"
- Watch the show

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: Change the same details of a number of drawing titleblocks
« Reply #6 on: October 21, 2005, 12:48:01 AM »
Hi Hyposmurf, I was bored tonight and this seemed like a neat challenge.
I'm attaching a zip file with a lisp I just whipped up that should do what you need. Please try it on some COPIES of your actual files first  :-) ... I don't want to be responsible for blowing up your originals!
Since I'm using ObjectDBX and any save done with it loses the Drawing preview, I'm using a new little helper app that Tony Tanzillo put together that preserves the preview. However, to use it the ARX file MUST be registered with Acad....just follow the intructions in the included Zip file. This only needs to be done once per Acad installation. Here is the header info from my lisp:
Quote
;|Routine to replace ALL entities of a block found in remote drawings, with the exception
  of Attributes. This is great for Title blocks whose general appearance has changed, but
  the attributes remain unchanged. Works with R2004-2006 only at this time.
  To use, first edit (or insert) the block in a drawing to be as desired. Next, make sure
  NO other drawings are open. Then run this routine "replace-blocks" and follow the prompts.
 
  Note that this utilizes an ARX program that Tony Tanzillo was nice enough to post on the
  Autodesk newsgroup. This ARX MUST be placed in the Acad support path and registered once
  per Acad installation or an error will occur...follow the directions in the supplied ZIP
  file to do this.

  This routine was written as an excercise to test a number of things. It may (read "probably
  does") contain errors and I may try to address those. Any user that wishes to use this does
  so knowing this, and if any errors crop up they can either attempt to correct them or let the
  author know and he will do what he can to work with them. And to make it even more exciting, I
  don't include an error handler!

  Jeff Mishler, October 2005
  miff@sonic.net or Jeff_M at www.theSwamp.org
|;
Enjoy! Oh, and this should process all 500 of those drawings many times faster than anything that opens & closes them in the Acad editor.......

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Change the same details of a number of drawing titleblocks
« Reply #7 on: October 21, 2005, 02:57:43 AM »
Quote
... and this seemed like a neat challenge.

When I saw the ARX from Tony I thought of you ..
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: Change the same details of a number of drawing titleblocks
« Reply #8 on: October 21, 2005, 03:14:24 AM »
ohhhhh, that is SO nice. ! Great job Jeff.
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.

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: Change the same details of a number of drawing titleblocks
« Reply #9 on: October 21, 2005, 10:24:35 AM »
Thanks, Kerry!
And now Tony has reposted the Thumbnailer with a version for 2000-2002. I'll update the code in a little while to work with versions 2000-2006.
 
*Update - I've run out of time for now and I'm taking the next week off for an elk hunting trip. If no one modifies this to work in the earlier versions before I get back, I'll take care of it then.
« Last Edit: October 21, 2005, 04:46:39 PM by Jeff_M »

deegeecees

  • Guest
Re: Change the same details of a number of drawing titleblocks
« Reply #10 on: October 21, 2005, 10:38:17 AM »
I know its probably a bit after the fact but, this is the reason we xref our titleblocks. Copyright dates, logos, general cosmetic issues are updated automatically. If we need to save a drawing for legacy purposes, we just bind the xref.

Just something to chew on.  :evil:

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: Change the same details of a number of drawing titleblocks
« Reply #11 on: October 21, 2005, 10:58:07 AM »
While I'll admit that Xrefs may be benificial to some for this purpose, I still prefer to use my old block w/attributes. I do this because 1.) I have enough layers/xref layers already....I don't want more just for the TB. 2.) In the past 18 years my Title Block has changed exactly twice.....not enough to warrant worrying about future changes.

Oh, and the routine I posted could be used for any block, not just TB's.... ;-)

sinc

  • Guest
Re: Change the same details of a number of drawing titleblocks
« Reply #12 on: October 21, 2005, 12:31:20 PM »
Try this

- Move all files to work on in a single (temporary) directory. They should be the ONLY files in it.
- Create a file called      batch_stuff.lsp    and put this in it:
Code: [Select]
(defun c:rtb ()
(command "-insert" "TITLEMS=")(command)
(command ".regen")
(princ)
)
- Save the file
- From AutoCad command, type:
Code: [Select]
(load"batch_anything")- Then type: batch_anything, and a dialog box will appear
- Select ANY DWG FILE in the directory you placed the drawings in, and select "Open"
- Watch the show
Keep in mind that with something like this you should probably also do an "attsync", at least if your title block uses attributes.

I tried using attributed XREF's for the title block once, but couldn't figure out how to ATTSYNC the XREF, so we continue using an attriubted block.  Anyone know if it's possible to ATTSYNC an attributed XREF?

deegeecees

  • Guest
Re: Change the same details of a number of drawing titleblocks
« Reply #13 on: October 21, 2005, 12:46:00 PM »
Quote
I tried using attributed XREF's for the title block once, but couldn't figure out how to ATTSYNC the XREF, so we continue using an attriubted block.  Anyone know if it's possible to ATTSYNC an attributed XREF?

I don't xref the "Text/Info" portion of the titleblock, just the portion that stays constant. The "Text/Info" is inserted as a block w/attributes.

hyposmurf

  • Guest
Re: Change the same details of a number of drawing titleblocks
« Reply #14 on: October 22, 2005, 08:20:21 AM »
Jeff I finally got some time to sit down and use your application and it seems I must be screwing something up somewhere. :-) Ive added that arx file to my support path & re opened AutoCAD.Ive opened one of the drawings that needs the title block to be altered,loaded my lisp and entered the defun.I enter the block name to change and then go to select the folder all my drawings are in.The following error is then displayed:
; error: Automation Error. Problem in loading application
Command:
Ive tried different combinations,such as opening my modified titleblock,selecting the folders containing the modified titleblock and get the same problem.Oh yeh and thanks for what you've offered so far. :-)
« Last Edit: October 23, 2005, 08:40:52 AM by hyposmurf »