Good Afternoon!
I have a lisp that I use to update our title blocks. I'm trying to add a way to update each layout with the correct rev level (that I'm getting through an sql query). I've got just about everything, but I can't figure out how to update each page's attribute with the correct rev level Can someone show me how to update these? I appreciate any help
This is what I use to get the rev level:
Code:
(if
(and
(setq
ss (ssget "_x" '((0 . "INSERT") (2 . "*BORDER*") (66 . 1)))
)
)
(progn
;; Get page_no attribute values from blocks
(vlax-for x (setq ss (setq acDoc
(vla-get-activeselectionset
(vla-get-activedocument
(vlax-get-acad-object)
)
)
)
)
(foreach att (vlax-invoke x 'getattributes)
(if (= "PAGE_NO" (vla-get-tagstring att))
(progn
(setq pageNo (atoi (vla-get-textstring att)))
(setq data (cons (cons x pageNo) data))
)
)
)
)
;; Put revision attribute values into blocks - separated out because elvis has page numbers and descriptions as one record in his db. derp.
(foreach item data
;;; for drawings that can have more than one page number
(cond
((or
(= abb "PD")
(= abb "WD")
(= abb "CHL"))
(setq fld11 (strcat "SELECT level FROM revisions WHERE (item LIKE '%"fld1"%') AND (document = '"fld7">pg "(vl-princ-to-string (cdr item))"') ORDER BY level DESC")))
;;; for drawings that only have one page
((or
(= abb "HL")
(= abb "CL")
(= abb "LP"))
(setq fld11 (strcat "SELECT level FROM revisions WHERE (item LIKE '%"fld1"%') AND (document = '"fld7"') ORDER BY level DESC")))
;;; for drawings with various numbers after the drawing name (ks1, ks2, ks3, etc.)
((or
(= abb "KS")
(= abb "KE")
(= abb "KM"))
(setq fld11 (strcat "SELECT level FROM revisions WHERE (item LIKE '%"fld1"%') AND (document = '"abb">"abb2"') ORDER BY level DESC")))
) ; end cond
;;;
(if (setq
adoValue (caadr (ADOLISP_DoSQL ConnectionObject fld11))
)
(foreach att (vlax-invoke (car item) 'getattributes)
(if (= "REV" (vla-get-tagstring att))
(if (/= nil adoValue)
(and
(prompt (strcat "\nPage No: " (vl-princ-to-string (cdr item)) ", " "Rev No: " (itoa adoValue)))(princ)
(vla-put-textstring att adoValue))
;; somewhere in here is where I believe i need to update the block, but I don't know how <sad panda face>
(vla-put-textstring att 0)
)
)
)
)
)
(*error* nil)
)
)