使用案例demos中GettingStarted案例
修改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;