Creating a drawing by lines & points

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

Moderators: SDS, support, admin

Post Reply
Khyati
Posts: 34
Joined: 08 Feb 2011, 08:55

Creating a drawing by lines & points

Post by Khyati » 25 Feb 2011, 07:01

Hello,

I found CAD Import VCL interesting.

How to create a canvas / picture box and then draw some shapes lines / points on it?
Could you please post example in delphi?

i tried one of your reference code, but i stuck at " Im := TsgCADImage(sgPaintBox.Picture.Graphic);" point.
There is error of "undeclared identifier" for MakeFPoint and AddEntity functions. Do i need to add any library?
I don't want to use any of demo code straight away.

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

Re: Creating a drawing by lines & points

Post by support » 28 Feb 2011, 17:17

Hello Khyati.
CAD Import VCL library structure is similar to CAD Import .NET. You need create TsgCADImage object, add entities to it and visualize. CAD Import VCL provides TsgDrawingNavigator class that can be used for displaying TsgCADImage object:

Code: Select all

type
  TfmMain = class(TForm)
     ......
  private
     FsgPaintBox: TsgDrawingNavigator;

.....

var
  vImg: TsgCADImage;
begin
  FsgPaintBox := TSGDrawingNavigator.Create(Self);
  FsgPaintBox.Parent := Self;
  FsgPaintBox.Align := alClient;

  vImg := TsgCADImage.Create;
  try
    vImg.Converter.InitializeSections;
    vImg.CurrentLayout := vImg.Layouts[0];
    FsgPaintBox.Picture.Graphic := vImg;
  finally
    vImg.Free;
  end;
end;

MakeFPoint method declared in sgConsts unit. Please include it in uses clause of your application. AddEntity is the local procedure of demo application and can't be called from your application. Please see AddNewEntities demo for details.

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

Khyati
Posts: 34
Joined: 08 Feb 2011, 08:55

Re: Creating a drawing by lines & points

Post by Khyati » 04 Mar 2011, 04:20

Thanks! It was useful code.

Are there mouse down / mouse click / mouse double click events included with CADImport VCL?
How to trigger them? (in Delphi 2010?)

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

Re: Creating a drawing by lines & points

Post by support » 07 Mar 2011, 17:57

Hello.
TsgDrawingNavigator class inherits most of its events from TCustomControl (Delphi class). You can modify any such event by redefining event handler. Please see any demo source for example.

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

Post Reply