Jump to content

CopyText.lsp: Copy/Swap Text/MText/Multileader/Attribute Values


alanjt

Recommended Posts

I've posted an older version of this in another thread, but I made some updates and wanted to 'officially' post it for everyone.

 

Will allow allow user to select a 'source' Attribute/Multileader (with text)/Mtext/Text object, or "Type" in a text value, and copy its text contents to every selected 'target' Attribute/Multileader/Mtext/Text object.

 

If only one 'target' object is selected, user is prompted with option to swap contents of 'source' and 'target' objects.

 

Will work with and strip formatting of Multiline Attributes, if textstring is going to regular attribute or dtext.

 

For selecting 'Target' text objects, user has option for single or "Multiple" selection (single will allow nested selection).

 

For the "Type" option, don't forget to explore all the right-click menu options (import text, etc.).

 

Pickfirst works for multiple text objects.

 

Call with either CT or CopyText.

 

Your comments are greatly appreciated.

 

CopyText.gif

 

;;; ------------------------------------------------------------------------
;;;    CopyText.lsp v1.3
;;;
;;;    Copyright© 03.16.09
;;;    Alan J. Thompson (alanjt)
;;;
;;;    Permission to use, copy, modify, and distribute this software
;;;    for any purpose and without fee is hereby granted, provided
;;;    that the above copyright notice appears in all copies and
;;;    that both that copyright notice and the limited warranty and
;;;    restricted rights notice below appear in all supporting
;;;    documentation.
;;;
;;;    The following program(s) are provided "as is" and with all faults.
;;;    Alan J. Thompson DOES NOT warrant that the operation of the program(s)
;;;    will be uninterrupted and/or error free.
;;;
;;;    User has option to copy contents of selected text object or typed in
;;;    content, to any number of selected text objects (Text, Mtext, Multileader,
;;;    Attribute Definition). If only one target object is selected,
;;;    user is prompted with option to swap contents of source & target.
;;;    Will select objects in xrefs & blocks.
;;;
;;;    Revision History:
;;;
;;;    v1.1    (06.08.09) 1. Rewrite to code after replacing/updating subroutines.
;;;
;;;    v1.2    (09.18.09) 1. Added function to, if applicable, strip formatting codes
;;;                  of textstring taken from MtextAttributes.
;;;               2. Removed issue with selecting Multileaders with blocks.
;;;               3. Added option to select multiple 'target' text objects.
;;;               4. Added option to type in text value to copy to others.
;;;               5. Added subroutines: AT:SS->List, AT:TabFilter, AT:EditTextBox
;;;
;;;    v1.21    (09.21.09) 1. Updated AT:EditTextBox subroutine.
;;;
;;;    v1.3    (11.25.09) 1. Added subroutine AT:TextString and changed string extraction
;;;                  coding to extract string from DXF code, ensuring that all
;;;                  symbols are extracted properly (bug with vla-get-textstring).
;;;
;;; ------------------------------------------------------------------------

Updated: v1.21

Updated: v1.3

CopyText.lsp

Edited by alanjt
Link to comment
Share on other sites

  • Replies 80
  • Created
  • Last Reply

Top Posters In This Topic

  • alanjt

    31

  • kevynm

    10

  • Lee Mac

    8

  • gilsoto13

    4

Top Posters In This Topic

Posted Images

I've posted an older version of this in another thread, but I made some updates and wanted to 'officially' post it for everyone.

 

Will allow allow user to select a 'source' Attribute/Multileader (with text)/Mtext/Text object, or "Type" in a text value, and copy its text contents to every selected 'target' Attribute/Multileader/Mtext/Text object.

 

If only one 'target' object is selected, user is prompted with option to swap contents of 'source' and 'target' objects.

 

Will work with and strip formatting of Multiline Attributes, if textstring is going to regular attribute or dtext.

 

For selecting 'Target' text objects, user has option for single or "Multiple" selection (single will allow nested selection).

 

For the "Type" option, don't forget to explore all the right-click menu options (import text, etc.).

 

Pickfirst works for multiple text objects.

 

Call with either CT or CopyText.

 

Your comments are greatly appreciated.

 

[ATTACH]14444[/ATTACH]

 

 

I am gonna check it out next monday at the office... I am using the old attribute version blocks here... but we'll need to use it if it works...

Link to comment
Share on other sites

I am gonna check it out next monday at the office... I am using the old attribute version blocks here... but we'll need to use it if it works...

 

 

Yeaaaaa... it rocks...

 

works with multiline attribute... I thought it was going to have some prompting , but it's clean... it copies text as required from attribute or mtext, or text, thanks a lot alan.

 

This last weekend I had a very good progress on the blocks compilation thing... I just left only 4 collections to extract and check to start the final organizing. There are many good surprises, but I still can´t decide about some many blocks that have their original names, like stove01, tree01, door01... and keep them .. or standarize them all by their areas, and change all blocks to kitchen0001, vegetation0001, opening0001..

 

Also, I am not sure if retain some layers or rename according to block area or change them all to layer 0 and color bylayer..

 

Some comments would be appreciated for this too.

Link to comment
Share on other sites

Glad someone can get some use from it.

Yeah, I didn't want the user to have any additional prompts. If I missed any formatting for Multiline Attributes, let me know.

 

Yeaaaaa... it rocks...

 

works with multiline attribute... I thought it was going to have some prompting , but it's clean... it copies text as required from attribute or mtext, or text, thanks a lot alan.

 

This last weekend I had a very good progress on the blocks compilation thing... I just left only 4 collections to extract and check to start the final organizing. There are many good surprises, but I still can´t decide about some many blocks that have their original names, like stove01, tree01, door01... and keep them .. or standarize them all by their areas, and change all blocks to kitchen0001, vegetation0001, opening0001..

 

Also, I am not sure if retain some layers or rename according to block area or change them all to layer 0 and color bylayer..

 

Some comments would be appreciated for this too.

Link to comment
Share on other sites

  • 2 weeks later...

Hi, Alan

 

 

Guess what?

 

I think I found a much better routine for this... I already tested it with blocks and multiline attributes, it works with dims or any other kind....

 

I think It's the one for everything at this the moment, (so It's just to help you in case you want to improve yours)

 

http://www.asmitools.com/Files/Programs.html

 

I've posted an older version of this in another thread, but I made some updates and wanted to 'officially' post it for everyone.

 

Will allow allow user to select a 'source' Attribute/Multileader (with text)/Mtext/Text object, or "Type" in a text value, and copy its text contents to every selected 'target' Attribute/Multileader/Mtext/Text object.

 

If only one 'target' object is selected, user is prompted with option to swap contents of 'source' and 'target' objects.

 

Will work with and strip formatting of Multiline Attributes, if textstring is going to regular attribute or dtext.

 

For selecting 'Target' text objects, user has option for single or "Multiple" selection (single will allow nested selection).

 

For the "Type" option, don't forget to explore all the right-click menu options (import text, etc.).

 

Pickfirst works for multiple text objects.

 

Call with either CT or CopyText.

 

Your comments are greatly appreciated.

 

[ATTACH]14444[/ATTACH]

 

 

Updated: v1.21

AsmiTools_Ttc.lsp

Link to comment
Share on other sites

The only thing his will select that mine won't are Tables, and his will not select Multileaders, while mine will. I also have an option to multiple select several pieces of text at a time, import text, and swap. I'm not sure what I could do to mine, unless I'm missing something.

 

 

Hi, Alan

 

 

Guess what?

 

I think I found a much better routine for this... I already tested it with blocks and multiline attributes, it works with dims or any other kind....

 

I think It's the one for everything at this the moment, (so It's just to help you in case you want to improve yours)

 

http://www.asmitools.com/Files/Programs.html

Link to comment
Share on other sites

The only thing his will select that mine won't are Tables, and his will not select Multileaders, while mine will. I also have an option to multiple select several pieces of text at a time, import text, and swap. I'm not sure what I could do to mine, unless I'm missing something.

 

dimensions.... I was keeping an old lisp because it allowed to copy from dimensions to any dtext, mtext, att and dims, but not multiline attribute, now this one allows them all, but doesn´t allow a multiple selection option, I didn´t see your multiple option, even when it's partial cause won´t make it on multiple attributes, it's another option I didn´t see and it works... I guess I can keep both..

 

nice

Link to comment
Share on other sites

dimensions.... I was keeping an old lisp because it allowed to copy from dimensions to any dtext, mtext, att and dims, but not multiline attribute, now this one allows them all, but doesn´t allow a multiple selection option, I didn´t see your multiple option, even when it's partial cause won´t make it on multiple attributes, it's another option I didn´t see and it works... I guess I can keep both..

 

nice

Dimensions act like block in the respect that the Text can be selected via nested selection (nentsel). CopyText uses nentsel for both source and targets, so it will work with dimensions (except in multiple selection).

 

I don't fully understand what you've said, so I can't fully address your comments. It has multiple selection (you have to activate it) and does work with multiline attributes (I made sure that option worked specifically because of you :) ).

 

However, if there is some option you think would benefit CopyText, I would, for the most part, be more than happy to oblige. That's a big reason for posting these routines; while, they have the potential to benefit others, it also gives me an opportunity to get improvement ideas from others.

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...
Updated to account for a bug in vla-get-textstring, which will not extract symbols, instead a "?" is given.

 

thank you alaljt! works perfectly, your lisp saves me a lot of time.

Link to comment
Share on other sites

thank you alaljt! works perfectly, your lisp saves me a lot of time.

 

HaHa, glad it helps. I know we use it quite a bit here at work. :)

Link to comment
Share on other sites

  • 3 weeks later...

The only thing that this doesn't seem to work with is if an MLEADER has a block with attributes in it, it won't edit the attributes in the block.

 

I have my own routine that everything else is working in, even with tables (except multiple cells in tables).

 

I am just having difficulty with the attributes.

Link to comment
Share on other sites

The only thing that this doesn't seem to work with is if an MLEADER has a block with attributes in it, it won't edit the attributes in the block.

 

I have my own routine that everything else is working in, even with tables (except multiple cells in tables).

 

I am just having difficulty with the attributes.

 

 

Yeah, I noticed it wouldn't work with attributed blocks within Multileaders. I worked at it a little, but since I don't use them and you are the first one to mention it, I just didn't spend a lot of time on them. I meant to put a check to avoid error, but I honestly completely forgot about it.

I also don't use tables (Civil 3D has dynamic tables). I could and should add the functionality, but it's just a matter of it being requested.

Link to comment
Share on other sites

Help

when i run this lsp i get and error message saying: ; error: An error has occurred inside the *error* functionno function

definition: VLAX-GET-ACAD-OBJECT

I love this if I could only get it to work. I am using AutoCAD 2010

thx

Kev

Link to comment
Share on other sites

Help

when i run this lsp i get and error message saying: ; error: An error has occurred inside the *error* functionno function

definition: VLAX-GET-ACAD-OBJECT

I love this if I could only get it to work. I am using AutoCAD 2010

thx

Kev

 

That's really odd. Especially since (vl-load-com) is called before anything else.

Type (vl-load-com) and the execute the command and tell me what happens.

Link to comment
Share on other sites

Yeah, I edited my post... my one-upping attempt didn't work :oops:

Don't worry, you'll get your opportunity to poke fun at my stupidity.:P

 

It's not working yet.

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