Selection Manager

Started by Yacine, July 01, 2022, 12:33:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yacine


http://visguy.com/vgforum/index.php?topic=605


In the a.m. topic I presented an idea about creating and saving lists of shapes - a kind of "selection manager".


update - 03.07.2022:

These lists are intended to be used as a specialized clipboard, not for copying and pasting data, but for recalling selections.
So that in "bigger" drawings - letting "bigger" be defined by your own perception - you can re-select shapes as you have previously done.
eg: you've selected the "apples", or the "motors", or the "red shapes", done some operations on them and later, even after having closed and reloaded the drawing, you just reload this specific selection and do further operations on them. That's why the saving feature provides an automatic naming - so you won't need to bother about any naming - and with the renaming feature you can specify a proper name, if you feel so.



This is here the tool, with the following features:

       
  • You can save either "static" selections, which are in fact lists of shape IDs
  • and dynamic selections, which are computed by means of interpreting a formula that interprets to TRUE. eg "PinX>1" or "LineColor=1"
  • When saving you can either use the proposed name of "sel_" + current date and time, or a custom name. eg "Corners", "Shapes", "Valves", whatever.
  • The selections can be modified, renamed or deleted.
  • Modifiying would mean that you select the list entry, then take the current selection as the new one. That is in case the selection type is "static".
  • If the selection type is "dynamic", you're asked for a new formula.
  • The form has two check boxes, which I hope are self explanatory. One is to enable and disable the automatic selection, the second will make the tool either create a new selection or add to the previously selected shapes.
What else?

       
  • Under the hoods, the form will write in the user section rows with a prefix of "sel_". The prompt is used to store the selection type and the value is either a semi-colon separated list or a formula. This way the selections are saved automatically and can be restored just by calling the form.
  • When using dynamic selections, the form writes in a cell "user.temp" of the doc an enhanced version of the formula and reads it to check whether the shape complies with the condition. This may be slow. But hey, still way faster than doing it manually.
What is open?

       
  • I haven't implemented an automatic repair of the IDs lists for the case shapes are deleted. The "redefinition" feature will help till then.
I welcome you guys to test it and give some critics.


PS: the tool is in the stencil. Drop the yellow square on the canvas to start the form.
PPS: the VSDX is just for playing. The tool should work with any other vdsx
Yacine

Yacine

Yacine

Yacine

#2
Just thought about a "deselect" function, so as to remove a certain selection from the current one.
Eg Take the "frame" selection and remove the "corners", so as to keep only the pure sides.
Not a big deal. A button and 3 lines of code.


In a realistic use case I could for instance do "select all valves", then unselect all parts that are "pneumatically driven".




Thinking about it furthermore, it would be nice to have some sort of logic formula : (SelA AND selB) OR NOT(selB). But I wouldn't know adhoc how to implement it. (Maybe store the results, before applying?)
Yacine