Jump to content

Recommended Posts

Posted

Hi everyone,

 

I'm new with AUTOCAD here. Recently I need to do some checking on some text labels in the drawng that was send to me. Unfortunately, there are too many drawings so I would like to automate it through scripting or LSP.

 

I tried list command on the text object but I'm not sure how to check it as all the attributes are listed out.

 

I tried using ddedit command to change the text but unfortunately it will require me to manually key in the text.

 

I'm stuck:cry:. Appreciate it if anyone could point some idea on how to read and change the text using scripting or LSP.

 

Thanks

Posted

i am presuming that the text you wish to change is going to be constrant across all the drawings.

you need to find the name of the block, the tags of the attributes, the existing and the proposed values of the attributes.

once you have all the above, you can then create a script file as shown below:

-ATTEDIT
N
N
insert_block_name_here
insert_attribute_tag_here
*
insert_existing_value_attribute_here
insert_proposed_value_attribute_here

repeat the above code within the script file, should you be editing more than attribute in each drawing.

Posted

Thanks for the pointer. I have found the block they have used, unfortunately he/she who created the drawing inserted the text into the model and not inside the block itself.

 

Sigh.... :(

 

Is there anyway to modify the text inserted directed into the model as an object using a script?

 

Appreciate anyone pointer on this matter.

 

Thanks a million

  • 3 years later...
Posted
i am presuming that the text you wish to change is going to be constrant across all the drawings.

you need to find the name of the block, the tags of the attributes, the existing and the proposed values of the attributes.

once you have all the above, you can then create a script file as shown below:

-ATTEDIT
N
N
insert_block_name_here
insert_attribute_tag_here
*
insert_existing_value_attribute_here
insert_proposed_value_attribute_here

repeat the above code within the script file, should you be editing more than attribute in each drawing.

 

What if I have NO string to change.. I mean, when the string is empty and I want tofill it with some text...

Not replacing an old text.. just completing it...

 

Thank you so much!

Posted

from memory I think you need to have a string to modify to run this as a script.

 

Try it yourself. Follow NBC's example by typing at the keyboard and try a few different values, particularly taking notice of what his * does.

 

Alternatively this can be done using one of the program languages, LISP or VBA.

Posted
from memory I think you need to have a string to modify to run this as a script.

 

Try it yourself. Follow NBC's example by typing at the keyboard and try a few different values, particularly taking notice of what his * does.

 

Alternatively this can be done using one of the program languages, LISP or VBA.

 

Yes, that way I need a string to change, what I was asking is the other command.. I cannot remember it nor find it, but I'm pretty sure there is a command ti fill an empty attribute. That command is what I'm looking for.

And of course I've tried with NBC'c example changing variables, but It doesn't work without strings.

Any other idea?

Posted

I disagree. I have just created a block with an empty attribute and updated it.

 

Command: -ATTEDIT
Edit attributes one at a time? [Yes/No] <Y>: n
Performing global editing of attribute values.
Edit only attributes visible on screen? [Yes/No] <Y>: n
Drawing must be regenerated afterwards.
Enter block name specification <*>: test
Enter attribute tag specification <*>: 2
Enter attribute value specification <*>:
1 attributes selected.
Enter string to change:
Enter new string: fred

Posted
I disagree. I have just created a block with an empty attribute and updated it.

 

Command: -ATTEDIT
Edit attributes one at a time? [Yes/No] <Y>: n
Performing global editing of attribute values.
Edit only attributes visible on screen? [Yes/No] <Y>: n
Drawing must be regenerated afterwards.
Enter block name specification <*>: test
Enter attribute tag specification <*>: 2
Enter attribute value specification <*>:
1 attributes selected.
Enter string to change:
Enter new string: fred

You rock!!

I sware I tried it las night at home and it does not worked...

But now at work it was sweet!!

I'll try to find what happend bak at home!! Thank you so much!

Posted

be careful though, you don't want to change "Hello Peter" to "HelloTestPeter"

Posted

Hello again....

You know what happened? The blocks seems to be the same, with the same block name, but different tags with some attributes... they just went wrong...

Thank you again dbroada!

Posted
Hello again....

You know what happened? The blocks seems to be the same, with the same block name, but different tags with some attributes... they just went wrong...

Thank you again dbroada!

does this mean you have made progress or are you stuck?

 

I have used -ATTEDIT edit in scripts often but it is a dumb servant, it just follows the rules you give it. If somebody has copied a block but altered attribute tag names or given the same tag name to multiple attributes (both used to happen here a lot) a script gets upset and you can never be sure what will happen.

 

If you want more robustness you probably need a LISP solution. I would start a new thread in the LISP section and give as much detail as possible to your problem and I am sure somebody will help. This thread has answers more in line with a script and the LISP gurus tend to look more at the other section.

  • 1 month later...
Posted
That english.
Tuns, what are you posting here for?
Posted

Another command worth looking at is the AutoCAD express Tools command Gatte

 

The beauty of this command is you don't have to know what the existing text is that you are replacing. This is very useful when you want to reuse a set of drawings that were created on different dates and by different people.

 

Patrick

http://www.multi-batch.com/

For your entire batch processing needs

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