deleting TsgDxfLeader

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

Moderators: SDS, support, admin

Post Reply
aby
Posts: 81
Joined: 21 May 2007, 13:02
Location: Turkey

deleting TsgDxfLeader

Post by aby » 08 Mar 2010, 10:06

Hi,

The code below is taken from your example on TsgDXFLeader. Without changing anything I'am using it in CodeGearBuilder 2010.
It runs without any problem. But when I try to exit from the program I am encountering an error. There is an issue in destroying the leader object. When I examine the source code it stops on deleting spline object. Any workarounds.

Thanks

Sabetay


var
Im: TsgCADImage;
Leader : TsgDXFLeader;
pt : PFPoint;
I : integer;
begin
Leader := TsgDXFLeader.Create;
Leader.Color := ClRed;
for I := 0 to 4 do
begin
New(pt);
pt^ := (MakeFPoint(50*I, 200-10*I*I, 0));
Leader.Fit.Add(pt); // creation by Fit points
// Leader.Controls.Add(pt); // or Control points
end;

AddEntity(Im.Converter, Leader);
Im.GetExtents;
sgPaintBox.Refresh;
end;

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

Re: deleting TsgDxfLeader

Post by support » 10 Mar 2010, 13:56

Hello Aby.
The code sample mentioned above must be translated to C++ code:

Code: Select all

TsgCADImage *Im;

if (sgPaintBox->Picture->Graphic->InheritsFrom(__classid(TsgCADImage)))
{
	 Im = dynamic_cast<TsgCADImage *>(sgPaintBox->Picture->Graphic);

	 TsgDXFLeader *Leader = new TsgDXFLeader();
	 Leader->Color = clRed;

	 PFPoint pt;

	 for (int i = 0; i <= 4; i++) {
	      pt = (PFPoint)AllocMem(sizeof(TFPoint));
	      *pt = MakeFPoint(50*i, 200-10*i*i, 0);
	      Leader->Fit->Add(pt);
	 }

	AddEntity(Im->Converter, Leader);
	Im->GetExtents();
	sgPaintBox->Refresh();
}
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply