TITLE BLOCK ATT UPDATE

TITLE BLOCK ATT UPDATE

JPVICCKY
Explorer Explorer
384 Views
4 Replies
Message 1 of 5

TITLE BLOCK ATT UPDATE

JPVICCKY
Explorer
Explorer
(defun c:DATE (/ init ctxt )
  (setq date (getstring t "DATE : ")(setq init "JV")(setq ctxt "Changes made")))


(defun c:VERA () (setpropertyvalue (ssname (ssget "X" (list '(0 . "INSERT") '(2 . "TITLEBLOCK") (cons 410 (getvar 'ctab)))) 0) "INITA" (strcat init))
(setpropertyvalue (ssname (ssget "X" (list '(0 . "INSERT") '(2 . "TITLEBLOCK") (cons 410 (getvar 'ctab)))) 0) "CHANGESTEXTA" (strcat ctxt))
(setpropertyvalue (ssname (ssget "X" (list '(0 . "INSERT") '(2 . "TITLEBLOCK") (cons 410 (getvar 'ctab)))) 0) "DATEA" (strcat date)) (princ))

Please help me in this am noob in lisp,
my block name = TITLEBLOCK
Attributes are for version A = DATEA, CHANGESTEXTA, INITA and so on for other versions, (CHANGESTEXTA, INITA are common in all versions)

i want enter date in command line by entering DATE command, and then i need to use Command VERA, VERB...  and so on.

 

0 Likes
385 Views
4 Replies
Replies (4)
Message 2 of 5

paullimapa
Mentor
Mentor

here's one way by making your VERA lisp command as a sub function I'm calling MYVER inside your DATE lisp function.

Also I changed it from DATE to MYDATE because AutoCAD already has a command called DATE.

Not sure if this works so you'll have to load and run it to try.

 

(defun c:MYDATE (/ MYVER mydate init ctxt vers)
  (defun MYVER ()
   (setpropertyvalue (ssname (ssget "X" (list '(0 . "INSERT") '(2 . "TITLEBLOCK") (cons 410 (getvar 'ctab)))) 0) (strcat"INIT" vers) (strcat init))
   (setpropertyvalue (ssname (ssget "X" (list '(0 . "INSERT") '(2 . "TITLEBLOCK") (cons 410 (getvar 'ctab)))) 0) (strcat"CHANGESTEXT" vers) (strcat ctxt))
   (setpropertyvalue (ssname (ssget "X" (list '(0 . "INSERT") '(2 . "TITLEBLOCK") (cons 410 (getvar 'ctab)))) 0) (strcat"DATE" vers) (strcat mydate)) (princ)
  )
  (setq mydate (getstring t "DATE: ") init "JV" ctxt "Changes made" vers (getstring t "VERSION: "))
  (MYVER) ; run the sub function
)

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 5

Kent1Cooper
Consultant
Consultant

@JPVICCKY wrote:
....(strcat init)....
....(strcat ctxt)....
....(strcat date)....

....


[As an aside, those (strcat) functions with only one argument are not doing anything for you -- concatenating one text string just results in the same text string.  It "works," but just use the variable without the (strcat) "wrapper."]

Kent Cooper, AIA
Message 4 of 5

paullimapa
Mentor
Mentor

@Kent1Cooper is absolutely correct...I missed that...


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 5

Sea-Haven
Mentor
Mentor

Try to avoid making a new defun as the name of a function that already exists.

 

c:DATE

SeaHaven_0-1651732747137.png

 

0 Likes