I seem to have found a bug with selection sets, but perhaps somebody can offer a suggestion or solution regarding the behaviour I outline below. This is not critical to me as I have found a better way to achieve what I wanted (using mode_atr instead of mode_ss), so I am really just interested in any comments that might help me understand the behaviour I observed:
I had a procedure which is a bit to long and complicated to include in full here, so I have outlined the basic logic in simplified pseudo-code below:
The code that calls the above is in a loop that asks the user to select an entity (using getpoint) and calls the above procedure with each point entered until the user exits the loop.
This all works just fine provided that I don't pass a point that identifies the same collection of entities twice in a row... if pass a point which identifies the same entities as the previous call of the procedure, then the collection of entities is identified correctly (which I know as they are erased from the screen by the drmode_black logic), but the selection set appears to be empty after the ssClear and subsequent ssAdd calls.
This occurs even if I exit and then re-invoked the macro to select the same entities again. I also confirmed that if I exited the macro after a successful call to this procedure then the selection set does contain the expected entities, but if I exit the macro after an unsuccessful call (using a point that identifies the same entities as previous call) then the selection set is empty after exiting the macro.
Any comments would be appreciated.
Thanks,
David H.
I had a procedure which is a bit to long and complicated to include in full here, so I have outlined the basic logic in simplified pseudo-code below:
Code: Select all
PROCEDURE MyProc (pt : IN OUT point);
VAR
mode : modetype;
Collection : array of entity;
ssNum : an integer number initialised to a value between 0 and 7
pt1 : point;
BEGIN
initialise and setup mode for entities I am interested in;
use ent_near to identify an entity based on mode and pt;
getCollection (entity); !a procedure that populates the Collection with related entities based on some entity attibutes;
ssClear (ssNum);
for var i := 1 to number of entities in Collection
ssAdd(ssNum, Collection[i]);
ent_draw (Collection[i], drmode_black); !works fine in all cases, so I know Collection contains the correct entities
end;
mode_init (mode);
mode_ss (mode, ssNum);
dragmodemove (mode, pt);
getpoint (pt1);
for each entity returned by mode
move by the distance between pt & pt1
update the entity;
ent_draw (entity, drmode_white)
end;
END;
The code that calls the above is in a loop that asks the user to select an entity (using getpoint) and calls the above procedure with each point entered until the user exits the loop.
This all works just fine provided that I don't pass a point that identifies the same collection of entities twice in a row... if pass a point which identifies the same entities as the previous call of the procedure, then the collection of entities is identified correctly (which I know as they are erased from the screen by the drmode_black logic), but the selection set appears to be empty after the ssClear and subsequent ssAdd calls.
This occurs even if I exit and then re-invoked the macro to select the same entities again. I also confirmed that if I exited the macro after a successful call to this procedure then the selection set does contain the expected entities, but if I exit the macro after an unsuccessful call (using a point that identifies the same entities as previous call) then the selection set is empty after exiting the macro.
Any comments would be appreciated.
Thanks,
David H.
David Henderson
dhSoftware - Add-on Macros for DataCAD
dhSoftware - Add-on Macros for DataCAD