Draw a Ellipse, as Form.Canvas.Rectangle(...

Discuss and ask questions about CAD VCL (Delphi and C++ Builder).

Moderators: SDS, support, admin

Post Reply
pascal07

Draw a Ellipse, as Form.Canvas.Rectangle(...

Post by pascal07 » 31 Jan 2011, 17:15

Hello

i just want draw a ellipse, in my pdf file. ( CADExport VCL , delphi 2007 )

in my form, i use TCanvas.Rectangle(X1, Y1, X2, Y2: Integer); it's ok.
and a ellipse is drawing in rectangle (X1,Y1,X2,Y2) .
i know X1,Y1 and X2, Y2.

in PDF file, how make a do ? ( parameters for TsgDXFEllipse ? )

DXFEllipse := TsgDXFEllipse.Create;
DXFEllipse.RadPt := ?
DXFEllipse.Radius := ?
DXFEllipse.StartAngle := 0 ?
DXFEllipse.EndAngle := 360 ?
DXFEllipse.Point := ?
DXFEllipse.Angle := ?
DXFEllipse.Ratio := ?

thanks
Pascal - France

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: Draw a Ellipse, as Form.Canvas.Rectangle(...

Post by support » 01 Feb 2011, 14:15

Hello.

Code: Select all

  DXFEllipse := TsgDXFEllipse.Create;
  DXFEllipse.Point := MakeFPoint(Xc, Yc, Zc);
  DXFEllipse.EndPoint := MakeFPoint(Xl, Yl , Zl);
  DXFEllipse.Ratio := ratio;  
Point property specifies the central point of an ellipse. EndPoint property specifies end point of major axis, relative to the center. Ratio specifies ratio of minor axis to major axis. You just need to calculate these values using rectangle coordinates.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

pascal07

Re: Draw a Ellipse, bug ?

Post by pascal07 » 01 Feb 2011, 17:24

hello, thanks for this answer, but, other, i found a bug in your component: ( Data incorrect definition of the ellipse. )

1 - For test your code, i have add ( make ) a AddEllipse function in your demo CADExportDemo project.
this code is :

function TForm1.AddEllipse: TsgDXFEllipse;
begin
Result := TsgDXFEllipse.Create;
Result.Point := MakeFPoint(100,100,0);
Result.EndPoint := MakeFPoint(50,50,0);
Result.Ratio := 2;
Result.SetColor(clRed);
Result.Layer := FCADFile.Converter.LayerByName(cnstLayerName);
Result.SetLType(FCADFile.Converter.LTypeByName(cnstLTypeName));
if not AddEntityToLayout(Result) then
begin
Result.Free;
Result := nil;
end;

2 - i run this project: in screen, the Ellipse is drawing, ok.

3 - I save the PDF File

4 - I open this DXF file with Autodesk DWG TrueView: Error :

FR:
L'erreur suivante a été rencontrée lors de la lecture
de ELLIPSE qui commence à l'adresse octet 844:
Données incorrecte de définition de l'ellipse.
Entrée DXF incomplète ou non valable -- dessin ignoré.

US:
The following error was encountered while reading
Ellipse begins at byte 844:
Data incorrect definition of the ellipse.
DXF input incomplete or invalid - drawing discarded.

Where is the bug ??

if you want the code or DXF file, please sent me a mail: 2011.pascal.eynard [at] orange.fr

thanks
Pascal

t

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: Draw a Ellipse, as Form.Canvas.Rectangle(...

Post by support » 02 Feb 2011, 11:09

Hello.
TsgDXFEllipse.Ratio specifies ratio of minor axis to major axis. This value must be not greater than 1.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

pascal07

Re: Draw a Ellipse, as Form.Canvas.Rectangle(...

Post by pascal07 » 02 Feb 2011, 16:58

ok, it's good.
Thanks for this answer.
Pascal

Post Reply