Update "DATE" field via lisp routine
Update "DATE" field via lisp routine
(OP)
Since this thread has been closed:
ht tp://www.t ek-tips.co m/viewthre ad.cfm?qid =1005434&a mp;page=26
I'm needing assistance to have our date field updated automatically.
What I have done is used a date field and I have to manually update this field to show the current date. This lisp routine looks like a time saver but I'm having issues using it.
Please help.
ht
I'm needing assistance to have our date field updated automatically.
What I have done is used a date field and I have to manually update this field to show the current date. This lisp routine looks like a time saver but I'm having issues using it.
Please help.
RE: Update "DATE" field via lisp routine
According to help, "Note-The Date field is updated by UPDATEFIELD, but it is not updated automatically based on the setting of the FIELDEVAL system variable."
How/when would you want this field/date updated? Is this for one particular drawing, or for many drawings, and a common block, or...
A routine could be made that is initiated with a command; or on opening a file. If you wanted it updated automatically upon, say plotting, I believe it would take a reactor.
RE: Update "DATE" field via lisp routine
Whenever a new drawing is open I would like our print-status date to be updated.
We send updated prints to our PM's and field hands and the print status date shows them the latest drawing they need to be referring to.
It would multiple drawings at certain times.
We have a template setup and this date would be in this template.
Reactor? Please elaborate more . . .
RE: Update "DATE" field via lisp routine
So back to your template, I assume this is a block with attributes, or a separate mtext field? How do you manually update the date, do you run UPDATEFIELD and select this block? I'm thinking the lisp routine would duplicate the manual method, except the block name would be provided in the code. This code would be executed on opening a drawing, so it runs automatically.
RE: Update "DATE" field via lisp routine
I'm following you so far
Thats why I thought the link I provided would help, it could either run automatically (which I prefer) or run as a lisp routine and we key it in.
Thanks in advance!
RE: Update "DATE" field via lisp routine
CODE
(setq tb_set (ssget "_X" (list '(0 . "INSERT") (cons 2 "Title_block_name_here"))))
(if tb_set
(command "._UPDATEFIELD" (ssname 0 tb_set) ""))
)
(princ)
)
Modify code above to replace "Title_block_name_here" with the titleblock's block name. Save the text to a text file, save with any desired name with a ".lsp" extension. Load the lisp, run it by typing "upd". (alternatively for testing purposes could copy & paste the code to the command line)
RE: Update "DATE" field via lisp routine
It will do the same thing if I was to type in updatefield.
But I guess like you said, we can tweek this lisp so it will run upon opening a any drawing everytime. Even any previous saved drawing(s)?
See attached file for reference
RE: Update "DATE" field via lisp routine
CODE
(setq tb_set (ssget "_X" (list '(0 . "INSERT") (cons 2 "block_name_here"))))
(if tb_set
(command "._UPDATEFIELD" (ssname tb_set 0) "")
)
(princ)
)
RE: Update "DATE" field via lisp routine
[Command: upd
._UPDATEFIELD
Select objects: 1 found
Select objects:
0 field(s) found.
0 field(s) updated. ]
Any ideas?
RE: Update "DATE" field via lisp routine
Looks like the block is getting selected but the field is not found/updated. Are you sure the date field is really an attribute versus some stand alone mtext field? If this is the case, the code could change to select all mtext:
CODE
(setq mt_set (ssget "_X" '((0 . "MTEXT"))))
(if mt_set
(command "._UPDATEFIELD" mt_set "")
)
(princ)
)
RE: Update "DATE" field via lisp routine
Could the lisp you provided read within the attribute which tag to change? If so, that would be great. Because the title blocks tags can all stay as one attribute block and the lisp could read withing the block and look for the date tag and update that?
RE: Update "DATE" field via lisp routine
Also, the tag I want updated is "STATUSDATE"
RE: Update "DATE" field via lisp routine
RE: Update "DATE" field via lisp routine
What would be most helpful would be if you could send me a drawing,
c a b AT e e i t e a m DOT c o m
RE: Update "DATE" field via lisp routine
1. Seeing it is a block with attributes it should have worked if you edited the code for block name
(0 . "INSERT") (cons 2 "Vac Title Block_Original")
2. In the editor dialogue box at the link, no "value" is shown for he "date" tag, is that correct? With my test the last updated date would show up as the value.
RE: Update "DATE" field via lisp routine
The Template dwt
Title block is inserted into the paperspace as an insert,
within the actual template. This is kept as a block and not exploded.
Now the statusdate in the title block has a date field in it. I dont update the title block's statusdate but I update the date field with "UPD".
It ask for me to select it and it will change.
So, what i did was revert back to our original TB and removed the date field from the template so I could update the statusdate within the title block.
The command line prompts me this:
Command: upd
._UPDATEFIELD
Select objects: 1 found
1 was not in current space.
RE: Update "DATE" field via lisp routine
I really need to sse the setup, I'd be gals to look at if you email me an example drawing to address I posted above.
RE: Update "DATE" field via lisp routine