So I want to write a quick little log when I open drawings and I want it to run automatically but only if the drawing name is not equal to "drawing..." since Civil 3D always starts with drawing1 and any new drawings are named drawing2, drawing3, etc. It seems to always evaluate yes even in drawings named "Drawing1". What am I doing wrong?
(vl-load-com) (defun toDate (var format) (menucmd (strcat "m=$(edtime,$(getvar," var ")," format ")")) );defun (defun C:CSW-Make_User_Log_On_Open () (if (/= (getvar "dwgname") "Drawing*") (progn (setq log (open (strcat "U:/IND-CAD-DIR/Z-User_Log/" (getvar "loginname") "-log.csv") "a")) (write-line (strcat "DRAWING OPENED:," (getvar "dwgprefix") (getvar 'DWGNAME) "," "DATE:," (toDate "DATE" "MO-DD-YYYY HH") ":" (toDate "DATE" "MM") "," "EDIT TIME:," (rtos (acet-edittime-total) 2 8) "\n") log) (close log) );progn );if (princ) );defun
Solved! Go to Solution.
Solved by pbejse. Go to Solution.
@scotts wrote:So I want to write a quick little log when I open drawings and I want it to run automatically but only if the drawing name is not equal to "drawing..." since Civil 3D always starts with drawing1 and any new drawings are named drawing2, drawing3, etc. It seems to always evaluate yes even in drawings named "Drawing1". What am I doing wrong?
look into (getvar 'DWGTITLED)
As for your code
(not (wcmatch (getvar "dwgname") "Drawing*"))
Thanks I can get it to evaluate correctly, but it still doesn't run the code if it evaluates to true. I'm guessing I'm not using the progn function properly.
@scotts wrote:Thanks I can get it to evaluate correctly, but it still doesn't run the code if it evaluates to true. I'm guessing I'm not using the progn function properly.
You can do it. what will be the resullt for (rtos (acet-edittime-total) 2 8)? that doesnt to work for me here
Edit: (acet-edittime-enable 1) need this to work on my cad
it appears to be working here scotts
I think it will nil out if your drawing doesn't have edittime set to on and the drawing hasn't been saved (with edittime on).
-Scott
Got it to work. I was using "1" instead of just 1 for the evaluation. Got to watch my syntax. Thanks for your help, now to create a reactor that will run it when i close a drawing!