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.
#78571 by dhs
Wed Aug 12, 2020 2:52 pm
I am having trouble with the sym_write function in D4D (the classic DCAL version seems to work fine). The symbol file is created, but does not appear to contain any entities. Came across this in a project I am working on so wrote a test macro which has the same symptoms.

The test macro adds and draws a circle (which works as expected), and then tries to create a symbol with the circle entity (and any other entities in the same group although there should not be any others ... I tried mode_ents with just the single entity with the same result). The symbol file is created in the macro folder and the circle shows in the preview when selecting the symbol to insert. If I insert the symbol unexploded I get the insertion point showing but not the circle (pressing '<' says symbol has been undone and removes the insertion point). Inserting it exploded does not appear to add anything to the drawing (pressing '<' undoes the line I added before inserting the symbol).

Code of y test macro is below and compiled version is attached. Any advice would be appreciated!

Code: Select alllibrary SymTest;
{$E dmx}  //dmx is the extension for DCAL Dll's
{$R *.res}
uses
  SysUtils,
  Vcl.dialogs,
  System.UITypes,
  UConstants in '..\..\DCAL for Delphi Header Files\21.03\UConstants.pas',
  UDCLibrary in '..\..\DCAL for Delphi Header Files\21.03\UDCLibrary.pas',
  UInterfaces in '..\..\DCAL for Delphi Header Files\21.03\UInterfaces.pas',
  UInterfacesRecords in '..\..\DCAL for Delphi Header Files\21.03\UInterfacesRecords.pas',
  URecords in '..\..\DCAL for Delphi Header Files\21.03\URecords.pas',
  UVariables in '..\..\DCAL for Delphi Header Files\21.03\UVariables.pas';

function Main(dcalstate : asint; act : action; pl, pargs : Pointer) : wantType; stdcall;
var
   ent : entity;
   mode : mode_type;
   sym : sym_type;
begin
  if act <> AlSize then begin
    mode_init (mode);   // do this first so it does not corrupt values assigned to other variables

    ent_init (ent, entcrc);
    setpoint (ent.crccent, 0);
    ent.crcrad := 1000 * metricconv;
    if ent_add (ent) then begin
      ent_draw (ent, drmode_white);
      mode_group (mode, ent);
      symcreate (sym, mode, ent.crccent, 'TestCrc', false, false);
      if sym_write (sym, 'TestCircle.dsf') = fl_ok then
         messagedlg ('Symbol Created', mtInformation, [mbOK], 0)
      else
         messagedlg ('Symbol Create Failed', mtInformation, [mbOK], 0);
    end
    else
      messagedlg ('ent_add Failed', mtInformation, [mbOK], 0);
  end;

  Result := XDone;{Necessary}
end;

exports
   Main;{This is the entry function that will be called by DataCAD.
         All DCAL Dlls will have this function.}
begin
end.
Attachments
(2.21 MiB) Downloaded 448 times
#78619 by dhs
Mon Aug 24, 2020 1:25 pm
This problem is no longer occurring for me.
I haven't tested it in the intervening couple of weeks, but DataCAD has been exited and restarted several times and the computer re-booted during this time, so i can only conclude that the DataCAD program was in some sort of invalid state that has been rectified by either the reboot or restart of DataCAD.

Who is online

Users browsing this forum: No registered users and 8 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 Architects Since 1984