Ваш браузер устарел. Рекомендуем обновить его до последней версии.

YCAD

The YCAD system was written on Delphi and developed by me from scratch. The main purpose of the system is to display and print the graphics generated in runtime mode. While developing the system, the main emphasis was on ease of use, speed of operation, large amounts of vector information and accuracy of printing at various scales.

The source code contains about 10 thousand lines for a set of visual and non-visual components. The system supports all the basic primitives commonly used in such systems. An additional feature is the powerful polygon fill editor, which is especially in demand for geological drawings.

As a feature, the ability to combine several different drawings in different scales on a single working field. Cutting polygons and rotation are supported. Despite the apparent simplicity, the system allows you to create complex drawings and is used in several commercial projects.

Below are some source code examples of using the system.

 

procedure TFYCADDemo.btSpiralClick(Sender: TObject);
var
  I: Integer;
  LL: TYCADLines;
  GR: TYCADGrid;
begin
  yLayer.Items.Clear;   // clear all objects
  yCluster.Angle := 15; // set cluster angle 15 degree

  // create grid with automatic baunds (default)
  GR := yLayer.AddNew(TYCADGrid);
  GR.Params.Step := 10;      // grid step 10 mm
  GR.Params.StepMinor := 5;  // minor step 5 per cell

  // create lines
  LL := yLayer.AddNew(TYCADLines);
  // line style
  LL.LineStyle.Color.AsWinColor := clGreen; // green color
  LL.LineStyle.Width := 0.5;                // width 0.5 mm
  LL.LineStyle.Pattern := $AAAA;            // dot-dot pattern
  LL.Segments := True;                      // segmented
  // node style
  LL.NodeStyle.Kind := ynkCircle;           // node as circle
  LL.NodeStyle.Color.AsWinColor := clBlue;  // node blue color
  LL.NodeStyle.Size := 2;                   // ass points to line
  for I := 0 to 99 do
    LL.AddPoint(10 * (I+20)/20 * SIN(I/5),
                10 * (I+20)/20 * COS(I/5));
  Viewer.Invalidate;
end;


 

procedure TFYCADDemo.btLegendClick(Sender: TObject);
var
  PL: TYCADPolygon;
  LB: TYCADLabels;
  X, Y: Integer;
  P: TYCADPoint;
begin
  yLayer.Items.Clear;   // clear all objects
  yCluster.Angle := 0;  // set cluster angle 0 degree

  // create labels
  LB := yLayer.AddNew(TYCADLabels);
  LB.NodeStyle.Kind := ynkNone;  // hide node
  LB.TextStyle.Align := yal5;    // align to center
  LB.TextStyle.Font.Size := 1.5; // size 1.5 mm

  // create palette polygones
  for X := 0 to 9 do
    for Y := 0 to 9 do
    begin
      // add polygon
      PL := yLayer.AddNew(TYCADPolygon);
      PL.Brush.Color.SetARGB(X*25, 255, Y*25, 100);
      PL.LineStyle.Color.SetARGB(X*25, 255, Y*25, 255);
      PL.LineStyle.Width := 0.3;
      // add pointe to polygon
      P.X := X * 10 - 50;
      P.Y := Y * 5 - 25;
      PL.AddPoint(P.X, P.Y);
      PL.AddPoint(P.X+8, P.Y);
      PL.AddPoint(P.X+8, P.Y+3);
      PL.AddPoint(P.X, P.Y+3);

      // add label
      LB.AddLabel(P.X + 4, P.Y + 1.5, '#' +
        IntToHex(PL.Brush.Color.AsWinColor, 6));

    end;

  Viewer.Invalidate;

end;

 

procedure TFYCADDemo.btLoadClick(Sender: TObject);
var
  ST: TFileStream;
begin
  // load data from stream/file
  ST := TFileStream.Create('D:\Data\slice.ycad', fmOpenRead);
  try
    CAD.LoadFromStream(ST);
  finally
    ST.Free;
  end;

  Viewer.Invalidate;

end;


YCAD Hatch editor