schmilla Posted July 6, 2010 Posted July 6, 2010 i need an automatic time stamp for when i edit a block. i tend to use the block over several drawings and can't always keep each dwg up to date. is there a variable somewhere that inputs the edit time NOT the "save the whole drawing time" or the "create time." if there was a time stamp variable or LISP or MACRO or whatever that stamps each time i say "save changes" from the block editor dialog then i could pull a report of all the drawings and see which blocks are out of date. let me know how i can achieve this - Thanks Quote
Lee Mac Posted July 6, 2010 Posted July 6, 2010 Reactor triggered by the CommandEnded of the Block Editor, creating text/attribute with contents manipulated by an edtime DIESEL expression using the DATE sys var perhaps? Quote
alanjt Posted July 6, 2010 Posted July 6, 2010 Why not just insert the block as an XRef instead of a block? Quote
Tharwat Posted July 6, 2010 Posted July 6, 2010 You can insert the following Deisel code into rtext in Autocad and you will get automatically the File name, date, and the current time updated. Enjoy... Drawing File: $(GETVAR, "DWGNAME") ! $(EDTIME, 0, MON DD"," YYYY ! H:MMAM/PM) regards Tharwat Quote
schmilla Posted July 6, 2010 Author Posted July 6, 2010 Thanks but the script seems to always tell me what time it is and not when i last edited the block - i seconds to the string and hit regen when out of the block and it always tells the current time - kinda funny but not what i'm looking for Quote
schmilla Posted July 6, 2010 Author Posted July 6, 2010 because i would have tons of xrefs in one drawing that i am xrefing out to several other sheet files and details drawings. i have not put auto cad to through this kind of test and i fear that it would fail under the stress of my huge project. Quote
alanjt Posted July 6, 2010 Posted July 6, 2010 because i would have tons of xrefs in one drawing that i am xrefing out to several other sheet files and details drawings. i have not put auto cad to through this kind of test and i fear that it would fail under the stress of my huge project. We're talking about a block, not some HUGE DWG being XRef'ed into another DWG. Mechanical people do it all the time. Quote
alanjt Posted July 6, 2010 Posted July 6, 2010 i'll need help with what u saidYou really need to hit the quote button when replying to a person's comment. It's kind of confusing. Quote
schmilla Posted July 6, 2010 Author Posted July 6, 2010 Reactor triggered by the CommandEnded of the Block Editor, creating text/attribute with contents manipulated by an edtime DIESEL expression using the DATE sys var perhaps? I am interested in this but need it explained. Quote
alanjt Posted July 6, 2010 Posted July 6, 2010 I can't believe you're even considering something other than an XRef. Not only do you remove all issue of possibly having an old block, but you also remove all work of replacing an old block with a new one. I've made my case and now I'm done. Quote
schmilla Posted July 6, 2010 Author Posted July 6, 2010 I can't believe you're even considering something other than an XRef. Not only do you remove all issue of possibly having an old block, but you also remove all work of replacing an old block with a new one. I've made my case and now I'm done. ok well in my case i have a detail that has 5 different blocks some that are dynamic and some not - i often make adjustments to each one of the blocks as well as the detail - the detail is a block that has visibility states associated with it and i use all over the project. so, if i xref each of the 5 blocks into the one block then xref the one block into the 5 drawings then xref the 5 dwgs into more dwgs i'm not going to see any issues somewhere down the line then i'll seriously consider it but for now that is not how i have been working and thought there might be a time stamp thingy out there. Quote
alanjt Posted July 6, 2010 Posted July 6, 2010 I'm confused, if the block gets tweaked per each project/drawing, what about the block(s) has to remain the same throughout? Quote
Lee Mac Posted July 6, 2010 Posted July 6, 2010 As an exercise in academia: (defun c:BCloseReactor nil (vl-load-com) ;; © Lee Mac 2010 ( (lambda ( data foo / react ) (if (setq react (vl-some (function (lambda ( reactor ) (if (eq data (vlr-data reactor)) reactor) ) ) (cdar (vlr-reactors :vlr-command-reactor) ) ) ) (if (vlr-added-p react) (vlr-remove react) (vlr-add react) ) (setq react (vlr-command-reactor data (list (cons :vlr-CommandEnded foo) ) ) ) ) (princ (if (vlr-added-p react) "\n** Reactor Activated **" "\n** Reactor Deactivated **" ) ) react ) "BClose-Reactor" 'BClose-Callback ) (princ) ) (defun BClose-Callback ( reactor arguments / ss ) (vl-load-com) ;; © Lee Mac 2010 (if (wcmatch (strcase (car arguments)) "*BCLOSE") (progn (if (setq ss (ssget "_X" '((0 . "TEXT") (8 . "$$-TIMESTAMP-$$") (410 . "Model")))) (ApplyFootoSS (lambda ( x ) (entdel x)) ss) ) (entmakex (list (cons 0 "TEXT") (cons 8 "$$-TIMESTAMP-$$") (cons 10 '(0. 0. 0.)) (cons 40 (getvar 'TEXTSIZE)) (cons 410 "Model") (cons 1 (strcat "Updated: " (menucmd (strcat "m=$(edtime,$(getvar,DATE),DD.MO.YYYY HH:MM:SS)") ) ) ) ) ) ) ) (princ) ) (defun ApplyFootoSS ( foo ss ) ;; © Lee Mac 2010 ( (lambda ( i / e ) (while (setq e (ssname ss (setq i (1+ i)))) (foo e)) ) -1 ) ) Will create text @ 0,0,0 - using TEXTSIZE Sys Var. Quote
ectech Posted July 7, 2010 Posted July 7, 2010 I'm trying to run the lisp and close the file after that re-open the file again. it can't found the text. But I use erase all command, it found 2 objects were not in current space. The text will created in ? Thanks ! As an exercise in academia: (defun c:BCloseReactor nil (vl-load-com) ;; © Lee Mac 2010 ( (lambda ( data foo / react ) (if (setq react (vl-some (function (lambda ( reactor ) (if (eq data (vlr-data reactor)) reactor) ) ) (cdar (vlr-reactors :vlr-command-reactor) ) ) ) (if (vlr-added-p react) (vlr-remove react) (vlr-add react) ) (setq react (vlr-command-reactor data (list (cons :vlr-CommandEnded foo) ) ) ) ) (princ (if (vlr-added-p react) "\n** Reactor Activated **" "\n** Reactor Deactivated **" ) ) react ) "BClose-Reactor" 'BClose-Callback ) (princ) ) (defun BClose-Callback ( reactor arguments / ss ) (vl-load-com) ;; © Lee Mac 2010 (if (wcmatch (strcase (car arguments)) "*BCLOSE") (progn (if (setq ss (ssget "_X" '((0 . "TEXT") (8 . "$$-TIMESTAMP-$$")))) (ApplyFootoSS (lambda ( x ) (entdel x)) ss) ) (entmakex (list (cons 0 "TEXT") (cons 8 "$$-TIMESTAMP-$$") (cons 10 '(0. 0. 0.)) (cons 40 (getvar 'TEXTSIZE)) (cons 1 (strcat "Updated: " (menucmd (strcat "m=$(edtime,$(getvar,DATE),DD.MO.YYYY HH:MM:SS)") ) ) ) ) ) ) ) (princ) ) (defun ApplyFootoSS ( foo ss ) ;; © Lee Mac 2010 ( (lambda ( i / e ) (while (setq e (ssname ss (setq i (1+ i)))) (foo e)) ) -1 ) ) Will create text @ 0,0,0 - using TEXTSIZE Sys Var. Quote
Tharwat Posted July 7, 2010 Posted July 7, 2010 Here is the field in a block and you can modify it by the command field update to be up-to-date ........ check the attached drawing.... Tharwat Tharwat.dwg Quote
ectech Posted July 8, 2010 Posted July 8, 2010 Thanks ! I will try. Please try the updated code above. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.