Page 1 of 1
Draw a Ellipse, as Form.Canvas.Rectangle(...
Posted: 31 Jan 2011, 17:15
by pascal07
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
Re: Draw a Ellipse, as Form.Canvas.Rectangle(...
Posted: 01 Feb 2011, 14:15
by support
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.
Re: Draw a Ellipse, bug ?
Posted: 01 Feb 2011, 17:24
by pascal07
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
Re: Draw a Ellipse, as Form.Canvas.Rectangle(...
Posted: 02 Feb 2011, 11:09
by support
Hello.
TsgDXFEllipse.Ratio specifies ratio of minor axis to major axis. This value must be not greater than 1.
Alexander.
Re: Draw a Ellipse, as Form.Canvas.Rectangle(...
Posted: 02 Feb 2011, 16:58
by pascal07
ok, it's good.
Thanks for this answer.
Pascal