delphi中使用CADVCL 10.0 Enterprise控件解析DXF文件生成图片保存到本地

使用案例demos中GettingStarted案例
delphi中使用CADVCL 10.0 Enterprise控件解析DXF文件生成图片保存到本地_第1张图片
delphi中使用CADVCL 10.0 Enterprise控件解析DXF文件生成图片保存到本地_第2张图片
修改OnClick方法
更换代码

var
  vDrawing: TsgCADDXFImage;
  I: Integer;
  vEnt: TsgDXFEntity;
  vDXFImage:TsgCADImage;
  Bitmap: TBitmap;
  jpg: TJpegImage;
begin
  vDrawing := TsgCADDXFImage.Create;
  vDrawing.LoadFromFile('d:\Entities.dxf');
  for I := 0 to vDrawing.CurrentLayout.Count - 1 do
  begin
    vDXFImage := TsgCADImage.Create;
    vDXFImage.Converter.InitializeSections();
    vEnt := TsgDXFEntityClass(TsgDXFEntity(vDrawing.CurrentLayout.Entities[I]).ClassType).Create;
    vEnt.AssignEntity(TsgDXFEntity(vDrawing.CurrentLayout.Entities[I]));
    vDXFImage.Converter.OnCreate(vEnt);
    vDXFImage.Converter.Sections[csEntities].AddEntity(vEnt);
    vDXFImage.Converter.Loads(vEnt);
    vDXFImage.GetExtents;

    Bitmap := TBitmap.Create;
    Bitmap.Assign(vDXFImage);

    jpg := TJpegImage.Create;
    jpg.Assign(Bitmap);
    jpg.CompressionQuality := 100;
    jpg.Compress;
    jpg.SaveToFile('a:\a\'+ vDrawing.CurrentLayout.Entities[I].Name + '.jpg');
    jpg.Free;
    Bitmap.Free;
    vDXFImage.Free;
  end;
end;

你可能感兴趣的:(Delphi,数据分析)