Page 1 of 1

getting entites of .dwg-file without visual control

Posted: 18 Oct 2011, 10:32
by kap
Hello,

i want to get all the entities stored in one .dwg-file. Im using the current test version of the CADImport.NET.

If i load the file with the EditorDemo application, i can see all existing entities. If i start the following code, the entity-collection remains empty:

CADImport.CADImage cadImage = new CADImport.CADImage();

cadImage.LoadFromFile(@"C:\Temp\file.dwg");

CADEntityCollection entities = cadImage.Converter.Entities;

int x = entities.Count; // <---------- 0

Can anyone help me out?

Thanks,

Philipp

Re: getting entites of .dwg-file without visual control

Posted: 18 Oct 2011, 12:02
by support
Hello Philipp.
CAD Import .NET allows import files of different formats, for example DXF, DWG, PLT etc. The library contains the set of classes derived from CADImage. Each class provided for import data from single supported format. For example, DWG can be imported to object of DWGImage class only. We recommend using CADImage.CreateImageByExtension method to specify required class:

Code: Select all

CADImport.CADImage cadImage = new CADImport.CADImage();
cadImage = CADImage.CreateImageByExtension(@"C:\Temp\file.dwg");
cadImage.LoadFromFile(@"C:\Temp\file.dwg");
Another way is create an object of DWGImage class instead CADImage.

Alexander.

Re: getting entites of .dwg-file without visual control

Posted: 18 Oct 2011, 13:17
by kap
Hello Alexander,

thank you very much.

Best regards,

Philipp