Author Topic: Change Multiple dwgs with a scripts or something  (Read 7699 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Change Multiple dwgs with a scripts or something
« on: July 21, 2006, 03:04:38 PM »
How could i chage a text style and dim style in multiple dwgs (1,000) dwgs , without opening eachone of the them?

Thanks!
Civil3D 2020

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Change Multiple dwgs with a scripts or something
« Reply #1 on: July 21, 2006, 03:08:43 PM »
with a script.  Although the script would be opening each one and saving it
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Yoland

  • Guest
Re: Change Multiple dwgs with a scripts or something
« Reply #2 on: July 21, 2006, 03:11:09 PM »
Hi,

Look for in autodesk.com the program Scriptpro.

Bye
Yolanda

M-dub

  • Guest
Re: Change Multiple dwgs with a scripts or something
« Reply #3 on: July 21, 2006, 03:14:16 PM »
It would be something like:

OPEN C:\DIRECTORY\FILENAME1.DWG -STYLE;ROMANS;ROMANS.SHX;;;;;;;qsave;close
OPEN C:\DIRECTORY\FILENAME2.DWG -STYLE;ROMANS;ROMANS.SHX;;;;;;;qsave;close
...And so on...

First, you need to go into one of your drawings and make sure you can do everything you need to do from the command prompt.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Change Multiple dwgs with a scripts or something
« Reply #4 on: July 21, 2006, 03:29:40 PM »
Lets say I do not have a text style created and I want to change textstyle1 to be textstyle2.

I want to change my arrowheads on dimstyle to be from what it is a closed arrowhead to another arrow head.

Thats it.

and I have several drawings.

So setup a script and just drag each one to it or can i batch do a directory / folder?

thxs
Civil3D 2020

M-dub

  • Guest
Re: Change Multiple dwgs with a scripts or something
« Reply #5 on: July 21, 2006, 03:47:41 PM »
Lets say I do not have a text style created and I want to change textstyle1 to be textstyle2.
I'm pretty sure all you would need is something like this:
OPEN C:\DIRECTORY\FILENAME1.DWG -STYLE;ROMANS;ROMANS.SHX;;;;;;;qsave;close
OPEN C:\DIRECTORY\FILENAME2.DWG -STYLE;ROMANS;ROMANS.SHX;;;;;;;qsave;close

I want to change my arrowheads on dimstyle to be from what it is a closed arrowhead to another arrow head.

I'm trying to figure that one out right now... ( DIMBLK? )

and I have several drawings.

So setup a script and just drag each one to it or can i batch do a directory / folder?

You create one script file with every drawing's path in it, then start AutoCAD, type SCRIPT and select the .scr file you created.  Then all you have to do is sit and watch AutoCAD work away.  It's actually kind of fun for a while.

M-dub

  • Guest
Re: Change Multiple dwgs with a scripts or something
« Reply #6 on: July 21, 2006, 03:49:04 PM »
If you're new to scripts though, I would suggest starting with a few test drawings (copies) before you start overwriting hundreds of them.

Bob Wahr

  • Guest
Re: Change Multiple dwgs with a scripts or something
« Reply #7 on: July 21, 2006, 03:54:39 PM »
creating the style is easy, changing the text from one style to another is harder to do commandline.  Is it possible just to change textstyle1 to the properties that you want?  If not, the best way would be to use a lisp statement to select all of the text that is style textstyle1, then you can use the CHANGE command to change the style.

For the arrowheads, I would cover all of your bases for different ways that the dimensions could be set up and set DIMBLK, DIMBLK1, and DIMBLK2 to your arrow block, then do a DIM UPDATE ALL

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Change Multiple dwgs with a scripts or something
« Reply #8 on: July 21, 2006, 04:35:40 PM »
i would do it through VBA cuz its easier.  I have example code to shange all text to Romans and change dims
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Change Multiple dwgs with a scripts or something
« Reply #9 on: July 21, 2006, 04:36:01 PM »
Code: [Select]
Public Sub ChangeTextToRomans()
  Dim objSelected As Object
  Dim objTxt As AcadText
  Dim objstyle As AcadTextStyle
  Dim objLayer As AcadLayer
  Dim objSelSet As AcadSelectionSet
  Dim intAnswer As Integer
  On Error GoTo ErrControl

Set objstyle = ThisDrawing.TextStyles.Add("ROMANS")
objstyle.fontFile = "romans.shx"
objstyle.Width = 1#
Set objstyle = ThisDrawing.TextStyles.Add("TEP-TITLE")
objstyle.fontFile = "C:\WINNT\Fonts\ARIAL.TTF"
objstyle.Width = 0.85

  Set objSelSet = ThisDrawing.SelectionSets.Add("Text")
  objSelSet.Select acSelectionSetAll
    For Each objSelected In objSelSet
        If TypeOf objSelected Is AcadText Then
        Set objTxt = objSelected
            If UCase(objTxt.StyleName) <> "ROMANS" Then
            objTxt.StyleName = "ROMANS"
            objTxt.ScaleFactor = 1#
            Else
            objTxt.ScaleFactor = 1#
            End If
        End If
    Next
  ThisDrawing.SelectionSets.Item("Text").Delete
  ThisDrawing.Application.Update
Exit_Here:
  Exit Sub
ErrControl:
  MsgBox Err.Description
End Sub
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Change Multiple dwgs with a scripts or something
« Reply #10 on: July 21, 2006, 04:36:58 PM »
Do the same for your dims
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Bob

  • Guest
Re: Change Multiple dwgs with a scripts or something
« Reply #11 on: July 23, 2006, 06:41:00 AM »
Great code CmdrDuh.

I am also a bit new to scripts. Can you invoke a VBA routine through script?

Bob Wahr

  • Guest
Re: Change Multiple dwgs with a scripts or something
« Reply #12 on: July 23, 2006, 09:40:51 AM »
Absolutely.  Just paste the code into the VBAIDE save it as a dvb, then use VBARUN in your script to run it.  Although I would still set the dimblk* variable and do a dim update for them.

Bob

  • Guest
Re: Change Multiple dwgs with a scripts or something
« Reply #13 on: July 24, 2006, 03:06:16 AM »
Thanks Bob,

I'll try it at work.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Change Multiple dwgs with a scripts or something
« Reply #14 on: July 24, 2006, 10:53:46 AM »
OK...I am dumb... can not figure this out... I am trying to make this alot easier on me...

trying to create a script which will do the following:

-change text style l75 from simplex to arial

-replace words of CONCRETE TO CONC.

-replace words of PAVEMENT to PVMT.

- Paste Block or insert block

- Plot to a certain printer with pen settings.


----------------

thats it...

any ideas?

thanks!
Civil3D 2020