Copy FieldCode from attrib to attrib

Discussion in 'AutoCAD' started by Marc'Antonio Alessi, Feb 14, 2005.

  1. I need to copy the fieldcode from attrib to attrib
    (or, better, from ATTRIB,ATTDEF,TEXT,MTEXT to ATTRIB,ATTDEF,TEXT,MTEXT)

    I tried to modify my COPY_STRING but this do not work
    (note: the ATTRIB do not have the FieldCode method).

    I have a block with several attribs:

    Item NO.
    Item Descr.
    Item Q.ty
    ....
    Item NO. A
    Item NO. B
    Item NO. C
    ....

    I need to modify only the main Item NO. and update all the
    others Item NO. A,B,C...
    (no reactors)


    Any hint?

    Code:
    
    (defun C:ALE_COPY_STRING ( / EntNam EntDat ValStr EntLs1 EntLs2 PrmStr)
    (setq PrmStr "\nSelect origin String: ")
    (while (setq EntNam (car (setq EntLs1 (nentsel PrmStr))))
    (if
    (and
    EntNam
    (wcmatch
    (DXF 0 (setq EntDat (entget EntNam))) "ATTRIB,ATTDEF,TEXT,MTEXT"
    )
    (setq ValStr (DXF 1 EntDat))
    )
    (progn
    (setq PrmStr "\nSelect origin String [Return to quit]: ")
    (initget "Multiple")
    (if
    (= "Multiple"
    (setq EntLs2
    (nentsel "\nSelect the target String [Multiple]: ")
    )
    )
    (while
    (setq EntLs2
    (nentsel "\nSelect the target String [Return to quit]: ")
    )
    (ALE_UPD_STRING EntLs1 EntLs2 ValStr)
    )
    (ALE_UPD_STRING EntLs1 EntLs2 ValStr)
    )
    );progn
    (princ "\nNo String selected! Try again. ")
    )
    )
    (princ)
    )
    ;
    (defun ALE_UPD_STRING (EntLs1 EntLs2 ValStr / EntNm2 EntDt1 EntDt2 EntDt3)
    (cond
    ( (and
    (setq EntNm2 (car EntLs2))
    (wcmatch
    (DXF 0 (setq EntDt2 (entget EntNm2))) "ATTRIB,ATTDEF,TEXT,MTEXT"
    )
    )
    (cond
    ( (= (length EntLs2) 4)
    (setq EntNm2 (last (last EntLs2)))
    (if (= "DIMENSION" (DXF 0 (setq EntDt3 (entget EntNm2))))
    (if
    (and
    (= (length EntLs1) 4)
    (= "DIMENSION"
    (DXF 0 (setq EntDt1 (entget (last (last EntLs1)))))
    )
    )
    (setq EntDt2 EntDt3  ValStr (DXF 1 EntDt1))
    (setq EntDt2 EntDt3)
    )
    )
    )
    )
    (or EntDt1 (setq EntDt1 (entget (car EntLs1))))
    ; this do not work
    (if (= "{ACAD_XDICTIONARY" (DXF 102 EntDt1))
    (setq EntDt2
    (append
    EntDt2
    (list
    '(102 . "{ACAD_XDICTIONARY") (assoc 360 EntDt1) '(102 . "}")
    )
    )
    )
    )
    ; end
    (if (entmod (subst (cons 1 ValStr) (assoc 1 EntDt2) EntDt2))
    (entupd EntNm2)
    (alert "ENTMOD error.")
    )
    )
    ( T (princ "\nNo String selected! Restart. ") )
    )
    )
    [code]
    
    
    --
    
    Marc'Antonio Alessi
    http://xoomer.virgilio.it/alessi
    (strcat "NOT a " (substr (ver) 8 4) " guru.")
    
    --
     
    Marc'Antonio Alessi, Feb 14, 2005
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.