Hi,
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:
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:
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]).
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);
ProcessSelection;
l.state := 101;
end;
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);
ProcessSelection;
l.state := 101;
end;
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]).
David Henderson
dhSoftware - Add-on Macros for DataCAD
dhSoftware - Add-on Macros for DataCAD