getting entites of .dwg-file without visual control

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
kap
Posts: 2
Joined: 18 Oct 2011, 10:14

getting entites of .dwg-file without visual control

Post by kap » 18 Oct 2011, 10:32

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

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

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

Post by support » 18 Oct 2011, 12:02

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.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

kap
Posts: 2
Joined: 18 Oct 2011, 10:14

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

Post by kap » 18 Oct 2011, 13:17

Hello Alexander,

thank you very much.

Best regards,

Philipp

Post Reply