Our Friends: Leaflet Printing , Presented by: Talia Cad Software

Sign In

Subscribe

Subscribe to Daily Autocad.


Feb 14
Thursday
Autocad, Programming
Script Usage (To Edit Multiple Drawings Quickly)

Hi,

I had to edit 300 different blocks at the start of this week. For each drawing, I had to open them one by one, repeat same process again and then save and exit from them. Instead, I wrote a script to ease the process and AutoCAD do the process by itself for me. This allows me work on other drawings and it is like I didn’t do anything wrong at all. When I was working on my script, I remember you, dear bloggers, and wish to share it with you.

Like us, most of you probably have block libraries and drawing files of your own. One day if you have to edit a block through all of these drawings, this boring work costs a lot of time and also a lot of work. Moreover, opening a document and doing same processes again and again makes you careless and thus; you will probably start to make mistakes. Let me start to explain how to write and use scripts.

Firstly, we have to list the drawings that we want to edit. The list should contain drawing names each on a different line and should be listed downwards. You can think that, it can take very long time, ‘These scripts are supposed to fasten my drawing time’ etc. however; forming the list is very easy. Open ‘Run’ from Start Menu (Windows Operating System) and type “cmd” for DOS screen. Follow the steps below.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\orhan>cd \myDrawings

C:\myDrawings>dir *.dwg /b > list.txt

C:\myDrawings>_

The “dir *.dwg /b > list.txt” command will create the LIST.TXT file containing the drawing (DWG) files list. We’ll use MS-Word to convert our TXT file to AutoCAD SCR file.

Fig.1
Fig.1 Our TXT file

Fig.2
Fig.2 AutoCAD script file

You do not have to arrange the list by your hand; you can utilize a word macro. Open the list in MS Word and with using the macro; names of the drawings become; Open ‘Drawing Name’ and they are followed by the commands we want to run. You can download our sample from here.

Fig.3
Fig.3 – Our MS Word Macro

Run this macro in MS Word and save your file as TEXT. Don’t forget to name your file as SCR (e.g. “convert.scr”)

Before running the script, we are going to change one last thing. We have to define the directory that contains drawings as Support file search path since script contains only the drawing names. To do this, add the folder that contains the drawings into the Support file search path in the “tools->options” menu file tab in Autocad.

Fig.4
Figure 4

We can run the script now. Click the “Run Script” in the “tools” menu and select the script file. Autocad will do the rest. You can use lisp files with scripts to do more complicated editing.

Regards.

Related Files:

  • script.zip (contains MS Word and VB Class files)

Technorati Tags: , ,

Viewed 8,809 times so far... This week: 109 Today: 5 Latest: 4 July 2009, 22:59

Post Tags:

11 Responses to “ Script Usage (To Edit Multiple Drawings Quickly) ”
  1. Dear Mr. Pala,

    I am trying to draw an elliptical gear (in 2D) I made the ellipse in x and y axes and even I draw a teeth also to
    make it as Polar Array. So, the remaining tooth will be inscribed inside the ellipse. But I don’t have the option to select the ellipse to make array of tooth inscribed inside an ellipse. Could you please advice me how to make an elliptical spur gear in Autocad 2008? Thanks in advance.

  2. Thank you for sharing your autocad script. However, the link to script.zip does not work for me.

  3. Is it possible to send me your e-mail addres?
    I think that I have a more simple and faster methode to writing script files. Exuse me my english. I am dutch speaking.
    My methode is to working with Excel 5inside a macro.
    Everiting is in dutch, but it works very easely.
    Greetings,
    Pieter

  4. I think, It’s better to make MACRO with AutoCAD VBA instead of MS word.

  5. Hello Mr. Pala,

    Sir,
    I want to make pdf of a 100 dwg files from a local machin folder. These drg nos are listed in a excel sheet in the same folder. The drg nos are random( not like A001, A002,A003…….). All these drgs are of A4 size(297,210). I have to this acivity without opening the cad file. Do you have any script for this.

  6. Hello mister Pieter.

    It would be very gentle of you if you show us the way that you speak of.

    Thanks in advance.

  7. Hola.

    I have a another cuestion, Is there anyway to change the Length of 3d blocks in an automatizided wayLinking the scripts to the macros of excel?

  8. Zaibaa Ali

    Jul 30, 2008
    Reply

    I need to know how to export attribute values from a titleblock to an excel spreadsheet where I can edit them and them import them back to the autoCad file where they will be updated.
    Can anyone help me with the code?

  9. I HAVE LOTS OF TEXT TO EDIT.. ITS A SINGLE TEXT. HOW CAN I EDIT FASTER? COZ FOR NOW IM DOING 1 BY 1 CLICK JUST TO EDIT THE BUNCH OF SINGLE TEXT…IM USING 2009 AUTOCAD… ANY COMMAND THAT I CAN DO MULTIPLE TEXT EDIT? CAN YOU HELP ME?

  10. 2009 has a find and replace tool for text.  ^f – and follow the prompts.

  11. I would really love to use your script, however the link to download it is not working. Can you send it to me via e-mail or let me know how I could get it? I am affraid if I try to copy it off the image I may mess it up and render it useless.


Post a Comment



All content and source © 2008 Daily Autocad | News Plus wordpress theme brought to you by Zidalgo.