Page 1 of 1
Import CADInsert
Posted: 20 Oct 2009, 20:00
by massimo
I'm having trouble importing an "Insert" object from a "dwg" file.
I iterate all object in all layers of my dwg file but the iterator seems to skip the "Insert" object.
To read all objects i use this code:
Code: Select all
private CADImage image;
image.Converter.AutoInsert = true; // to get all the elements inside of inserts
image.Converter.Iterate(ReadCADEntities, null, cadParams);
and inside ReadCADEntities i check all EntityType.
What am i doing wrong?
Thank you.
Massimo
Re: Import CADInsert
Posted: 23 Oct 2009, 12:50
by support
Hello.
Your code is incorrect. DWG must be loaded to object of DWGImage class, which is a descendant of CADImage. For this purpose please use DWGImage.LoadFrom... method. The DWGImage.Converter.Iterate doesn't load entities, but converts DWG tree structure to a linear sequence of entities. Also setting the DWGImage.Converter.AutoInsert = true leads to delegate doesn't reference any methods for the CADInsert object.
Please see our demos' sources.
Alexander.
Re: Import CADInsert
Posted: 27 Oct 2009, 17:24
by massimo
Thanks, DWGImage worked.
But once i have the CADInsert entity, how am i supposed to transfer it to my pdf file i'm trying to generate?
It seems like the only information i have is the box that contains the entity.
Thanks
Re: Import CADInsert
Posted: 28 Oct 2009, 12:20
by support
Currently conversion to PDF doesn't supported. You can convert your image to DXF, EMF, WMF and raster formates. However, you can use ABViewer for conversion to PDF.
Alexander.
Re: Import CADInsert
Posted: 28 Oct 2009, 13:04
by massimo
Thanks for the answer.
Is there a way i can export the exact dwg file to a pdf file? Is there an "ExportPdf" method that I can use?
Thanks
Massimo
Re: Import CADInsert
Posted: 28 Oct 2009, 13:43
by support
No, there is no such method. You can't save as PDF, but to listed formats only. We plan to implement saving to PDF in the future versions.
Alexander.
Re: Import CADInsert
Posted: 29 Oct 2009, 11:39
by massimo
Hello,
i tried using this code:
Code: Select all
CADImage image = CADImage.CreateImageByExtension(dwgFile);
image.LoadFromFile(dwgFile);
using (StreamWriter io = new StreamWriter(pdfFile + "export.pdf", false))
{
CADToPDF toPdf = new CADToPDF(image);
toPdf.SaveToStream(io);
}
image.Dispose();
But this code gives me an error saying that index is out of range.
Could this work as a direct export to a pdf file?
Thanks.
Massimo
Re: Import CADInsert
Posted: 29 Oct 2009, 17:13
by support
Hello.
PDF is a vector graphics file format created by Adobe Systems. Did you know this format specification? Until you have library for correct conversion to PDF it's only wasting of time.
Alexander.
Re: Import CADInsert
Posted: 30 Oct 2009, 12:42
by massimo
Hello,
sorry, but i don't understand your last reply.
I tryied reading a dwg file and parsing all single entyties one by one using DWGImage but when it comes to CADInsert entyties it seems like i cannot do anything with it. But the rest of the pdf file i'm generating is correct and it's a vector graphic.
So i tryied using CADToPDF library (considering the name it looks like from a CAD file i can get a PDF file) but i get an error when i use the "SaveToStream" method.
Are you saying that i'm waisting my time using the CADToPDF library? So what is this library for?
Thank you
Massimo
Re: Import CADInsert
Posted: 30 Oct 2009, 13:27
by support
Hello Massimo.
Officially CAD Import .NET doesn't support export to PDF. This functional included into assembly, but it's unfinished and untested yet. And we can't guarantee correct saving to PDF.
Alexander.