ColorToLineWeight example

  Examples >

ColorToLineWeight example

Previous pageReturn to chapter overviewNext page

The following example explains how to set a line weight based on the entitys color:

 

procedure TForm1.ColorToLineweightClick(Sender: TObject);
var
  vDrawing: TsgCADdxfImage; //requires the "DXF" unit added to the "uses" section
begin
  vDrawing := TsgCADdxfImage.Create;
  try
    vDrawing.LoadFromFile('Entities.dxf'); //load image from a file
    with vDrawing.ColorToLineWeight do
    begin
      Add('clRed=1');//all entities in red color will be drawn with line width 1
      Add('clYellow=0.75');
      Add('clBlack=2');
    end;
    Image1.Canvas.StretchDraw(Rect(0, 0,
      Round(vDrawing.Width * Image1.Height / vDrawing.Height), Image1.Height), vDrawing);
  finally
    vDrawing.Free;
  end;
end;

 

Go to CAD VCL Enterprise