VLA-SAVEAS does not update creation date system variables?

VLA-SAVEAS does not update creation date system variables?

JBerns
Advisor Advisor
1,198 Views
8 Replies
Message 1 of 9

VLA-SAVEAS does not update creation date system variables?

JBerns
Advisor
Advisor

Dear Community,

 

I create a new drawing from a template. It was created October 30, 2019 or 10/30/2019.

Next, I use the Visual LISP tool, VLA-SAVEAS, to save the drawing. Today is/was November 25, 2019 or 11/25/2019.

 

(vla-SaveAs (vla-get-ActiveDocument (vlax-get-acad-object)) "C:/Users/Jberns/Desktop/test001.dwg")

The CDATE reports the correct date when typed at the Command Prompt.

2019-11-25_16-40-52.png

 

However, using a FIELD object that uses the creation date system variable (CDATE), returns the creation date of the template, NOT the current drawing.

2019-11-25_16-38-19.png

 

If I use the AutoCAD SAVEAS command, the FIELD object reports the correct date.

 

What else do I have to perform with VLA-SAVEAS to get the correct creation date values for use by FIELD objects?

 

I have attached the template for you to test. When you download or save the template, it will use today's date. You will need to use a file date editor to change the date and then see the effects.

 

Thanks for your time and attention. I look forward to a solution.

 

 

Kind regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
0 Likes
Accepted solutions (1)
1,199 Views
8 Replies
Replies (8)
Message 2 of 9

CodeDing
Advisor
Advisor

@JBerns ,

 

Try calling a REGEN after your SAVEAS. That normally solves issues like this for me.

 

Best,

~DD

0 Likes
Message 3 of 9

JBerns
Advisor
Advisor

@CodeDing,

 

Neither REGEN nor REGENALL will update the date information.

 

I created a video showing the behavior:

https://knowledge.autodesk.com/community/screencast/b047a02c-e719-4fd0-be06-531bf51a20a6 

 

I even tested this behavior:

  1. Open existing drawing.
  2. Add a FIELD object that uses Creation Date. (Note the correct date)
  3. Use the Visual LISP VLA-SAVEAS command (see code above).
  4. REGENALL.

In my experience, the FIELD now shows the creation date of the drawing from Step 1. Shouldn't it show the current date?

 

Now perform a SAVEAS command and the FIELD object shows the correct creation date.

 

Why does VLA-SAVEAS not set the correct creation date? Do I need to update some other system variable?

 

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
0 Likes
Message 4 of 9

CodeDing
Advisor
Advisor

@JBerns ,

 

<ignore> ...I have been able to duplicate your issue, I'll keep working it.

 

Best,

~DD

0 Likes
Message 5 of 9

JBerns
Advisor
Advisor

@CodeDing,

 

Did you test sequential drawings?

 

I added more notes in the body of the screencast post.

 

Creation date is correct in first drawing after starting AutoCAD, but fails in subsequent drawings created.

 

(Great job on the animated thumbs up though 😊)

 

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Message 6 of 9

CodeDing
Advisor
Advisor

@JBerns ,

 

I can't seem to find out WHY, but perhaps this goes into Windows Explorer and how it stores information?

See image, the left box is from my DWGPROPS, the center are fields, and the right box is the properties box from Windows Explorer. I created this template at 10:06... but created the "test123" dwg at 11:08. So I'm not sure why Windows Explorer would be saying that THAT particular file was created at 10:06 (when it was truly created at 11:08)??

 

So I believe if you can answer that question, you can solve your answer Lol. Not that it will be easy, but perhaps it gets you in the right direction.

Capture.PNG

Best,

~DD

0 Likes
Message 7 of 9

JBerns
Advisor
Advisor

@CodeDing,

 

Thank you for looking into this issue. Always helpful to know it is reproducible on another computer.

I hope others may have time to review and can find a solution.

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
0 Likes
Message 8 of 9

JBerns
Advisor
Advisor
Accepted solution

@CodeDing,

 

I'm not sure how I missed this post during my initial internet search, but here is a similar issue that @Anonymous  was having with creation date system variables in a title block.

https://forums.autodesk.com/t5/autocad-lt-forum/create-date-insert-field-changes-when-drawing-modified/td-p/6038897 

 

I used this DIESEL expression to get, what appears for now to be, an accurate creation date with VLA-SAVEAS.

$(edtime, $(getvar,tdcreate),MO/DD/YYYY)

 

For more info on edtime formatting, refer to this site:

https://knowledge.autodesk.com/support/autocad-lt/learn-explore/caas/CloudHelp/cloudhelp/2019/ENU/AutoCAD-LT/files/GUID-F94A885A-4DA2-432B-AC1A-EB49CC6C1C72-htm.html 

 

I hope this is helpful.

 

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Message 9 of 9

CodeDing
Advisor
Advisor

@JBerns ,

 

I'm glad you found your solution, but that doesn't explain why it was messed up in my image then Lol! Perhaps I did something wrong? I had found that post and tried to mess around with it in my template. I guess since I didn't see any results from my end, I never thought to mention it. Cheers!

 

Best,

~DD

0 Likes