The following example demonstratess how to draw three drawings as a single drawing. Requires the "DXF", "DXFConv" units added to the "uses" section.
procedure TForm1.AddXRefClick(Sender: TObject);
var
vCADFile, vCADContainer: TsgCADImage; //requires the "DXF" and "DWG" units to be added to the "uses" section
Pos, Scale: TFPoint;//requires the "DXFConv" unit added to the "uses" section
begin
vCADContainer := TsgCADdxfImage.Create;
try
vCADContainer.LoadFromFile('Entities.dxf'); // Base file
Pos.X := 10.5;//X drawing position (in AutoCAD units)
Pos.Y := -12.23;//Y drawing position (in AutoCAD units)
Pos.Z := 0;//Z drawing position (in AutoCAD units)
Scale.X := 2;// zoom x2
Scale.Y := 1;// no zoom
Scale.Z := 1;;// no zoom
vCADFile := TsgCADDXFImage.Create;
vCADFile.IsWithoutBorder := True;
vCADFile.LoadFromFile('Entities.dxf'); // the second file
vCADContainer.AddScaledDXF(vCADFile, 'XREF1', Pos, Scale, 0);
Pos.X := 50;//X drawing position (in AutoCAD units)
Pos.Y := 100;//Y drawing position (in AutoCAD units)
Pos.Z := 0;//Z drawing position (in AutoCAD units)
Scale.X := 0.5;// zoom x 0.5
Scale.Y := 0.5;// zoom x 0.5
Scale.Z := 1;
vCADFile := TsgDWGImage.Create;
vCADFile.IsWithoutBorder := True;
vCADFile.LoadFromFile('Gasket.dwg');// the third file
vCADContainer.AddScaledDXF(vCADFile, 'XREF2', Pos, Scale, 45);
vCADContainer.GetExtents;
Image1.Canvas.StretchDraw(Rect(0, 0,
Round(vCADContainer.Width * Image1.Height / vCADContainer.Height), Image1.Height), vCADContainer);
finally
vCADContainer.Free;
end;
end;
Go to CAD VCL Enterprise