Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

converting specific field to text

4 REPLIES 4
Reply
Message 1 of 5
robert06
583 Views, 4 Replies

converting specific field to text

Help with lisp to convert TEXT & MTEXT fields containing save date expression (%<\AcVar SaveDate \f "dd.MM.yyyy">%) to text would be much appreciated, could fields inside blocks be converted as well?

 

Thank you

 

Robert

4 REPLIES 4
Message 2 of 5
braudpat
in reply to: robert06

Hello from France


Please look at these routines (especially from INERB) :
https://forums.augi.com/showthread.php?72534-Convert-Field-to-Text-within-Block-Globally


Please let us know which one is OK and right for you because I have never used/tested these routines !

 

And maybe the "F2T" routine from pbejse :

http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/convert-fields-into-text-only-in-spec...

 

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 3 of 5
robert06
in reply to: braudpat

Hi, thanks. As a result of web search I've gone through these also earlier.

 

Irneb's code can convert field values in block attributes to text
https://forums.augi.com/showthread.php?72534-Convert-Field-to-Text-within-Block-Globally/page2:


(vl-load-com)
(defun c:FLD2TXT (/ ss n bn an ad s)
(prompt
"Select the blocks you wish to remove the field links from: "
) ;_ end of prompt
(setq ss (ssget '((0 . "INSERT")))) ;Get selection set from user
(setq n 0) ;Initialize counter
;; Step through selection set one entity at a time
(while (< n (sslength ss))
(setq bn (ssname ss n)) ;Get the nth entity in the selection set
(setq an (entnext bn)) ;Get the next enity after bn
;; Step through each next entity until it is not an attribute
(while (and an ;Check if entity is found
(setq ad (entget an)) ;Get data
(= "ATTRIB" (cdr (assoc 0 ad))) ;Check if attribute
) ;_ end of and
(setq s (cdr (assoc 1 ad))) ;Get text value
(setq ad (subst (vl-list* 1 "") (assoc 1 ad) ad))
;Clear the attribute's value
(entmod ad) ;Modify the entity
(setq ad (subst (vl-list* 1 s) (assoc 1 ad) ad))
;Set the attribute's value back to only the text
(entmod ad) ;Modify the entity
(entupd an) ;Update screen to show change
(setq an (entnext an)) ;Get next entity
) ;_ end of while
(setq n (1+ n)) ;Increment counter
) ;_ end of while
(setq ss nil) ;Clear selection set
(gc) ;Clear unused memory
(princ)
) ;_ end of defun

 

 

I could not get pbejse's "F2T" to work..

 

 

Message 4 of 5
braudpat
in reply to: robert06

 

Hello

 

You have to modify the pbejse's "F2T" routine for YOUR specific block !

 

Into F2T : Block Name = "Mode_A3" , Attributes Names = TAG1 , TAG2 , TAG3

 

So ...

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 5 of 5
robert06
in reply to: braudpat

Hi,

 

"F2T" does not quite meet my needs, as it's for block with attributes, the fields I have to convert (on drawing export suppose) are in Text or Mtext which also / in addition reside in blocks.
Also I need to be able to filter the text objects by field expression given above to maintain contents of other fields.

 

Thanks,

 

Robert

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost