The DataCAD Developer Network (DDN) is an online resource for information and support for DCAL® (DataCAD Applications Language) developers as well as anyone interested in creating fonts, toolbars, hatch patterns, or linetypes for use in DataCAD.

Moderator: pjdixit

#71962 by dhs
Mon Jul 31, 2017 6:55 pm
Hi again. Yet another exception that I cannot explain:

I am trying to add a void to a polyline, but the drawing keeps crashing out with an exception class $C0000005 with message 'access violation at 0x0091c3e5: write of address 0x00000006'.
Once again I have written a little test program (below), and the exception is happening on the plvoid_add (a few lines from the bottom of the main function). Once again I cannot see any problem with my code (I have similar code that adds voids to polygons/slabs without any issue). Hopefully somebody can spot my error.

Code: Select alllibrary Tests;

uses
  System.sysutils,
  //DCAL for Delphi Header Files
  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 Main(dcalstate : asint; act : action; pl, pargs : Pointer) : wantType; stdcall;

var
  ent, vent : entity;
  pv  : polyvert;
  i   : integer;

begin
  ent_init (ent, entpln);
  for i := 1 to 3 do begin
    polyvert_init (pv);
    pv.shape := pv_vert;
    pv.bulge := 0.0;
    pv.pnt.x := -400 + 200*i;
    if i = 2 then pv.pnt.y := 200 else pv.pnt.y := 0;
    pv.pnt.z := 0;
    polyvert_add (pv, ent.plnfrst, vent.plnlast);
  end;
  ent.plnhite := 1;
  ent.plbase := 0;
  ent.plnclose := true;
  ent.plnCover := true;
  ent_add (ent);
  ent_draw (ent, drmode_white);

  ent_init (vent, entpln);
  plvoid_init (ent, vent);
  for i := 1 to 3 do begin
    polyvert_init (pv);
    pv.shape := pv_vert;
    pv.bulge := 0.0;
    pv.pnt.x := -200 + 100*i;
    if i = 2 then pv.pnt.y  := 150 else pv.pnt.y := 50;
    pv.pnt.z := 0;
    polyvert_add (pv, vent.plnfrst, vent.plnlast);
  end;
  vent.plnclose := true;
  vent.plnhite := 1;
  vent.plbase := 0;
  if not plvoid_add(ent, vent) then wrterr ('Did not add void');
  ent_draw (ent, drmode_white);

  Result := XDone;
end;

exports
   Main;

begin

end.


Thanks,
David H.

Who is online

Users browsing this forum: No registered users and 0 guests

About DataCAD Forum

The DataCAD Forum is a FREE online community we provide to enhance your experience with DataCAD.

We hope you'll visit often to get answers, share ideas, and interact with other DataCAD users around the world.

DataCAD

Software for AEC Professionals Since 1984