uses DXF, DXFConv, sgConsts;
...
type
TForm1 = class(TForm)
Image1: TImage;
...
implementation
procedure TForm1.AddChangeDeleteClick(Sender: TObject);
var
vDrawing: TsgCADDXFImage; // a class for reading DXF format
// Please use a correspond class to read a drawing of other format.
// For example TsgDWGImage for DWG format, TsgCGMImage for CGM, etc.
vLine: TsgDXFLine;
begin
vDrawing := TsgCADDXFImage.Create;
vDrawing.LoadFromFile('Entities.dxf');
// changing color
vDrawing.CurrentLayout.Entities[1].Color := clBlue;
vDrawing.CurrentLayout.Entities[1].LineWeight := 2;
//deleting a circle entity from Entities.dxf
vDrawing.CurrentLayout.RemoveEntity(vDrawing.CurrentLayout.Entities[2]);
// add line
vLine := TsgDXFLine.Create;
// a point has 3 floating values: x, y, z
vLine.Point := MakeFPoint(50, 0, 0);
vLine.Point1 := MakeFPoint(50, 70, 10);
vLine.LineWeight := 1; // 1 mm
//adding a line to the drawing database:
vDrawing.Converter.Loads(vLine);
//adding a line to the current layout for displaying:
vDrawing.CurrentLayout.AddEntity(vLine);
vDrawing.GetExtents; // recalculating the extents of the drawing
Image1.Canvas.StretchDraw(Rect(0, 0,
Round(vDrawing.Width * Image1.Height / vDrawing.Height), Image1.Height), vDrawing);
vDrawing.Free;
end;
Go to CAD VCL Enterprise