Visual LISP, AutoLISP and General Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Do this if the drawing name is not equal to this...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.
Re: Do this if the drawing name is not equal to this...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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*"))
Re: Do this if the drawing name is not equal to this...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.
Re: Do this if the drawing name is not equal to this...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
Re: Do this if the drawing name is not equal to this...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
Re: Do this if the drawing name is not equal to this...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
scotts wrote: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
Yup. i would suggest you use
(if (= (getvar 'DWGTITLED) 1) ;1 means the drawing have been saved
(do this)
Re: Do this if the drawing name is not equal to this...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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!![]()
Re: Do this if the drawing name is not equal to this...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
scotts wrote: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!
Good for you, Glad i could help
Cheers
