Exporting in DXF format
Moderators: SDS, support, admin
Exporting in DXF format
Hi All,
I am trying to export as dxf file using CADImport.dll. I followed below code.
String inFilePath;
inFilePath = @"C:\Users\Administrator\Desktop\Source\Image Files\Sample.tif";
string OutFilePath;
OutFilePath = @"C:\Users\Administrator\Desktop\Source\Drawing Files\Sample.dxf";
cadimg = CADImage.CreateImageByExtension(inFilePath);
cadimg.LoadFromFile(inFilePath);
CADImport.Export.DirectCADtoDXF.CADtoDXF cadexp= new CADImport.Export.DirectCADtoDXF.CADtoDXF(cadimg);
cadexp.SaveToFile(OutFilePath);
But I didn't get content of inputfile. Can any one suggest how to solve this issue? Thanks in advance
I am trying to export as dxf file using CADImport.dll. I followed below code.
String inFilePath;
inFilePath = @"C:\Users\Administrator\Desktop\Source\Image Files\Sample.tif";
string OutFilePath;
OutFilePath = @"C:\Users\Administrator\Desktop\Source\Drawing Files\Sample.dxf";
cadimg = CADImage.CreateImageByExtension(inFilePath);
cadimg.LoadFromFile(inFilePath);
CADImport.Export.DirectCADtoDXF.CADtoDXF cadexp= new CADImport.Export.DirectCADtoDXF.CADtoDXF(cadimg);
cadexp.SaveToFile(OutFilePath);
But I didn't get content of inputfile. Can any one suggest how to solve this issue? Thanks in advance
Re: Exporting in DXF format
Hello.
Tif is the raster format. A raster image can be added to DXF file as Image entity. CAD Import .NET provides CADImageEnt class that represents AutoCAD Image entity. DirectCADtoDXF class doesn't allow export raster files to DXF. This task can be completed by creating new CADImage object, adding a CADImageEnt object and export to DXF:
Alexander.
Tif is the raster format. A raster image can be added to DXF file as Image entity. CAD Import .NET provides CADImageEnt class that represents AutoCAD Image entity. DirectCADtoDXF class doesn't allow export raster files to DXF. This task can be completed by creating new CADImage object, adding a CADImageEnt object and export to DXF:
Code: Select all
if (this.cadImage == null)
{
this.cadImage = new CADImage();
this.cadImage.InitialNewImage();
}
CADImageEnt entRaster = new CADImageEnt();
string tmp = @"d:\1.jpg";
Bitmap bmpTmp;
if (!System.IO.File.Exists(tmp)) return;
try
{
bmpTmp = new Bitmap(tmp);
}
catch
{
return;
}
CADImageDef def = new CADImageDef();
def.FileName = tmp;
def.Loaded(this.cadImage.Converter);
entRaster.ImageDef = def;
entRaster.Color = CADConst.clNone;
entRaster.Size = new DPoint(bmpTmp.Width, bmpTmp.Height, 0);
entRaster.Loaded(this.cadImage.Converter);
this.cadImage.Converter.ImageDefs.Add(entRaster.ImageDef);
this.cadImage.Converter.OnCreate(entRaster);
this.cadImage.CurrentLayout.AddEntity(entRaster);
this.cadImage.GetExtents();
CADtoDXF vExp = new CADtoDXF(cadImage);
vExp.SaveToFile(@"d:\AddRaster.dxf");
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: Exporting in DXF format
Hi, Thanks for quick reply.
I tried your sample, but still I am not getting content of file. Here I ma trying in my sample web application. Here is my code
String inFilePath;
inFilePath = @"C:\Users\Administrator\Desktop\Image Files\Sample..tif";
string OutFilePath;
OutFilePath = @"C:\Users\Administrator\Desktop\Drawing Files\Sample.dxf";
CADImage cadimg = null;
if (cadimg == null)
{
cadimg = new CADImage();
cadimg.InitialNewImage();
}
CADImageEnt entRaster = new CADImageEnt();
CADImageDef Def = new CADImageDef();
Bitmap bmp;
if (System.IO.File.Exists(inFilePath))
{
bmp = new Bitmap(inFilePath);
Def.FileName = inFilePath;
Def.Loaded(cadimg.Converter);
entRaster.ImageDef = Def;
entRaster.Color = CADConst.clNone;
entRaster.Size = new DPoint(bmp.Width, bmp.Height, 0);
entRaster.Loaded(cadimg.Converter);
cadimg.Converter.ImageDefs.Add(entRaster.ImageDef);
cadimg.Converter.OnCreate(entRaster);
cadimg.CurrentLayout.AddEntity(entRaster);
cadimg.GetExtents();
CADtoDXF DXFExport = new CADtoDXF(cadimg);
DXFExport.SaveToFile(OutFilePath);
}
else
{
return;
}
Can any one please guide me. Thanks in advance.
I tried your sample, but still I am not getting content of file. Here I ma trying in my sample web application. Here is my code
String inFilePath;
inFilePath = @"C:\Users\Administrator\Desktop\Image Files\Sample..tif";
string OutFilePath;
OutFilePath = @"C:\Users\Administrator\Desktop\Drawing Files\Sample.dxf";
CADImage cadimg = null;
if (cadimg == null)
{
cadimg = new CADImage();
cadimg.InitialNewImage();
}
CADImageEnt entRaster = new CADImageEnt();
CADImageDef Def = new CADImageDef();
Bitmap bmp;
if (System.IO.File.Exists(inFilePath))
{
bmp = new Bitmap(inFilePath);
Def.FileName = inFilePath;
Def.Loaded(cadimg.Converter);
entRaster.ImageDef = Def;
entRaster.Color = CADConst.clNone;
entRaster.Size = new DPoint(bmp.Width, bmp.Height, 0);
entRaster.Loaded(cadimg.Converter);
cadimg.Converter.ImageDefs.Add(entRaster.ImageDef);
cadimg.Converter.OnCreate(entRaster);
cadimg.CurrentLayout.AddEntity(entRaster);
cadimg.GetExtents();
CADtoDXF DXFExport = new CADtoDXF(cadimg);
DXFExport.SaveToFile(OutFilePath);
}
else
{
return;
}
Can any one please guide me. Thanks in advance.
Re: Exporting in DXF format
Hello.
Please specify what did you mean by:
Alexander.
Please specify what did you mean by:
DXF file created? Is it contain source image?...still I am not getting content of file...
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: Exporting in DXF format
Hi,
DXF file was created. But it is not containing any source image.
DXF file was created. But it is not containing any source image.
Re: Exporting in DXF format
Hello.
The created file contains Image entity. It can be imported and displayed with CAD Import .NET. Unfortunately import/visualization in AutoCAD is incorrect. We will develop a solution for this problem.
Alexander.
The created file contains Image entity. It can be imported and displayed with CAD Import .NET. Unfortunately import/visualization in AutoCAD is incorrect. We will develop a solution for this problem.
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: Exporting in DXF format
Hi thanks for your response.
We are interested to take license version of CADImportnet.Net . So Can U tell me when will we expect solution for above problem. How much time will take approximately. So that we can take decision.
Our requirement is
1) Convert .tif (Any raster image) to .dxf
2) Convert .dxf to .jpg ( to view in browser)
3) Have to export in dxf, pdf, dwg etc.....
Can we achieve all above requirements using CADImport.Net. Can you clarify that please.
Looking for quick response. Thanks
We are interested to take license version of CADImportnet.Net . So Can U tell me when will we expect solution for above problem. How much time will take approximately. So that we can take decision.
Our requirement is
1) Convert .tif (Any raster image) to .dxf
2) Convert .dxf to .jpg ( to view in browser)
3) Have to export in dxf, pdf, dwg etc.....
Can we achieve all above requirements using CADImport.Net. Can you clarify that please.
Looking for quick response. Thanks
Re: Exporting in DXF format
Hello.
We plan to provide a solution within one-two weeks.
CAD Import .NET allows export raster images to DXF by adding Image entity to a drawing then export. DXF drawings can be exported to raster images that can be used with ASP.NET (viewing in browsers). The library provides export to DXF, PDF, HPGL/2, CGM vector formats. However export to DWG not allowed. Please inform us if the provided functionality is satisfactory for your task.
Alexander.
We plan to provide a solution within one-two weeks.
CAD Import .NET allows export raster images to DXF by adding Image entity to a drawing then export. DXF drawings can be exported to raster images that can be used with ASP.NET (viewing in browsers). The library provides export to DXF, PDF, HPGL/2, CGM vector formats. However export to DWG not allowed. Please inform us if the provided functionality is satisfactory for your task.
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: Exporting in DXF format
Hello.
We have found the cause of problem, image entity is exported with wrong flags. The problem is fixed. The solution will be available within next release version. You can set the flags value manually with current version to receive correct DXF drawing:
Alexander.
We have found the cause of problem, image entity is exported with wrong flags. The problem is fixed. The solution will be available within next release version. You can set the flags value manually with current version to receive correct DXF drawing:
Code: Select all
//...
entRaster.ImageDef = def;
entRaster.Color = CADConst.clNone;
entRaster.Size = new DPoint(bmpTmp.Width, bmpTmp.Height, 0);
// add this:
entRaster.Flags = 3;
entRaster.Loaded(this.cadImage.Converter);
//...
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support