Jump to content

Batch block(s) replace in multiply dwgs lisp?


Recommended Posts

Posted

As per title: is anything like that exist somewhere?

We got tons of dwgs with block "Certified as build" with sign and date printed to .pdf.

Now customer request this stamp (block) to be red colour (was black). We can do it manually but time is a factor against us. Block got not any attributes. Any suggestion? Thank you.

Posted

simple way just use a script

 

Open dwg1 do the same steps now as manual qsave close

Open dwg2 do the same steps now as manual qsave close

just write down the steps into notepad

 

There probably is a batch editor here check Lee-mac.com site he possibly has a good block editor

This may do what you want

(vl-load-com) 
 (setq adoc (vla-get-activedocument (vlax-get-acad-object))) 
 (vla-startundomark adoc) 
 (vlax-for block (vla-get-blocks adoc) 
   (if   (not (wcmatch (strcase (vla-get-name block) t) "*_space*")) ; change *_space* to name of your block 
     (vlax-for   ent block 
  (vla-put-color ent 0) ; red is color 1 
  (vla-put-linetype ent "Bylayer") ; remove this line
  (vla-put-lineweight ent aclnwtbyblock) ; remove this line
  ) ;_ end of vlax-for 
     ) ;_ end of if 
   ) ;_ end of vlax-for 
 (vla-regen adoc acactiveviewport) 
 (vla-endundomark adoc) 
 (princ) 

 

script open dwg1 (load "'codeabove.lsp") qsave close

Posted

Mdbdesign, use the Autolisp below to create the script containing the DWGs in a directory. Modify the two lines that appear ";

 

(DEFUN C:MODDWG ()
;
(SETQ DIRETORIO "D:\\PERFIS2000\\FERMAX\\GOLD") ;<<<<<<<<<<
;
(SETQ DWGLISTA (VL-DIRECTORY-FILES DIRETORIO "[url="file://\\*.DWG"]\\*.DWG[/url]"))
(SETQ DWGLISTA (ACAD_STRLSORT DWGLISTA))
(SETQ ARQW (OPEN "C:\\$LISTA.SCR" "w"))
(SETQ II 0)
(REPEAT (LENGTH DWGLISTA)
 (SETQ DWGNOME (NTH II DWGLISTA))
 (SETQ DWGNOME (SUBSTR DWGNOME 1 (- (STRLEN DWGNOME) 4)))
 (SETQ DWGNOMEX (STRCAT DIRETORIO "\\" DWGNOME))
 (PRINT DWGNOMEX)
 ;
 (SETQ TEXTO (STRCAT "OPEN " DWGNOMEX " ZOOM _E QSAVE CLOSE")) ;<<<<<<
 ;
 (WRITE-LINE  TEXTO ARQW) 
 (SETQ II (+ II 1))
)
(CLOSE ARQW)
(COMMAND "_ZOOM" "_E")
;
(COMMAND "SCRIPT" "C:\\$LISTA.SCR")
;
(PRINC)
)

 

OK.

Posted
As per title: is anything like that exist somewhere?

We got tons of dwgs with block "Certified as build" with sign and date printed to .pdf.

Now customer request this stamp (block) to be red colour (was black). We can do it manually but time is a factor against us. Block got not any attributes. Any suggestion? Thank you.

Hi

Grab this lisp that is very quickly gathered from codes above

http://dl.dropbox.com/u/18024145/BATCH_FELIX_And_Co.LSP

Posted

Thank you all, I will try it on weekend. Too busy finishing year end project.

Be back. Thank you again.

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