Conor Posted March 5, 2013 Posted March 5, 2013 Hi, I hope you can help. I have created buttons which create custom properties in the DWGPROPS. I would now like to add another custom properties which shows the Current Time (not to be updated). Can this be done? Quote
bgingerich Posted April 12, 2013 Posted April 12, 2013 Just to understand your question a bit better. What do you mean by the "Current time" and what is its purpose? Is this a button that will insert the "current time" (the time at which the button was pushed) into a custom drawing property? Or something else? Maybe CDATE? Quote
Conor Posted April 17, 2013 Author Posted April 17, 2013 Hi bgingerich, Thanks for your reply. I require the current time when I select the button. I add addional data to DWGPROPS and it is important that the time the data was added in noted. Quote
bgingerich Posted April 17, 2013 Posted April 17, 2013 I don't know what language you're using to put these properties but in LISP, this would return the current date in the format "mm/dd/yy": (strcat (substr (getvar cdate) 5 2) "/" (substr (getvar cdate) 7 2) "/" (substr (getvar cdate) 3 2)) Hopefully that gets you on the right track. Quote
Conor Posted April 20, 2013 Author Posted April 20, 2013 Thank bgingerich, Let me explain exactly what I am trying to do. I run a lsp which allows me to add information to dwg properties. This updates the status of the file; I starts at ‘stage 1’, this is replaced by ‘stage 2’ etc. So I require an additional custom property to show the time when the file stage was upgraded. So currently I use the line below in the cui file to add the stage. C^C(LOAD "AssignStatus.lsp");sfld;yes;Drawing Status;STAGE 1 COMPLETE;;No; If I use the same idea for the time, it loads placed the formula instead of the value. ^C^C(LOAD "P:/Assigntime.lsp");sfld;yes;TIME; (LOAD "P:/Assigntime.lsp");;No; I would also like the time to appear DD/MM/YYYY Regards, Conor Quote
bgingerich Posted April 22, 2013 Posted April 22, 2013 Being able to see that lisp file would help a lot. BTW. This will return the date in the format you requested: DD/MM/YYYY (strcat (substr (getvar cdate) 7 2) "/" (substr (getvar cdate) 5 2) "/" (substr (getvar cdate) 1 4)) Quote
Conor Posted April 23, 2013 Author Posted April 23, 2013 Thanks for the Time format, I'll use it. The code I am using is below. It is lsp which I load up using: ^C^C(LOAD "P:/Assigntime.lsp");sfld;yes;TIME; (LOAD "P:/Assigntime.lsp");;No; Lsp; (defun c:sfld (/ ftitle fauthor fsubject fproj infoobj num num1 deside deside1 deside2 fld fldv pop) (vl-load-com) (setq FTITLE " ")(setq FAUTHOR "Ciaran McCreary")(setq FSUBJECT " ")(setq FPROJ " ") (setq infoObj (vla-get-SummaryInfo (vla-get-activeDocument (vlax-get-acad-object)))) (vla-put-Title infoObj FTITLE) (vla-put-Author infoObj FAUTHOR) (vla-put-Subject infoObj FSUBJECT) (vla-put-KeyWords infoObj FTITLE) (vla-put-Comments infoObj FPROJ) (setq num (vla-NumCustomInfo infoObj))(if(> num 0)(progn (setq num1 (rtos num 2 0)) (setq question (strcat "You have " num1 " CUSTOM FIELDS do you want to preview them? : ")) (initget 1"Yes No") (setq deside1 (getkword question)) (if (= deside1 "Yes")(command "dwgprops")))) (initget 1 "Yes No") (setq deside2 (getkword "\nDo you want create custom FIELD? : ")) (if (= deside2 "No")(quit)) (while(setq FLD (getstring T "\nField NAME : "))(if (= fld "")(setq fld "XXX"))(setq FLDV(getstring T "\nField VALUE : "))(if (= fldv "")(setq fldv "XXX"))(vla-addCustomInfo infoObj FLD FLDV) (setq pop (strcat "%\\AcVar CustomDP." fld ">%")) (setq PT (getpoint "\nField Insertion Point: "))(command"mtext" pt "w" "0" pop "") (initget 1 "Yes No") (setq deside (getkword "\nDo you want create another custom FIELD? : ")) (if (= deside "No")(quit))) (princ)) Quote
Conor Posted July 31, 2013 Author Posted July 31, 2013 Anyone have any thoughts on how to add the current time value in the custom field? Perhaps there is a better way t do this?? Quote
Tuns Posted July 31, 2013 Posted July 31, 2013 Maybe if you make it a little more difficult to read I could help... http://www.afralisp.net/autolisp/tutorials/date-and-time-stamping.php Quote
Conor Posted August 1, 2013 Author Posted August 1, 2013 Thanks for your response Tuns. I am able to calculate that time, (cdate is probably the best way ) however when I try to insert the the time value into the 'Drawing Properties' dialog box, the formula is displayed inplace of the time so now the value for time is 'cdate' Essential I just want to paste the current time value into a custom dwgprop. Is this possible? Quote
Tuns Posted August 1, 2013 Posted August 1, 2013 So you pretty much want to make a certain objects property the time you made it? Like Block A has a property of 11:30 A.M. or something? Quote
Conor Posted August 1, 2013 Author Posted August 1, 2013 Yes but not an object, the entire drawing property. So I assign 'Stage = 1' and 'Time = 11.30am 1st August 2013` Later this would become 'Stage = 2' and 'Time = 10th August 2013` Quote
Tuns Posted August 1, 2013 Posted August 1, 2013 Well I don't know if it's possible to make the time the actual property without changing some of the support files themselves... and that could be risky because if you mess something up it would mess AutoCAD up. I might be wrong in saying that but I can't see how it would be done without modifying those files. Another thing you can do is use a LISP that updates the time on... say... a menu outside of your drawing boundaries. Lee Mac has a LISP that makes a table that displays the area of the objects you select (Link). I'm sure that with a few changes to that you can make it list the time instead of the area. Ask Lee himself he's awesome at these things. Quote
Conor Posted August 1, 2013 Author Posted August 1, 2013 Thanks Tuns, I'll get onto Lee hopefully he has come up with something. Quote
Lee Mac Posted August 1, 2013 Posted August 1, 2013 I was not aware of the existence of this thread before receiving a recent visitor message; however, the OP had also contacted me directly through my site with this question and so I shall post my response for the benefit of the community here: In response to your question, you can convert the Julian date value of the DATE system variable into a human-readable Gregorian date format using the edtime DIESEL function (a reference for this function may be found here), which may be evaluated using the menucmd AutoLISP function. Hence, to obtain the date format shown in your message, you could use the following expression: (menucmd "m=$(edtime,$(getvar,date),H:MM AM/PM D MONTH YYYY)") However, note that this does not permit the use of the ordinal suffix (st/nd/rd/th). Quote
Tuns Posted August 1, 2013 Posted August 1, 2013 I was not aware of the existence of this thread before receiving a recent visitor message; however, the OP had also contacted me directly through my site with this question and so I shall post my response for the benefit of the community here: Would it be OK if I downloaded your brain into mine? Quote
Lee Mac Posted August 1, 2013 Posted August 1, 2013 Would it be OK if I downloaded your brain into mine? I hope you like tea Quote
SLW210 Posted August 2, 2013 Posted August 2, 2013 Conor, Please read the Code posting guidelines and edit your post to include the Code in Code Tags. 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.