Lee Mac Posted May 27, 2010 Posted May 27, 2010 Latest code: ;; Txt2Att ( Lee Mac ) ;; Converts Single-line Text to Attribute Definition (defun c:txt2att ( / StringSubst RemovePairs ss ent eLst str dx73 ) (vl-load-com) ;; Lee Mac ~ 27.04.10 (defun StringSubst ( new pat str ) (while (vl-string-search pat str) (setq str (vl-string-subst new pat str)) ) str ) (defun RemovePairs ( lst pairs ) (vl-remove-if (function (lambda ( pair ) (vl-position (car pair) pairs) ) ) lst ) ) (if (setq ss (ssget "_:L" '((0 . "TEXT")))) ( (lambda ( i ) (while (setq ent (ssname ss (setq i (1+ i)))) (setq eLst (entget ent) str (StringSubst "_" " " (cdr (assoc 1 eLst))) dx73 (cdr (assoc 73 eLst))) (setq eLst (RemovePairs eLst '( 0 100 1 73 ))) (if (entmake (append '( (0 . "ATTDEF") ) eLst (list (cons 70 0) (cons 74 dx73) (cons 1 str) (cons 2 str) (cons 3 str)))) (entdel ent) ) ) ) -1 ) ) (princ)) 1 Quote
Lee Mac Posted May 28, 2010 Posted May 28, 2010 Its astounding to see how far I've come from that first post of mine... Nice to hear you're still using the code Quote
asos2000 Posted May 28, 2010 Posted May 28, 2010 Long time back im using this code by the way, whats the deference between CODE, LISP and ROUTINE Quote
Lee Mac Posted May 28, 2010 Posted May 28, 2010 Not much difference really, the code is what is typed, the LISP is the file itself perhaps, and the routine may refer to the program algorithm Quote
Patch61 Posted January 23, 2012 Posted January 23, 2012 Lee, Is there any chance I can convince you to go back to this useful utility and adapt it for converting multiline text to multiline attribute? I guess it would need to handle multiple single-line texts and MText as well. Or, at least, it should handle MText since Express Tools has a Text2MText tool that can be used, if necessary. I appreciate you even considering it. Thanks! -Patch Quote
manirpg Posted November 7, 2013 Posted November 7, 2013 Hi sir, I am searching a lisp for converting text (inside block) to attribute definition. like your program txt2att. Can you help me. Thanks in advance Manigandan Quote
Voaraghamanthar Posted May 22, 2015 Posted May 22, 2015 Lee, is there any way to modify a line of that code to get to it insert a default "PROMPT" of Drawing Number: .... with the semicolon at the end? Would be awesome if I can change it easily to whatever default I want....even if it means modifying the code. Quote
neophoible Posted May 27, 2015 Posted May 27, 2015 Lee, is there any way to modify a line of that code to get to it insert a default "PROMPT" of Drawing Number: .... with the semicolon at the end? Would be awesome if I can change it easily to whatever default I want....even if it means modifying the code.I think the 3 value is the one you want to change, i.e., substitute your prompt string in place of str in that case. Also, I think the colon is automatically provided by AutoCAD. Quote
Emmanuel Delay Posted June 10, 2016 Posted June 10, 2016 Hi everybody. I need the result of that entmake as an SSGET selection Is there an obvious way of doing that? ---- (setq result (entmake (list (cons 0 "ATTDEF") .... then I have a function that requires the result of an SSGET I want to feed result to that function I know Lee Mac has such conversion functions, like (LM:ss->vla ss) Is there something like a (LM:entmake->ss result) ? Quote
Lee Mac Posted June 10, 2016 Posted June 10, 2016 I need the result of that entmake as an SSGET selection Is there an obvious way of doing that? Use entmakex in place of entmake and add the entity name returned by this function to a selection set using ssadd. Quote
waytooraider Posted April 20, 2017 Posted April 20, 2017 Lee, It's wonderful lisp, For example we can converts 100 text to 100 tags But can we convert 100 tags to 100 blocks? Txt2Tag2Block Blocks name should be same. Quote
Emmanuel Delay Posted April 20, 2017 Posted April 20, 2017 Could you explain that question a little more thoroughly? What exactly are you starting with? ATTDEF entities loose in the dwg, or is it still text entities ? And now you want each of these values in a ATTDEF inside a block. And presumably you want the block to be inserted, so that the attribute stays in the same position as the text used to be? The block definition already exists, it has 1 (or more) attribute , ... Right? Quote
waytooraider Posted April 20, 2017 Posted April 20, 2017 Absolutely right, I want to convert text to attribute blocks value, not to tag (attribute definition) Quote
waytooraider Posted April 20, 2017 Posted April 20, 2017 Could u look attachment. text2attblock.dwg 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.