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

If you have any comments or questions about our developing tools, please do not hesitate to contact us at this forum

Moderators: admin, SDS, support

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

Postby pascal07 » 31 Jan 2011, 15: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
pascal07
 
Posts: 10
Joined: 08 Nov 2010, 13:55

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

Postby support » 01 Feb 2011, 12: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.
Please post questions to the forum or write to support@cadsofttools.com
support
 
Posts: 2226
Joined: 30 Mar 2005, 08:36
Location: Russia

Re: Draw a Ellipse, bug ?

Postby pascal07 » 01 Feb 2011, 15: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
pascal07
 
Posts: 10
Joined: 08 Nov 2010, 13:55

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

Postby support » 02 Feb 2011, 09:09

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

Alexander.
Please post questions to the forum or write to support@cadsofttools.com
support
 
Posts: 2226
Joined: 30 Mar 2005, 08:36
Location: Russia

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

Postby pascal07 » 02 Feb 2011, 14:58

ok, it's good.
Thanks for this answer.
Pascal
pascal07
 
Posts: 10
Joined: 08 Nov 2010, 13:55


Return to CADImportVCL + DXFExportVCL

Who is online

Users browsing this forum: No registered users and 2 guests