Home Page > Programming Samples and Tutorials > Delphi Samples > KernelCAD and Delphi
KernelCAD and Delphi
KernelCAD Component in Delphi
The steps below describe integration of KernelCAD control into Delphi IDE. These steps are needed when using KernelCAD for the first time in Delphi other than RAD Studio 10.1 Berlin or upgrading Delphi IDE
Please read the relevant section to perform specific steps to compile the KernelCAD runtime package to make the IDE aware of KernelCAD
RAD Studio
These steps refer to RAD Studio 10.1 Berlin. Other versions should have similar user interface
- In the menu of Delphi IDE Select Component > Import Component
- Select Import ActiveX Control in the form and press Next
- Select the KernelCAD Pro ActiveX Control in the list. Click Next
- Change Unit Dir Name to C:\Projects\KernelCAD_5_2\Samples\Delphi\V5_2\ or similar if KernelCAD was installed at non-default location and click Next
- Make sure Create Unit option is on and click Finish. This will create the KERNELCADLib_TLB.pas file
- In File menu of RAD Studio select New > Package - Delphi
- Save the project as C:\Projects\KernelCAD_5_2\Samples\Delphi\V5_2\KernCAD.dproj
- Right-click on KernelAD.bpl in Project Manager and use Add command to select the KERNELCADLib_TLB.pas
- Click Yes to add the Visual Component Library
- Right-click on KernelAD.bpl in Project Manager and select Build
- Press OK if you are asked to add vcl package
- Right-click on KernelAD.bpl in Project Manager and select Install
The above steps will create KERNELCADLib_TLB.dcu file which will be used at runtime by KernelCAD samples. Add this path to Project Options > Delphi Compiler >Search Path when creating a new project
When debugging KernelCAD samples open *_10_* projects, which have been updated for RAD Studio. The Samples_10_1.groupproj contains all samples
Delphi XE
This section is based on Embarcadero Delphi XE3.
To add KernelCAD control to the tool palette in menu of Delphi IDE:
- Select Component > Import Component
- Select Import ActiveX Control in the form and press Next
- Select the KernelCAD Pro ActiveX Control in the list. Click Next
- Select all default options in the following pages. This will create
KERNELCADLib_TLP.pas file. Remember its location
- Create new project to compile KERNELCADLib_TLP.pas into a package imporatble
into IDE:
- In File menu go to New > Other (project type). In Delphi Projects folder select
Package in the right hand panel
- Add the KERNELCADLib_TLP.pas to the project
- In the Project Manager tab of the IDE right-click on the project name
(Package1.bpl by default) and select Compile
- When compilation is completed right-click again on the project and select
Install
- After the above ActiveX category should appear on the Tool Palette. Click on
TKernelCAD and draw a rectangle on your form where the control should be placed
- Copy code from Delphi samples (Patch is the simplest one) and consult the
installed help to acces KernelCAD functionality programmaticaly
Delphi 7 Borland Developer Studio
2006 for Win 32 (BDS)
It is recommended to make the next manual change in the generated file:
Search and and remove packed keyword from three lines:
DISectInfo = packed record
DI3DSectInfo = packed record
MetrDistContext = packed record
Samples|Delphi\TypeLib folder contains KERNELCADLib_TLB.pas with above
modifications
Contact us to obtain copy of the samples for earlier versions of Delphi
See also: Delphi Samples.
|