Jump to content

Recommended Posts

Posted

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

Posted

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?

Posted

Why not just insert the block as an XRef instead of a block?

Posted

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

Posted

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

Posted

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.

Posted

i'll need help with what u said

Posted
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.

Posted
i'll need help with what u said
You really need to hit the quote button when replying to a person's comment. It's kind of confusing.
Posted
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.

Posted

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.

Posted
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.

Posted

I'm confused, if the block gets tweaked per each project/drawing, what about the block(s) has to remain the same throughout?

Posted

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.

Posted

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.

Posted

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

Posted

Thanks ! I will try.

 

Please try the updated code above. :)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...