Page 1 of 1

3 point b-spline macro problem

PostPosted: Sat Mar 09, 2019 2:28 pm
by dhs
I appears that a b-spline entity with 3 control points created by a D4D macro is not drawn correctly.

b-splines with 2 points or with 4 or more points are drawn correctly (as are 3 point b-splines created in the normal datacad interface).
But b-splines created with a D4D macro are drawn as a straight line between the 3rd control point and the origin as shown below:Image
The above was produced by the attached test macro with the source pasted below:
Code: Select alllibrary BspTest;

uses
  System.sysutils,
  UConstants in '../../Header Files/UConstants.pas',
  UInterfaces in '../../Header Files/UInterfaces.pas',
  UInterfacesRecords in '../../Header Files/UInterfacesRecords.pas',
  URecords in '../../Header Files/URecords.pas',
  UVariables in '../../Header Files/UVariables.pas';

{$E dmx}  //dmx is the extension for DCAL Dll's
{$R *.res}

function BspTest_main(act : action; pl, pargs : Pointer) : wantType;
var
   ent : entity;
begin
   ent_init (ent, entbsp);
   ent.bspbase := zbase;
   ent.bsphite := zhite;
   ent.bsppnt[1].x := -12288;
   ent.bsppnt[1].y := 6144;
   ent.bsppnt[1].z := zbase;
   ent.bsppnt[2].x := -12288;
   ent.bsppnt[2].y := 4992;
   ent.bsppnt[2].z := zbase;
   ent.bsppnt[3].x := -10920;
   ent.bsppnt[3].y := 4992;
   ent.bsppnt[3].z := zbase;
   ent.bspnpnt := 3;
   ent_add (ent);
   ent_draw (ent, drmode_white);

    Result := XDone;
end;

function Main(dcalstate : asint; act : action; pl, pargs : Pointer) : wantType; stdcall;
begin
   case dcalstate of
      XDcalStateBegin : Result := BspTest_main(act, pl, pargs);
         else
            Result := XDone;{Necessary}
   end;
end;

exports
   Main;

begin
end.

Am I doing something obviously wrong here ? The test macro was written after similar problems in a much more extensive macro I am working on (and it only occurs in that macro where there are 3 control points ... b-splines with 4 or more control points display just fine).

Any advice would be appreciated.

Thanks,
David H.

Re: 3 point b-spline macro problem

PostPosted: Sat Mar 09, 2019 3:02 pm
by dhs
it's not just a D4D problem ... same thing happens in the following Classic DCAL test macro:
Code: Select allPROGRAM bsptest;

VAR
   ent : entity;

BEGIN
   ent_init (ent, entbsp);
   ent.bspbase := zbase;
   ent.bsphite := zhite;
   ent.bsppnt[1].x := -2288.0;
   ent.bsppnt[1].y := 4144.0;
   ent.bsppnt[1].z := zbase;
   ent.bsppnt[2].x := -2288.0;
   ent.bsppnt[2].y := 2992.0;
   ent.bsppnt[2].z := zbase;
   ent.bsppnt[3].x := -920.0;
   ent.bsppnt[3].y := 2992.0;
   ent.bsppnt[3].z := zbase;
   ent.bspnpnt := 3;
   ent_add (ent);
   ent_draw (ent, drmode_white);
END bsptest.

Re: 3 point b-spline macro problem

PostPosted: Wed Mar 13, 2019 4:42 pm
by dhs
It does not resolve the problem, but I found a workaround....
if you assign a 4th point to the bspline (with the same point as bsppnt[3]) then the bspline will display correctly.