Jump to content

Recommended Posts

Posted

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?

  • 1 month later...
Posted

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?

Posted

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.

Posted

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. :)

Posted

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;

?ui=2&ik=45736e223d&view=att&th=13e22efc4ff6310a&attid=0.0.1&disp=emb&zw&atsh=1

I would also like the time to appear DD/MM/YYYY

Regards,

Conor

Posted

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))

Posted

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))

  • 3 months later...
Posted

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??

Posted

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?

Posted

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?

Posted

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`

Posted

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. :)

Posted

Thanks Tuns, I'll get onto Lee hopefully he has come up with something.

Posted

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

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

Posted
Would it be OK if I downloaded your brain into mine?

 

I hope you like tea ;) :lol:

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