Just in case anyone wants to know, this is the final code that I will be using. Thanks again for all the help.
(defun VALUE (num ent /)
(cdr (assoc num ent))
)
(defun c:AddExtraAtt (/ *error* CreatAtt ActDoc Sel EntData tmpEnt flag Sel2 InsPt Ht Rot Tag Str Just tmpOpt
Just72 Just73 tmpEntData entmakeList)
; Add attributes until you hit enter to an existing block, while keeping the original attributes.
; Tim Willey 12/2005
; Sub's 'CreateAtt 'value '*error*
; Thanks to Jeff Mishler and Kerry Brown at www.theswamp.org for their input.
(defun *error* (msg)
(princ msg)
(vla-EndUndoMark ActDoc)
(if Sel
(redraw (car Sel) 4)
)
)
(defun CreateAtt (Tag Str InsPt Just72 Just73 Ht Rot / )
(list
(cons 0 "ATTRIB")
(cons 100 "AcDbEntity")
(cons 100 "AcDbText")
(cons 100 "AcDbAttribute")
(cons 1 Str)
(cons 2 Tag)
(cons 6 "ByBlock")
(cons 8 "0")
(cons 10 InsPt)
(cons 11 InsPt)
(cons 40 Ht)
(cons 50 Rot)
(cons 62 256)
(cons 70 0)
(cons 72 Just72)
(cons 73 Just73)
)
)
(setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(vla-StartUndoMark ActDoc)
(while
(and
(if Sel
T
(setq Sel (entsel "\n Select block to add attribute to: "))
)
(setq EntData (entget (car Sel)))
(= (value 0 EntData) "INSERT")
(not (redraw (car Sel) 3))
(setq entmakeList
(list
(if (not (assoc 66 EntData))
(append EntData (list (cons 66 1)))
EntData
)
)
)
(setq tmpEnt (car Sel))
(if
(and
(entnext tmpent)
(= (cdr (assoc 0 (entget (entnext tmpent)))) "ATTRIB")
)
(while (/= (value 0 (entget (setq tmpEnt (entnext tmpEnt)))) "SEQEND")
(setq entmakeList (cons (setq EntData (entget tmpEnt)) entmakeList))
)
(setq flag T)
)
(not (initget "Type"))
(setq Sel2 (nentsel "\n Select existing attribute to match, or Type in attribute properties: "))
(if (= Sel2 "Type")
(progn
(setq InsPt (getpoint "\n Select insertion point: "))
(setq Ht (getdist "\n Height of attribute: "))
(setq Rot (getangle "\n Rotation of attribute: "))
(/= (setq Tag (getstring T "\n Enter tag value: ")) "")
(/= (setq Str (getstring T "\n Enter displayed value: ")) "")
(not (initget "L C R M TL TC TR ML MC MR BL BC BR"))
(setq Just
(if (setq tmpOpt (getkword "\n Justification [<L>/C/R/M/TL/TC/TR/ML/MC/MR/BL/BC/BR]: "))
tmpOpt
"L"
)
)
(cond
((= Just "L")
(setq Just72 0)
(setq Just73 0)
)
((= Just "C")
(setq Just72 1)
(setq Just73 0)
)
((= Just "R")
(setq Just72 2)
(setq Just73 0)
)
((= Just "M")
(setq Just72 4)
(setq Just73 0)
)
((= Just "TL")
(setq Just72 0)
(setq Just73 3)
)
((= Just "TC")
(setq Just72 1)
(setq Just73 3)
)
((= Just "TR")
(setq Just72 2)
(setq Just73 3)
)
((= Just "ML")
(setq Just72 0)
(setq Just73 2)
)
((= Just "MC")
(setq Just72 1)
(setq Just73 2)
)
((= Just "MR")
(setq Just72 2)
(setq Just73 2)
)
((= Just "BL")
(setq Just72 0)
(setq Just73 1)
)
((= Just "BC")
(setq Just72 1)
(setq Just73 1)
)
((= Just "BR")
(setq Just72 2)
(setq Just73 1)
)
)
)
(progn
(setq tmpEntData (entget (car Sel2)))
(setq Just72 (value 72 tmpEntData))
(setq Just73 (value 73 tmpEntData))
(setq Ht (value 40 tmpEntData))
(setq Rot (value 50 tmpEntData))
(while
(and
(not (initget "Under"))
(not (setq InsPt (getpoint "\n Select insertion point, or Under selected text: ")))
)
)
(if (= InsPt "Under")
(setq InsPt
(polar
(value
(if (and (equal (value 72 tmpEntData) 0.0) (equal (value 73 tmpEntData) 0.0))
10
11
)
tmpEntData
)
(- Rot (DTR 90))
(DefaultTextSpacing (value 7 tmpEntData) Ht)
)
)
)
(/= (setq Tag (getstring T "\n Enter tag value: ")) "")
(/= (setq Str (getstring T "\n Enter displayed value: ")) "")
)
)
)
(setq entmakeList (cons (CreateAtt Tag Str InsPt Just72 Just73 Ht Rot) entmakeLIst))
(mapcar 'entmake (reverse entmakeList))
(if flag
(entmake
(list
(cons 0 "SEQEND")
(cons 100 "AcDbEntity")
(cons 8 (value 8 EntData))
)
)
(entmake (setq EntData (entget tmpEnt)))
)
(entdel (car Sel))
(setq Sel (cons (entlast) Sel))
(redraw (car Sel) 3)
)
(if Sel
(redraw (car Sel) 4)
)
(vla-EndUndoMark ActDoc)
(princ)
)