Extract metadata from dwg file

How to extract metadata such as author, createddate, modified date, lastauthor etc from dwg file?

I have tried following code:
var image = Aspose.CAD.Image.Load(“DWG_FILE_PATH”) as Aspose.CAD.FileFormats.Cad.CadImage;
var props = image.Header.HeaderProperties;
foreach (var prop in props)
{
if (prop.Key == CadHeaderAttribute.LASTSAVEDBY)
{
string lastsavedby = prop.Value.ToString();
}
if (prop.Key == CadHeaderAttribute.SUBJECT)
{
string subject = prop.Value.ToString();
}
if (prop.Key == CadHeaderAttribute.TITLE)
{
string title = prop.Value.ToString();
}
if (prop.Key == CadHeaderAttribute.KEYWORDS)
{
string keywords = prop.Value.ToString();
}
if (prop.Key == CadHeaderAttribute.TDUCREATE || prop.Key == CadHeaderAttribute.TDCREATE)
{
double value = ((CadDoubleParameter)prop.Value[0]).Value ;
DateTime ds = DateTime.FromOADate(value);
}
}

Please help.

Regards,
Balmukunda

@Balmukunda,

Can you please share source DWG file. We will investigate this on our end if it is possible using Aspose.CAD to help you out.

Samples are attached.
Also when date properties (like createddate, modifieddate) are extracted using cad header properties CadHeaderAttribute.TDUCREATE and CadHeaderAttribute.TDUPDATE, it extracted double value(e.g. 2453511.9563217941). When this resultant double value is converted using DateTime.FromOADate(value), it resulted following invalid datetime. Could you please help how such double datetime value can be converted into valid datetime.
11/9/8616 12:43:12 PM
3/3/8617 4:36:07 PM

Thanks in advance.
DWG_samples.zip (86.7 KB)

@Balmukunda,

I have observed your requirements. An investigation ticket with ID CADNET-812 has been created in our issue tracking system to investigate to help you out in this issue. This thread has been linked with the issue so that you may be notified once investigation is completed.

We saw this fixed in version 19.7. We are now able to extract metadata like subject, title, comments, lastauthor, keywords etc. But still we are not able to convert the floating point datetime returned by Aspose into valid datetime.
We used CadHeaderAttribute TDUCREATE and TDUPDATE and tried to convert using DateTime.FromOADate(value).

@Balmukunda,

I suggest you to please try using following sample code.

using (CadImage image = (CadImage)Image.Load(fileName))
{
CadSummaryInfo summary = image.Header.SummaryInfo;
}

CadSummaryInfo class contains various metadata information

Thanks. It worked.

@Balmukunda,

It’s good to know that suggested options have worked on your end.

Hi,
I have attached some dwg files which have LastAuthor metadata but Aspose was unable to extract it.
Can you please look on this?

Thanks
.Last_Author_Not_Extracted.zip (481.9 KB)

@Balmukunda,

I have observed the requirements shared and an issue with ID CADNET-839 has been created in our issue tracking system to investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

Can you please give us some estimates when we can expect the fix?

@Balmukunda,

I like to inform that in Aspose.CAD forum the issues are selected for investigation on first come first serve basis. Also the first priority for scheduling and resolution is given to paid Enterprise and priority support customers. Then Aspose.CAD normal or free support customers issues are scheduled and resolved on first come and first come serve basis. I will share the further information with you as soon as the issue will be resolved.

The issues you have found earlier (filed as CADNET-812) have been fixed in this update.

The issues you have found earlier (filed as CADNET-839) have been fixed in this update.