Statistics: Posted by joshhuggins — Mon Oct 23, 2023 6:25 pm
Statistics: Posted by dhs — Mon Oct 23, 2023 3:30 pm
TDisplayTTF = packed record
dooutline: boolean;
dofill: boolean;
OutlineClr: aSInt; { Range 1..255 }
FillClr: integer; { Range 1..255, Add 1000 Offset to fixed RGB }
end;
PROGRAM TestFont;
TYPE
EntOverlay = RECORD
i : integer;
CASE integer OF
0 : (e : entity);
1 : (o : array [0..833] of byte); {I exstablished this as the size of the entity record using the sizeof function }
END;
VAR
entrec : EntOverlay;
res, key : integer;
mode : mode_type;
addr : entaddr;
i, j : integer;
ch : char;
fl : file;
BEGIN
selecttype := 1; {entity}
if getmode ('analyse as text entity', mode, key) = res_normal then
addr := ent_first (mode);
if ent_get (entrec.e, addr) then
i := f_create (fl, 'TextEnt.txt', true);
for i := 0 to 833 do
j := f_wrchar (fl, entrec.o[i]);
end;
i := f_close(fl);
wrterr ('TextEnt.txt file has hopefully been written');
else
wrterr ('Unable to read entity (Macro exits)');
end;
else
wrterr ('No entity selected (Macro exits)');
end;
END TestFont.[code][/code]
Statistics: Posted by dhs — Mon Oct 23, 2023 2:51 pm
Statistics: Posted by dhs — Sun Oct 15, 2023 2:23 pm
Statistics: Posted by lmiddendorf — Sun Oct 15, 2023 9:17 am
Statistics: Posted by lmiddendorf — Sun Oct 15, 2023 8:37 am
entTxt:
(txtpnt: point; { Point around where text will be justified }
txtpnt2: point; { Second Point for fit/aligned text }
txttype: RTextType;
txtsiz: aFloat;
txtang: aFloat;
txtslant: aFloat;
txtaspect: aFloat; { aspect ratio }
txtBase: aFloat;
txtHite: aFloat;
txtfon: fontstr;
txtdisplayttf: TDisplayTTF;
TxtWinfont: TFontType;
fontNum: aSInt;
txtunderline, txtoverline: boolean;
txtstr: str255); { set in dcdata }
Statistics: Posted by dhs — Sat Oct 14, 2023 10:51 pm
Statistics: Posted by lmiddendorf — Sat Oct 14, 2023 3:58 pm
PROGRAM TestFont;
VAR
str : str255;
BEGIN
wrtlvl ('Font Test');
lblsinit;
lblson;
getcurrfont (str);
printstr (str, 1,1,1,0,false);
END TestFont.
Statistics: Posted by dhs — Sat Oct 14, 2023 3:21 pm
Statistics: Posted by lmiddendorf — Sat Oct 14, 2023 1:24 pm
Statistics: Posted by Mark F. Madura — Thu Mar 09, 2023 12:04 pm
Statistics: Posted by dhs — Wed Mar 08, 2023 4:55 pm
type
TPoint3D = record
X, Y, Z: Double;
end;
function TorusKnotPoints(r1, r2: Double; numPoints, p, q: Integer): TArray<TPoint3D>;
var
t, theta: Double;
i: Integer;
begin
SetLength(Result, numPoints);
for i := 0 to numPoints-1 do
begin
t := 2 * Pi * i / numPoints;
theta := t * p;
Result[i].X := (r1 + r2 * Cos(q * theta)) * Cos(theta);
Result[i].Y := (r1 + r2 * Cos(q * theta)) * Sin(theta);
Result[i].Z := r2 * Sin(q * theta);
end;
end;
procedure GeneratePoints();
var
i: Integer;
Knot: TArray<TPoint3D>
begin
for i := 0 to Length(Knot) - 1 do begin
pt.x := Knot[i].X;
pt.y := Knot[i].Y;
pt.z := Knot[i].Z;
ent_init(ent, entmrk);
ent.mrkpnt := pt;
ent.Non_Printing := 0; // Make points printable
ent_add(ent); // current color, line type, etc.
//ent.color := RandomRange(1, 255);
ent.mrktyp := 1; // RandomRange(1, 8); { 1-square, 2-'x', 3-diamond, 4-dot, ... }
// ent.mrksiz := RandomRange(16, 64); { size in pixels }
ent_update(ent); // update entity properties
ent_draw(ent, drmode_white); { draw entity on the screen }
end;
end;
Statistics: Posted by Mark F. Madura — Wed Mar 08, 2023 4:18 pm
library Knot;
{$E dmx} // dmx is the extension for DCAL Dll's
{$R *.res}
uses
// System.Math, Winapi.Windows,
UConstants in '..\..\..\d4d_headerfiles\14\UConstants.pas',
UDCLibrary in '..\..\..\d4d_headerfiles\14\UDCLibrary.pas',
UInterfaces in '..\..\..\d4d_headerfiles\14\UInterfaces.pas',
UInterfacesRecords in '..\..\..\d4d_headerfiles\14\UInterfacesRecords.pas',
URecords in '..\..\..\d4d_headerfiles\14\URecords.pas',
UVariables in '..\..\..\d4d_headerfiles\14\UVariables.pas';
type
KnotL = record
state: asint;
p, q, steps : integer;
radius : double;
case byte of
0: (geti: getintArg);
1: (getd: getdisArg);
end;
PKnotL = ^KnotL;
function TorusKnot (p, q : asint; radius : double; steps : asint) : TArray<point>;
var
i, j : integer;
t, phi : double;
begin
SetLength (result, steps);
phi := 2*Pi*q/p;
for i := 0 to steps-1 do begin
t := 2*Pi*i/steps;
Result[i].x := (radius * Cos(p*t) + 2*Cos(q*t)) * Cos(phi);
Result[i].y := (radius * Cos(p*t) + 2*Cos(q*t)) * Sin(phi);
Result[i].z := radius * Sin(p*t);
end;
end;
function knot_main(act: action; pl, pargs: Pointer): wantType;
var
retval: asint;
l: PKnotL;
knotpoints : TArray<point>;
i: integer;
ent : entity;
begin
l := PKnotL(pl);
if act = aagain then begin
case l^.state of
1: l^.state := 2;
2: l^.state := 3;
3: l^.state := 4;
4: begin
knotpoints := TorusKnot (l^.p, l^.q, l^.radius, l^.steps);
for i := 0 to l^.steps-1 do begin
ent_init (ent, entln3);
ent.ln3pt1 := knotpoints[i];
ent.ln3pt2 := knotpoints[(i+1) mod l^.steps];
ent_add (ent);
ent_draw (ent, drmode_white);
end;
l^.state := 0;
end;
else l^.state := 0;
end; { Case }
end;
if act = Afirst then begin
l^.state := 1;
end
else if act = AlSize then begin
SetLocalSize(sizeof(l^));
end;
if act <> AlSize then begin { Action section - Invoke the Dispatcher }
case l^.state of
1: begin
wrtmsg ('p:');
getint(l^.p, l.geti, retval);
end;
2: begin
wrtmsg ('q:');
getint(l^.q, l.geti, retval);
end;
3: begin
wrtmsg ('radius:');
getdis(l^.radius, l.getd, retval);
end;
4: begin
wrtmsg ('steps:');
getint(l^.steps, l.geti, retval);
end;
else retval := XDone; // Don't go back to Aagain
end; { Case }
end; { Action section }
Result := retval;
end; { knot_main }
function Main(dcalstate: asint; act: action; pl, pargs: Pointer): wantType; stdcall;
begin
case dcalstate of
XDcalStateBegin: Result := knot_main(act, pl, pargs);
else Result := XDone; { Necessary }
end;
end;
exports
Main; { This is the entry function that will be called by DataCAD.
All DCAL Dlls will have this function. }
begin
end.
Statistics: Posted by dhs — Wed Mar 08, 2023 3:15 pm
Statistics: Posted by Mark F. Madura — Wed Mar 08, 2023 2:00 pm
Statistics: Posted by dhs — Mon Feb 27, 2023 2:25 pm
Statistics: Posted by John Daglish — Mon Feb 27, 2023 1:56 pm
lyr_get (getlyrcurr, l^.svrlyr); // get current lyr record
l^.svOrthMode := PGsavevar^.orthmode;
l^.svNumDivs := l^.svrlyr.numdivs; // save numdivs from lyr record
l^.svGridAng := l^.svrlyr.gridang; // save grid angle from lyr record
PGsavevar^.orthmode := true;
l^.svrlyr.numdivs := 2; // set numdivs and gridang in local variable
l^.svrlyr.gridang := 0; // so that ortho mode gives horizontal angles
lyr_put (l^.svrlyr); // put local variable back to actual layer record
rubln^ := true;
wrtmsg ('Select point to indicate X value of 2nd baseline point');
getpointp(vmode_orth, false, l^.getp, retval);
Statistics: Posted by dhs — Sun Feb 26, 2023 6:31 am
l^.svOrthMode := PGsavevar^.orthmode;
l^.svNumDivs := PGsavevar^.numdivs;
PGsavevar^.orthmode := true; // try to force them to select a point at
PGsavevar^.numdivs := 2; // the same Y value as prev point
rubln^ := true;
wrtmsg ('Select point to indicate X value of 2nd baseline point');
getpointp(vmode_orth, false, l^.getp, retval);
Statistics: Posted by dhs — Sun Feb 26, 2023 3:06 am
Statistics: Posted by Joseph Baron — Tue Oct 11, 2022 9:51 pm
Statistics: Posted by Joseph Baron — Fri Oct 07, 2022 2:36 pm
Statistics: Posted by dhs — Fri Oct 07, 2022 2:17 pm
Statistics: Posted by Joseph Baron — Fri Oct 07, 2022 12:44 pm