Hi,
Is it possible to Get Create Date and Time without open drawing using GETSYSTEMVARIABLE("TDCREATE")?
ie. Open drawing in memory and Receive Date and Time.
Give me suggestion.
Thanks,
thenndral
Solved! Go to Solution.
Solved by Ajilal.Vijayan. Go to Solution.
Try this .
Dim Side_dbase As Database = New Database(False, True) Dim EX As Autodesk.AutoCAD.Runtime.Exception = New Autodesk.AutoCAD.Runtime.Exception Try Side_dbase.ReadDwgFile("FileName", FileOpenMode.OpenForReadAndWriteNoShare, True, "") MsgBox(Side_dbase.Tdcreate) Side_dbase.Dispose() Catch ex End Try
Hi Ajilal.Vijayan,
Thanks for your quick reply. Its works like a charm.
one more question. Is it possible to get millisecond from TDCREATE or other method?
I'm using C#, convert it into C#.
Here is the code for C# user[It may be helpful for someone]
[CommandMethod("TTS")] public void Time_tracking() { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; Database Side_dbase = new Database(false, true); Autodesk.AutoCAD.Runtime.Exception EX = new Autodesk.AutoCAD.Runtime.Exception(); try { string blockQualifiedFileName = "D:\\AutoCAD\\testing\\time_chk.dwg"; Side_dbase.ReadDwgFile(blockQualifiedFileName, FileOpenMode.OpenForReadAndWriteNoShare, true, ""); AcadApp.ShowAlertDialog("Created:" + Side_dbase.Tdcreate); Side_dbase.Dispose(); } catch { } }
Thanks in advance,
Thenndral.
Hi,
Thanks for your reply.
If I use the code. It retrieves Date in double.
AcadApp.ShowAlertDialog("Created :" + tmp_db.Tdcreate.ToOADate() + 2415018.5);
Please check the image file for retrieve result .
I convert Julian Date using below code. This code can convert upto seconds.
Could you tell me how to make in milliseconds.
private DateTime ConvertAcadJulianToDateTime(double julianDate) { DateTime date; try { double z = Math.Floor(julianDate); double w = Math.Floor((z - 1867216.25) / 36524.25); double x = Math.Floor(w / 4); double a = (z + 1 + w - x); double b = a + 1524; double c = Math.Floor((b - 122.1) / 365.25); double d = Math.Floor(365.25 * c); double e = Math.Floor((b - d) / 30.6001); double f = Math.Floor(30.6001 * e); int day = Convert.ToInt32(b - d - f); int m = Convert.ToInt32((e < 14) ? (e - 2) : (e - 14)); int month = (m + 1); int y = Convert.ToInt32((m > 1) ? (c - 4716) : (c - 4715)); int year = (y == 0) ? (y - 1) : y; // // strip the integer double t = (julianDate - z); // hours since midnight double hours = Math.Floor(t * 24.0); // temp value double mins = t - (hours / 24.0); // 1440 minutes per day double minutes = Math.Floor(mins * 1440.0); // double seconds = Math.Floor((mins - (minutes / 1440.0)) * 86400.0); //86400000 = 1day date = new DateTime(year, month, day, Convert.ToInt32(hours), Convert.ToInt32(minutes), Convert.ToInt32(seconds)); return date; } catch (ArgumentOutOfRangeException ex) { AcadApp.ShowAlertDialog("Julian date could not be converted:\n" + ex.Message); date = new DateTime(0); } catch (Exception ex) { AcadApp.ShowAlertDialog("Error converting Julian date:\n" + ex.Message); date = new DateTime(0); } return date; }
Thanks in advance,
thenndral
Try with this function
jul = tmp_db.Tdcreate.ToOADate() + 2415018.5)
Private Function Getmilsecond(ByVal jul As Double)
Dim mil As Double
Dim time As Double = (jul - Math.Floor(jul)) * 86400
Dim mm As Double = Math.Floor(time / 60)
mil = time - (mm * 60)
Return mil
End Function
Hi,
Thanks for your quick reply.
In my previous post code I can retrieve seconds from Julian date.
double seconds = Math.Floor((mins - (minutes / 1440.0)) * 86400.0); //86400000 = 1day date = new DateTime(year, month, day, Convert.ToInt32(hours), Convert.ToInt32(minutes), Convert.ToInt32(seconds));
In this code I'm getting seconds not milliseconds.
jul = tmp_db.Tdcreate.ToOADate() + 2415018.5) private object Getmilsecond(double jul) { double mil = 0; double time = (jul - Math.Floor(jul)) * 86400; double mm = Math.Floor(time / 60); mil = time - (mm * 60); return mil;
I need how to get millisecond from Julian Date.
for more information, Please see the image.
Thanks in advance,
thenndral
Hi,
That function will return the seconds from julian date with milliseconds
See the below results from a test drawing
Out from the funtion.
and output of autocad TIME command
Hi,
Thanks a lot for your quick reply and solution.
I got it.
I accept your solution.
Thanks again,
thenndral.
@thenndral wrote:Hi,
Thanks a lot for your quick reply and solution.
I got it.
I accept your solution.
Thanks again,
thenndral.
Glad to hear that !!
Can I get a copy of your app? I'd love to be able to quickly check TDCREATE values without having to open the dwgs. Thanks!