|
V A L I D C G D C O M M A N D S Version 2006 (c) Jacques Basaldúa |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
{<MAKEGROUP>} {>Optimization} {<LBOLD>}
opAli : boolean; {>Remove aligned points}
ReTrjIn : boolean; {>Revectorize imported trajectories}
OpTrjIn : boolean; {>Optimize imported trajectories}
{<ALIAS opOpPrOptim>} {\}
OpCalTr : boolean; {>Optimize calculated trajectories}
{<CASE opOpPrOptim>0>} {\}
OpTrLinkD : single; {>Linking distance} {>>§} {<MIN 0>}
| PRIMITIVE TYPES (see file cgdTypes.pas) |
Primitive types are: (all other types are packed records of these)
boolean types:
boolean (size= 1) // True = 255, false = 0
cBool (size= 4) // !! True = 255 !! false = 0 (ONLY ONE BYTE MODIFIED !)
integer types:
byte (size= 1)
word (size= 2)
integer (size= 2)
longint (size= 4)
real types:
single (size= 4)
real (size= 4) // same as single
double (size= 8)
string types:
char (size= 1)
string (size depends on [])
sets/Enumerations:
( ) (size= 1) as COMBOBOX
( ) (size= 1) as RADIOBUTTONS
same (size= 4) as COMBOBOX DECLARE {<EXTENDTO32>} before
same (size= 4) as RADIOBUTTONS DECLARE {<EXTENDTO32>} before
primitive records:
point2 (size= 8)
point3 (size=12)
date (size= 6)
time (size= 6)
cgdFileName (only name is edited)
cgdPath (only name is edited)
cgdColor (size= 4)
Type limitations:
-----------------
Boolean
description 127 chars
cgdFileName
File name 211 chars
default path 211 chars
format description 211 chars 212 x 3 = 636 bytes
cgdPath
Path name 211 chars
Caption 211 chars
Combo (enumeration)
item list 32 names of 19 chars each 32 x 20 = 640 bytes
Combo (user defined)
item list 254 chars description separated by #0 and finished by #0,#0
Radio (enumeration)
item list 20 names of 31 chars each 20 x 32 = 640 bytes
Strings
contents as defined, up to 255 chars
|
{<DIALOG HelpAbout>}
HelpAbout = packed record // Size = 4
dontcare : longint {<PRIVATE>}
{<MAKEGROUP>} {>Version} {<LBOLD>}
{<BLANKLINE>}
{> Blabla - 1.0 - US english}
{<BLANKLINE>}
{> F o r d e m o n s t r a t i o n p u r p o s e o n l y } {<LBOLD>}
{<BLANKLINE>}
{> Resale forbidden}
{<BLANKLINE>}
{<ENDMAKEGROUP>}
{<MAKEGROUP>} {>Copyright}{<LBOLD>}
{<BLANKLINE>}
{> (c) 1989-2003. Bla-bla-soft}
{<BLANKLINE>}
{> All Rights Reserved.}
{<BLANKLINE>}
{<ENDMAKEGROUP>}
end;
{<ENDDIALOGS>}
HelpAbout = packed record // Size = 4
dontcare : longint {<PRIVATE>}
{<MAKEGROUP>} {>Copyright}{<LBOLD>}
{<BLANKLINE>}
{> (c) 1989-2003. Bla-bla-soft}
{<BLANKLINE>}
{> All Rights Reserved.}
{<BLANKLINE>}
{<ENDMAKEGROUP>}
end;
ISOparagraph = packed record // Size = 516
{<ALIAS isoParLines>} {\}
numcol : byte; {>Number of lines} {<MAX 8>}
nul2 : byte; {<PRIVATE>}
nul3 : byte; {<PRIVATE>}
nul4 : byte; {<PRIVATE>}
{<ARRAYSIZE isoParLines>} {\}
cols : array [0..7] of string[63] {>Line #} {<LITALIC>}
end;
pKmlCNCconfi = ^kmlCNCconfi;
{<DIALOG kmlCNCconfi>}
kmlCNCconfi = packed record // Size = 1520
// ... bla, bla, bla
{<BLANKLINE>}
{> Start and end} {<LBOLD>} {<LITALIC>}
prStart : ISOparagraph; {>Program header} {<LBOLD>} // Size = 516
prEnd : ISOparagraph; {>End of program} {<LBOLD>} // Size = 516
{<BLANKLINE>}
// ... bla, bla, bla
end;
// ... bla, bla, bla
pKmlCNCconfi = ^kmlCNCconfi;
{<DIALOG kmlCNCconfi>}
kmlCNCconfi = packed record // Size = 1520
// ... bla, bla, bla
{<BLANKLINE>}
{> Start and end} {<LBOLD>} {<LITALIC>}
prStart : ISOparagraph; {>Program header} {<NOMAKEGROUP>} {<LBOLD>} // Size = 516
prEnd : ISOparagraph; {>End of program} {<NOMAKEGROUP>} {<LBOLD>} // Size = 516
{<BLANKLINE>}
// ... bla, bla, bla
end;
pProjSettings = ^kmlProjSettings;
{<DIALOG kmlProjSettings>}
kmlProjSettings = packed record // Size = 512
SizeOfPrSet : longint; {<PRIVATE>} // 4 = 4 (Must be 512)
{<MAKEGROUP>} {>Project}{<LBOLD>}
FullName : string [39]; {>Project name} // 40 = 44
Vers : string [7]; {>Version} // + 8 = 52
{<ENDMAKEGROUP>}
{<MAKEGROUP>} {>Author}{<LBOLD>}
Author : string [39]; {>Author} // + 40 = 92
Email : string [39]; {>E-mail} // + 40 = 132
Company : string [39]; {>Company} // + 40 = 172
Copyright : string [39]; {>Copyright} // + 40 = 212
{<ENDMAKEGROUP>}
{<MAKEGROUP>} {>Client}{<LBOLD>}
Client : string [31]; {>Client} // + 32 = 244
Norms : string [31]; {>Norms} // + 32 = 276
SchedDate : Date; {>Delivery date} // + 6 = 282
{<ENDMAKEGROUP>}
// ... bla, bla, bla
end;
pubSrfProcessOp = packed record
dgNodNrmAng : single; {>Edge enhancement angle} {<MIN 0.001>} {<MAX 180>} {>>deg}
mmNodeLnkD : single {>Node linking distance} {<MIN 0.0001>} {<MAX 0.1>} {>>§}
{<BLANKLINE>}
end;
{<DIALOG kmlOpProcessing>}
kmlOpProcessing = packed record // Size = 24
{<MAKEGROUP>} {>Optimization}{<LBOLD>}
opAli : boolean; {>Remove aligned points}
ReTrjIn : boolean; {>Revectorize imported trajectories}
OpTrjIn : boolean; {>Optimize imported trajectories}
{<ALIAS opOpPrOptim>} {\}
OpCalTr : boolean; {>Optimize calculated trajectories}
{<CASE opOpPrOptim>0>} {\}
OpTrLinkD : single; {>Linking distance} {>>§} {<MIN 0>}
{<ENDMAKEGROUP>}
{<MAKEGROUP>} {>Tool entry type}{<LBOLD>}
{<ALIAS opOpPrEntry>} {\}
mode : typToolContact; {>Tool entry type}
nul : byte;{<PRIVATE>}
{<CASE opOpPrEntry>0>} {\}
dAng : single; {>Angle} {>>deg.} {<MIN 2.5>}
{<CASE opOpPrEntry>1>} {\}
tRad : single; {>Radius} {>>§} {<MIN 0.1>}
{<ENDMAKEGROUP>}
// ... bla, bla, bla
end;
ISOparagraph = packed record // Size = 516
{<ALIAS isoParLines>} {\}
numcol : byte; {>Number of lines} {<MAX 8>}
nul2 : byte; {<PRIVATE>}
nul3 : byte; {<PRIVATE>}
nul4 : byte; {<PRIVATE>}
{<ARRAYSIZE isoParLines>} {\}
cols : array [0..7] of string[63] {>Line #} {<LITALIC>}
end;
Is the same as:
ISOparagraph = packed record // Size = 516
{<ALIAS isoParLines>} {\}
numcol : byte; {>Number of lines} {<MAX 8>}
nul2 : byte; {<PRIVATE>}
nul3 : byte; {<PRIVATE>}
nul4 : byte; {<PRIVATE>}
{<CASE isoParLines>0>} {\}
cols0 : string[63] {>Line 1} {<LITALIC>}
{<CASE isoParLines>1>} {\}
cols1 : string[63] {>Line 2} {<LITALIC>}
{<CASE isoParLines>2>} {\}
cols2 : string[63] {>Line 3} {<LITALIC>}
{<CASE isoParLines>3>} {\}
cols3 : string[63] {>Line 4} {<LITALIC>}
{<CASE isoParLines>4>} {\}
cols4 : string[63] {>Line 5} {<LITALIC>}
{<CASE isoParLines>5>} {\}
cols5 : string[63] {>Line 6} {<LITALIC>}
{<CASE isoParLines>6>} {\}
cols6 : string[63] {>Line 7} {<LITALIC>}
{<CASE isoParLines>7>} {\}
cols7 : string[63] {>Line 8} {<LITALIC>}
end;
#include "c:\delphi\common\resID.rc"
bmpToolTypeFlat BITMAP "tlrecta.bmp"
bmpToolTypeTapper BITMAP "tlpunta.bmp"
bmpToolTypeFlTapper BITMAP "tlpuntac.bmp"
bmpToolTypeStSphere BITMAP "tlrectab.bmp"
bmpToolTypeStTorus BITMAP "tlrectac.bmp"
bmpToolTypeTpSphere BITMAP "tlpuntb.bmp"
bmpToolTypeTpTorus BITMAP "tlpuntcb.bmp"
This is a valid .rc
file. The missing file resID.rc is a definition of constants, the part mentioned is:
#define bmpToolTypeFlat 2101
#define bmpToolTypeTapper 2102
#define bmpToolTypeFlTapper 2103
#define bmpToolTypeStSphere 2104
#define bmpToolTypeStTorus 2105
#define bmpToolTypeTpSphere 2106
#define bmpToolTypeTpTorus 2107
1.c
Once you have created both files resID.rc and myTools.rc, compile myTools.rc using:
typToolType = (FlatEnd, BallMill, CornerRadius, Tapered, FlatTapered, TaperedBallMill, TaperedCornerRad);
pKmlTool = ^kmlTool;
{<DIALOG kmlTool>}
kmlTool = packed record // Size = 60: MUST be kmlAnyNamedRecord compliant!
name : ShortName; {>Name}
{<BLANKLINE>}
{<ALIAS kmlToolType>} {\}
typ : typToolType; {>Type}
nul2 : byte; {<PRIVATE>}
nul3 : byte; {<PRIVATE>}
nul4 : byte; {<PRIVATE>}
{<BLANKLINE>}
{<CASE kmlToolType=0>} {<CBITMAP 2101>}
{<CASE kmlToolType=1>} {<CBITMAP 2104>}
{<CASE kmlToolType=2>} {<CBITMAP 2105>}
{<CASE kmlToolType=3>} {<CBITMAP 2102>}
{<CASE kmlToolType=4>} {<CBITMAP 2103>}
{<CASE kmlToolType=5>} {<CBITMAP 2106>}
{<CASE kmlToolType=6>} {<CBITMAP 2107>}
{<BLANKLINE>}
h : single; {>H: Flute length} {>>§} {<MIN 0>}
{<CASE kmlToolType=0>} {\}
dr : single; {>D: Diameter} {>>§} {<MIN 0>}
{<CASE kmlToolType=2>} {\}
dt : single; {>D: End diameter} {>>§} {<MIN 0>}
{<CASE kmlToolType=4>} {\}
dc : single; {>D: Cutting diameter} {>>§} {<MIN 0>}
{<CASE kmlToolType=6>} {\}
dct : single; {>D: End diameter} {>>§} {<MIN 0>}
{<CASE kmlToolType>2>} {\}
ang : single; {>w: Taper} {>>deg}{<MIN 0>}
{<CASE kmlToolType=1>} {\}
rb : single; {>R: Ball radius} {>>§} {<MIN 0>}
{<CASE kmlToolType=2>} {\}
rt : single; {>R: Corner radius} {>>§} {<MIN 0>}
{<CASE kmlToolType=5>} {\}
rab : single; {>R: Ball radius} {>>§} {<MIN 0>}
{<CASE kmlToolType=6>} {\}
rat : single {>R: Corner radius} {>>§} {<MIN 0>}
end;
{<DIALOG HeaData>}
HeaData = packed record
{<BLANKLINE>}
{<BITMAPSHIFTX 12>} {\}
{<LBITMAP APPOWNED 1>}
{<BLANKLINE>}
oName : lfFaceName; {<READONLY>} {>Original name}
oWeight : tyFonWi; {<READONLY>} {>Weight}
oIta : string[3]; {<READONLY>} {>Italic}
oUnd : string[3]; {<READONLY>} {>Underlined}
oClo : string[3]; {<READONLY>} {>Is closed}
oOrg : typPftOrigin; {<READONLY>} {>Source}
oCharDef : word {<READONLY>} {># Character def.}
end;
This dialog previews a PFT font.
DC := GetDC(hWnd_Desktop);
if DC <> 0 then begin
memDC := CreateCompatibleDC(DC);
if memDC <> 0 then begin
bmpID := CreateCompatibleBitmap(DC, 256, 256);
SelectObject(memDC, bmpID);
// ... The following GDI commands paint on the bitmap
DeleteDC(memDC)
end;
ReleaseDC(hWnd_Desktop, DC)
end
See the Windows API
doc to learn about GDI. The application owns the bitmap, following: It is responsible of destroying it via
DeleteObject() when the bitmap is no longer of any use. The bitmap is identified by its handle
bmpID
.
var BmpEq : bmpHandleDef;
begin
BmpEq.appID := 1; // This is the identifier used in {<LBITMAP APPOWNED 1>}
BmpEq.winH := bmpID ; // A valid application-owned GDI handle
BmpEq.dlh := dlhModalDialog; // A cgdTypes constant used in case of cgdDialog() when dialog is modal
// ... Set other options, cgdSetBitmapsHInstance() is no longer required.
cgdSetAppOwnedBmpHandle(dlhModalDialog, BmpEq);
cgdDialog(hWindow, 'Hello!', 'HeaData', SizeOf(HeaData), @variable)
end;
// Evaluation Callback to update previewing bitmaps
// ------------------------------------------------
Procedure EditChangeCallBack ( pStruc : pointer; // Full record
pItem : pointer; // Offset to last change
var Help : string; // Help<>'' will be displayed
pWinObject : pointer); StdCall;
var BmpEq : bmpHandleDef;
begin
if The structure pointed by pStruc changed, and a new global bmpID reflects the change then begin
BmpEq.appID := 1;
BmpEq.winH := bmpID ;
BmpEq.dlh := prb^.dlgHandle; // Not necessarily a modal dialog
cgdSetAppOwnedBmpHandle(BmpEq.dlh, BmpEq) // Called from inside a callback procedure
end
end;
// The dialog starts as before, but including the callback
// -------------------------------------------------------
var BmpEq : bmpHandleDef;
begin
BmpEq.appID := 1; // This is the identifier used in {<LBITMAP APPOWNED 1>}
BmpEq.winH := bmpID ; // A valid application-owned GDI handle
BmpEq.dlh := dlhModalDialog; // A cgdTypes constant used in case of cgdDialog() when dialog is modal
// ... Set other options, cgdSetBitmapsHInstance() is no longer required.
cgdSetAppOwnedBmpHandle(dlhModalDialog, BmpEq);
cgdSetEditChangeCallback(dlhModalDialog, @EditChangeCallBack);
cgdDialog(hWindow, 'Hello!', 'HeaData', SizeOf(HeaData), @variable)
end;
{<STARTDLG CGD20>}
{<LICENSE 0001-JBxx-xxxx-xxxx>}
{<COPYRIGHT>} {>(c) Bla-bla-soft 2003} {<PRIVATE>}
{<DIALOG HelpAbout>}
HelpAbout = packed record // Size = 4
dontcare : longint {<PRIVATE>}
{<MAKEGROUP>} {>Copyright}{<LBOLD>}
{<BLANKLINE>}
{> (c) 1989-2003. Bla-bla-soft}
{<BLANKLINE>}
{> All Rights Reserved.}
{<BLANKLINE>}
{<ENDMAKEGROUP>}
end;
{<ENDDIALOGS>}
{<STARTDLG CGD20>}
{<LICENSE 0001-JBxx-xxxx-xxxx>}
{<CRYPTFILE 1873221>}
{<DIALOG HelpAbout>}
HelpAbout = packed record // Size = 4
dontcare : longint {<PRIVATE>}
{<MAKEGROUP>} {>Copyright}{<LBOLD>}
{<BLANKLINE>}
{> (c) 1989-2003. Bla-bla-soft}
{<BLANKLINE>}
{> All Rights Reserved.}
{<BLANKLINE>}
{<ENDMAKEGROUP>}
end;
{<ENDDIALOGS>}
{<DIALOG HeaData>}
HeaData = packed record
{<BLANKLINE>}
{<BITMAPSHIFTX 12>} {\}
{<LBITMAP APPOWNED 1>}
{<BLANKLINE>}
oName : lfFaceName; {<READONLY>} {>Original name}
oWeight : tyFonWi; {<READONLY>} {>Weight}
oIta : string[3]; {<READONLY>} {>Italic}
oUnd : string[3]; {<READONLY>} {>Underlined}
oClo : string[3]; {<READONLY>} {>Is closed}
oOrg : typPftOrigin; {<READONLY>} {>Source}
oCharDef : word {<READONLY>} {># Character def.}
end;
{<DIALOG HelpAbout>}
HelpAbout = packed record // Size = 4
dontcare : longint {<PRIVATE>}
{<MAKEGROUP>} {>Copyright}{<LBOLD>}
{<BLANKLINE>}
{> (c) 1989-2003. Bla-bla-soft}
{<BLANKLINE>}
{> All Rights Reserved.}
{<BLANKLINE>}
{<ENDMAKEGROUP>}
end;
2.
Hide alignment bytes. Bytes used to match 8-bit and 32-bit variables. (see nul2, nul4 below)
pFontDef = ^kmlFontDef;
{<DIALOG kmlFontDef>}
kmlFontDef = packed record // Size = 704: MUST be kmlAnyNamedRecord compliant!
name : ShortName; {>Name}
{<BLANKLINE>}
fnNam : cgdFileName; {>Font source} // Size = 640
{<BLANKLINE>}
cpyFont : boolean; {>Embed font in the project}
nul2 : byte; {<PRIVATE>}
{<ALIAS deplFontIdat>} {\}
ValidFntDat : boolean; {<PRIVATE>}
nul4 : byte; {<PRIVATE>}
{<BLANKLINE>}
{<CASE deplFontIdat>0>} {\}
hd : HeaData {>Font data} {<LBOLD>}
{<BLANKLINE>}
end;