alanjt Posted September 19, 2009 Posted September 19, 2009 (edited) 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.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 May 7, 2012 by alanjt Quote
gilsoto13 Posted September 19, 2009 Posted September 19, 2009 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... Quote
gilsoto13 Posted September 21, 2009 Posted September 21, 2009 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. Quote
alanjt Posted September 21, 2009 Author Posted September 21, 2009 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. Quote
alanjt Posted September 23, 2009 Author Posted September 23, 2009 Updated (first post) edit box to appear at mouse location instead of center of screen. Quote
gilsoto13 Posted October 2, 2009 Posted October 2, 2009 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 Quote
alanjt Posted October 2, 2009 Author Posted October 2, 2009 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 Quote
gilsoto13 Posted October 2, 2009 Posted October 2, 2009 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 Quote
alanjt Posted October 3, 2009 Author Posted October 3, 2009 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. Quote
alanjt Posted December 15, 2009 Author Posted December 15, 2009 Updated to account for a bug in vla-get-textstring, which will not extract symbols, instead a "?" is given. Quote
hrehor Posted January 28, 2010 Posted January 28, 2010 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. Quote
alanjt Posted January 28, 2010 Author Posted January 28, 2010 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. Quote
cmwade77 Posted February 12, 2010 Posted February 12, 2010 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. Quote
alanjt Posted February 15, 2010 Author Posted February 15, 2010 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. Quote
kevynm Posted February 18, 2010 Posted February 18, 2010 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 Quote
alanjt Posted February 18, 2010 Author Posted February 18, 2010 Helpwhen 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. Quote
alanjt Posted February 18, 2010 Author Posted February 18, 2010 Add (vl-load-com) to the very top of the code I bet Alan will be embarassed when he realises he's missed it It's in there. Quote
Lee Mac Posted February 18, 2010 Posted February 18, 2010 It's in there. Yeah, I edited my post... my one-upping attempt didn't work Quote
alanjt Posted February 18, 2010 Author Posted February 18, 2010 Yeah, I edited my post... my one-upping attempt didn't work Don't worry, you'll get your opportunity to poke fun at my stupidity. It's not working yet. Quote
Recommended Posts
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.