Jump to content

Question about using script in Autocad LT 2014


LEPAT

Recommended Posts

Good day,

 

I have multiple drawings to edit. The good thing is, I just need to edit some texts. The bad thing is, there are thousands of files that need to change. So, my question is, how to edit some specific texts using script for all drawings at once? For example, I'm using script for plotting because it can plot multiple drawings at once without user to open drawings to plot one by one. This is one of my script file for plotting :

 

OPEN C:\Users\ME\Desktop\Drawing-01.DWG

PLOT

 

 

 

_QSAVE

CLOSE

 

What I want to know is how to use DDEDIT command in script to change some texts in Autocad? I see some of people in this forum suggest using LISP but I don't even know how to use that, & top of that, my Autocad LT doesn't recognize that specific command. I don't know what other option I can use, but script file seems like the best option for me. Note that I'm not quite familiar with script, still new about this. Thanks!

 

*sorry for my grammar, English is not my main language. >.

Edited by LEPAT
Link to comment
Share on other sites

How are you running that script on multiple drawings, I used to do that years ago and I used a windows CMD script file (batch script), but I don't remeber the finer points.

Anyway, Lisp isn't available in LT so you can ignore that, if you want to edit text it may be difficult, how do you select the text, is it on a special layer? is it always at the same location? and how would it need editing. It might be easier if you can actually programatically find the text, to delete the old text and create a new text entry. Can you post a drawing showing what needs changing, not sure I can help running the script on thousands of files but maybe I could help with the commands for editing the text.

Link to comment
Share on other sites

Hi Steven,

 

Thanks alot for replying. I was dying to understand the script :ouch: I'll try my best to make it clear. I use TEXT command for all drawings. Fortunately, the texts that i need to change is at the same location for all drawings. I just need to change to, for example from "AM-AA" to "AM-AA-01". The next drawing would be change to AM-AA-02" and so on. And I tried to write script kinda like this :

 

 

OPEN C:\Users\ME\Desktop\Drawing-01.DWG

DDEDIT

(not sure what to put here)

 

Autocad LT can read that untill DDEDIT, but after the DDEDIT command, i just don't know what kind of text should I insert for the script to be able to run.You can see the sample in the attachment. The text I need to change is at the bottom right. Again, thank you for your time. :)

Drawing-01.dwg

Edited by LEPAT
Link to comment
Share on other sites

I thought ddedit might give problems in a script, this is the best I could come up with

OPEN C:\Users\ME\Desktop\Drawing-01.DWG
erase
fence
370,10
@5,2

_text
370,10
0
AM-AA-01
_QSAVE
CLOSE

The above method works on the test file you provided, but if different drawings have a diffeferent title block layout, then it will cause all sorts of problems (for example all drawings need to have been closed originaly whilst in the correct layout and not in model space). I would strongly suggest that you use a different approach and look at using a Title block, as a block with attributes, and if you have projects with thousands of drawings in them, it would be worth learning about sheet sets (I still need to learn that myself).

From experience I would also suggest making a copy of all drawings in a folder before running any scripts, there is always something that happens that you don't expect, and you can't use the undo command when a drawing has been closed.

Link to comment
Share on other sites

Sorry my late response. My Autocad seems like doesn't recognize the code that you provide but thanks to you, I made few changes based on yours :

 

OPEN C:\Users\ME\Desktop\Drawing-01.DWG

erase

fence

370,10

@5,2

 

_text

370,10

1.2

0

AM-AA-01

_QSAVE

CLOSE

 

I change the text height to 1.2. But the result is not what I expected. The script works, but it uses standard type of the text. Does this mean I need to insert another command in the script for changing the style? I'm ran out of idea right now. :( I really appreciate your help. Thanks

 

***EDIT:

Finally! I think I got it, I use this script :

 

OPEN C:\Users\ME\Desktop\Drawing-01.DWG

ZOOM

365,17

426,-13

-STYLE

ROMANS

ROMANS.SHX

1.5

0.8

0

NO

NO

NO

MTEXT

388,7

408,2

AM-AA-04

 

Thank you!! although mine's quite different from you, but I can't go this far without your help. But Is there any tutorial/tips that I can find on how to use script with autocad? Using script is great, especially for me, I'm still learning and fun to learn something new. Thanks again, Steven!

Edited by LEPAT
Link to comment
Share on other sites

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