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.
#73504 by dhs
Thu Mar 22, 2018 2:10 pm
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:

Code: Select allPROCEDURE 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.
#73555 by Jsosnowski
Wed Mar 28, 2018 10:25 pm
It's probably a long shot, but the only line of thought that comes to my mind is that the nearby entities have been set as unused. Have you tried using ent_setunused (ent, false) to insure the ent_near selection is recognized?
#73556 by dhs
Thu Mar 29, 2018 12:38 am
hanks for your input Joe. It's an interesting thought and plausible explanation of the behaviour. But the original entity located by the ent_near call is part of the collection added to the selection set, so it is obviously not set unused (or ent_near would not have found it).

Thanks,
David H

Who is online

Users browsing this forum: No registered users and 9 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