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

#72127 by dhs
Sat Aug 19, 2017 12:41 am
I'm having a problem using mode_group. It seems to always crash with the following exception message:
Project DCADWin.exe raised exception class $C0000005 with message 'access violation at 0x00000000: read of address 0x00000000'

A snippet of the original code that was causing this problem is shown below:
Code: Select all      mode_init1 (l.mode);
      if ent_near (ent, l.getp.curs.x, l.getp.curs.y, l.mode, true) then begin
         mode_init1 (l.mode);
         mode_group (l.mode, ent);
         l.state := 101;

When I stepped through this with the debugger ent_near appeared to be returning the expected entity in ent (I checked enttype & entcolor and they were the expected values) but the code crashed on the mode_group call.

In an effort to find what the problem was I tried using a different mode variable for the second mode logic (couldn't see any problem with re-using the same one, but was willing to clutch at any straw), and I also added an ent_move and an ent_update just to make sure that the ent being returned by ent_near was a valid entity. The result of this was the following code snippet:
Code: Select all      mode_init1 (tempmode);
      if ent_near (ent, l.getp.curs.x, l.getp.curs.y, tempmode, true) then begin
         ent_move (ent, 32, 32, 32);
         ent_update (ent);
         mode_init1 (l.mode);
         mode_group (l.mode, ent);
         l.state := 101;

Once again I stepped through the above with the debugger. The ent_move and ent_update executed without problem and I was able to check that the x,y,&z values of ent.linpt1 had all increased by 32 as expected. But the mode_group call is still crashing.

I'm hoping that Dave can throw some light on this... hopefully there is something wrong with my code snippets above. (Dave: If you're willing to look into this I have already sent you a dmx file that will reproduce this problem - it is in the same file that I sent you for the getpoly problem [just choose F2 in the menu of the dmx I sent you and then select an entity]).
#72133 by Jsosnowski
Sun Aug 20, 2017 8:58 am
I noticed that you used mode_group in your shadow macro. Is that where the bug occurs? It appears to work in my DCAD12 . Is it possible that difference is in the number of entities in the group?
#72134 by dhs
Sun Aug 20, 2017 4:22 pm
mode_group works just fine in Classic DCAL (that I used for the Shadow macro).
It is in DCAL for Delphi that the bug exists. This makes it impossible to write any D4D macro that wants to implement the normal selection menu.

Who is online

Users browsing this forum: No registered users and 1 guest

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.


Software for AEC Professionals Since 1984