Message 1 of 13
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there,
One existing lisp can change title block attribute from "0A" to "0B". Could you please advise me how to change it from "0B" to "0C"? Please see the screenshot and the lisp files below, the lisp and DWG file were attached as well. Thank you very much in advance.
the lisp file is below,
(vl-load-com)
(defun c:ASet (/ format_date chgtxt adoc data_assoc_list ss attribute_tag attribute_string)
;********************************************************************************************
(defun format_date (/ mon date)
(setq mon '("JAN" "FEB" "MAR" "APR" "MAY" "JUN" "JUL" "AUG" "SEP" "OCT" "NOV" "DEC"))
(setq date (rtos (fix (getvar "cdate")) 2 0))
(strcat (substr date 1 4) (nth (1- (atoi (substr date 5 2))) mon) (substr date 7 2))
)
;********************************************************************************************
(defun chgtxt (string)
(cond
(
(= (car (reverse (vl-string->list string))) 65)
(vl-string-subst "B" "A" string)
)
(
(= (car (reverse (vl-string->list string))) 97)
(vl-string-subst "b" "a" string)
)
)
)
;********************************************************************************************
(setq data_assoc_list '(
; ("TITLE_LINE_1" . "DMR SUBSTATION")
("DATE" . "2024SEP")
; ("DESIGNED_BY" . "K. BAINS")
; ("INDEPENDENT_CHK" . "R. CLELLAND")
; ("DRAFTED_BY" . "M. RU")
; ("DRAFTING_CHECK" . "K. BAINS")
; ("INSPECTED_BY" . "")
; ("REVIEWED_BY" . "")
; ("ACCEPTED_BY" . "")
)
)
(if (ssget "_X" (list '(0 . "insert")))
(vlax-for block_reference (vla-get-activeSelectionSet (vla-get-activedocument (vlax-get-acad-object)))
(cond
(
(wcmatch (strcase (vla-get-effectiveName block_reference)) "BCH-X-BORD-DXXX,BCH-X-BORD-BXXX,BCH-X-BORD-BXXXC,BCH-X-BORD-AXXX,BCH-X-BORD-REVI,BCH-X-ANNO-STMP-OBSO")
(foreach attribute (vlax-invoke block_reference 'getAttributes)
(setq attribute_tag (strcase (vla-get-tagString attribute)))
(setq attribute_string (vla-get-textString attribute))
(cond
(
(setq item (assoc attribute_tag data_assoc_list))
(vla-put-textString attribute (format_date))
(vla-put-textString attribute (cdr item))
)
(
(wcmatch attribute_tag "REV_`#,R_NO_D&E,R_NO_A&B,REV_NO")
(if
(and
(or
(wcmatch attribute_string "#[AaBb]")
(wcmatch attribute_string "##[AaBb]")
)
(setq attribute_string (chgtxt attribute_string))
)
(vla-put-textString attribute attribute_string)
)
)
)
)
)
(
(= "BCH-ST-DYN-DWG-ISSUE" (vla-get-effectivename block_reference))
(setpropertyvalue (vlax-vla-object->ename block_reference) "AcDbDynBlockPropertyVisibility" "IFR - ISSUE FOR REVIEW")
)
(
t
)
)
(vlax-release-object block_reference)
)
)
(princ)
)
Solved! Go to Solution.