[Lazarus] FPVectorial and TAChart
Felipe Monteiro de Carvalho
felipemonteiro.carvalho at gmail.com
Wed Apr 20 11:54:29 CEST 2011
On Wed, Apr 20, 2011 at 11:30 AM, Alexander Klenin <klenin at gmail.com> wrote:
> No idea if I want an entity, but I do need a brush :)
I'll add a Polygon entity, which should be a closed polyline with brush.
> I need to draw a rectangle surrounding given text string.
Ummm ... some research is necessary to verify how other software solve
this issue. In AutoCAD it seams that simply the rectangles are much
larger then the text, to make sure it fits regardless of the font
utilized.
> Hm, probably the error handling should be enhanced then --
> I just get SIGSEGV on doc.WriteToFile.
> Will try SVG.
Strange, it should throw an exception. Which output format have you
tried? Maybe a test program so that I can fix the problem?
> How can I visualise g-code file?
Vec := TvVectorialDocument.Create;
try
Vec.ReadFromFile(FileName, vfAvisoCNCGcode);
Drawer.Drawing.Width := CanvasSize.X;
Drawer.Drawing.Height := CanvasSize.Y;
Drawer.Drawing.Canvas.Brush.Color := clWhite;
Drawer.Drawing.Canvas.Brush.Style := bsSolid;
Drawer.Drawing.Canvas.FillRect(0, 0, Drawer.Drawing.Width,
Drawer.Drawing.Height);
DrawFPVectorialToCanvas(
Vec,
Drawer.Drawing.Canvas,
0,
0,
1,
-1);
Drawer.Invalidate;
finally
Vec.Free;
end;
or else you could try: lazarus-ccr/applications/fpvviewer just change this line:
Vec.ReadFromFile(editFileName.FileName, vfDXF);
It is in my ToDo to make this program more flexible and even support
selecting and editing elements.
I also wrote a specialized g-code viewer, but it is not open source.
> Well, from my POV you are already wasting about 24 bytes per segment --
> all fields of TPathSegment class plus the overhead of the class itself.
Using a class was required in a bug report... not my invention. About
the fields, well maybe I should then remove the possibility of having
a different Pen for each part of the polyline. I added it because DXF
supports it, but it does seams like an excess. Inkscape does not allow
editing such kind of element. The list linking cannot be removed
without huge changes.
TPathSegment = class
public
SegmentType: TSegmentType;
// Fields for linking the list
Previous: TPathSegment;
Next: TPathSegment;
// Data fields
PenColor: TvColor;
PenStyle: TFPPenStyle;
PenWidth: Integer;
end;
--
Felipe Monteiro de Carvalho
More information about the Lazarus
mailing list