Page 1 of 1

Select overlapping entities

Posted: Thu Jan 28, 2016 6:14 pm
by riverbuoy
Hi

This is a first attempt to solve the issue of selecting a particular entity when they are overlapping, or stacked on top of each other.
For example lines. The following image shows 5 lines stacked on top of each other. The first line goes from point 1 to point 6, then the second line goes from point 2 to point 6 etc. You see just below the drawing, a line stating '5 entities found'. This works by using the key combination 'Ctrl + Left Click'. If you position the mouse pointer to the part of the line between point 5 and point 6, then the message '5 entities found' appears. You then can cycle through the entities by left clicking (without using the control or shift buttons). When the line you want is highlighted, press 'Return' or 'Enter' keys on the keyboard to stop cycling.
Select1.png
Select1.png (4.45 KiB) Viewed 23570 times
This only works outside of commands. It won't work, for example, in the trim command. This is because I have changed the file 'DefaultAction.js'. Selecting entities inside a command would need something else to be changed (what? I don't know at present). So this is a first attempt at doing this. You can select entities, and then run commands that expect or use a selection, such as 'Move/Copy'. Also you can select an entity and then open the property editor to see the details.
At present using 'Ctrl + Left Click' selects one entity and adds it to the selection set, or, if already selected, removes it from the selection set. This will continue to work if only one entity is under the cursor. If two or more entities are under the cursor then a message is shown stating how many entities were found. You can then cycle through the entities by left clicking. If you reach the end of the list then it cycles back to the first entity. Keep left clicking until the entity you want is highlighted, then press 'return' or 'enter' to stop cycling. If the entity is not in the selection set, then it is highlighted and added to the selection set. If the entity is already in the selection set then it is not highlighted and is removed from the selection set.
I have attached the file 'DefaultAction.js'. This goes in the 'scripts' directory. Replace the existing file (or rename the existing file first).

If you find any problems, please let me know.
Is this a useful first attempt?

Feedback would be much appreciated.

Thanks

riverbuoy

Re: Select overlapping entities

Posted: Fri Jan 29, 2016 10:57 pm
by Husky
Hi riverbuoy,
riverbuoy wrote:Is this a useful first attempt?
Yes - I think its a very good start! :D


Here are my thoughts:
My biggest problem with overlapping entities is ........... that I have first to walk into the trap before I know there is more than one entity ... :cry:

If I have a suspect line etc I actually use the mouse rectangle selection in a right to left move to see in the Property manager how many overlapping lines are now selected. If I need to move/delete etc shorter lines which overlap longer lines I try to catch them also with the mouse rectangle selection - but now with a left to right move.
Yes I know - not perfect - but it helps to handle the situation ...

If I see your example drawing with this 1-6 / 5 overlapping lines - how do I know where to click?
If I click between 1 and 2 nothing indicates that we have an overlapping situation.
Clicking between 3 and 4 tells me that we have 3 entities ...
... and clicking between 5 and 6 tells me 5 entities found.

Would it be possible that the tool reads the information regardless to the click position? (click between 1 and 2 gives the same info like click between 5 and 6)
Or would it be possible to get some kind of information before I click? Maybe number of overlapping entities or some kind of highlighting color indicator?

BTW: I like this "Ctrl + Left Click / and cycling just with a left clicking mouse" solution.

Thank you for all your help!
Husky

Re: Select overlapping entities

Posted: Thu Feb 04, 2016 5:39 pm
by riverbuoy
Hi Husky,

Thanks for your feedback.
Husky wrote:My biggest problem with overlapping entities is ........... that I have first to walk into the trap before I know there is more than one entity ... :cry:
The select command assumes you know which entities you want to select. Of course, if someone else has done the drawing, you probably don't know if there are overlapping lines, or where they are. Trying to have the select command second-guess which entity you are trying to select could be quite confusing. A separate command to highlight overlapping entities would probably be better. It could show all entities overlapping in the whole drawing, or only in a selected area of the drawing, or even show entities overlapping the entity currently under the cursor. This might even be an option in the extended selection filter in the pro version.

riverbuoy

Re: Select overlapping entities

Posted: Wed Feb 10, 2016 4:08 pm
by andrew
Thanks riverbuoy. I've extended / modified this a bit and integrated it into the current development version.

The things I've adjusted / changed are:
- Use Alt-click instead of Ctrl-Click (Ctrl-Click is the same as right-click on most Mac systems)
- Show context menu with list of entity candidates and additional information to choose desired entity:
Screen Shot 2016-02-10 at 15.19.55.png
Screen Shot 2016-02-10 at 15.19.55.png (25.38 KiB) Viewed 23427 times
- Make Alt-clicks available whenever the user needs to choose an entity (e.g. when selecting entities, drawing parallels, trimming, etc).
- Entities are highlighted when hovering over the context menu (here demonstrated with the Draw> Line > Parallel tool):
select_overlapping.gif
select_overlapping.gif (37.82 KiB) Viewed 23427 times
Husky wrote:My biggest problem with overlapping entities is ........... that I have first to walk into the trap before I know there is more than one entity ... :cry:
I think that's a different use case. A tool to choose between overlapping entities is meant to choose between overlapping entities when it's difficult or impossible to click the correct entity because multiple entities are very close to the mouse cursor (like in the animation above).

Detecting such situations in the first place is a different story for use cases in which these overlaps actually present a problem which is not always the case.
This would be more likely a detection tool to detect / select all overlapping entities in a drawing, similar to Modify > Detect Duplicates.

Re: Select overlapping entities

Posted: Fri Feb 12, 2016 7:18 pm
by riverbuoy
Hi Andrew,
andrew wrote:- Use Alt-click instead of Ctrl-Click (Ctrl-Click is the same as right-click on most Mac systems)
Thanks for the tip. I wasn't aware of this.
andrew wrote:Thanks riverbuoy. I've extended / modified this a bit and integrated it into the current development version.
I think you're too modest. You've completely changed this and created a much better solution. A great addition.
By the way, I think the ToolMatrix is also great.

Your hard work is much appreciated.

Thanks

riverbuoy

Re: Select overlapping entities

Posted: Fri Feb 12, 2016 9:19 pm
by andrew
riverbuoy wrote:I think you're too modest. You've completely changed this and created a much better solution. A great addition.
Well, I always thought that this would be hard to solve in a generic way. Only when I saw your solution and the getAllEntityIdsUnderCursor function, I got the idea to move this to EAction and use it whenever the user has to choose an entity. I wouldn't have thought of this otherwise :)
By the way, I think the ToolMatrix is also great.
Cool, thanks!

Re: Select overlapping entities

Posted: Wed Feb 24, 2016 2:46 pm
by tkmbi
Hey, I would like test the script, may I get a download link, in Github ?
This can be helpful for me, to find out easily the length of a line.
Would it be possible to trim and combined arcs with overlapping ends, too?

tkmbi

Re: Select overlapping entities

Posted: Wed Feb 24, 2016 2:56 pm
by andrew
tkmbi wrote:Hey, I would like test the script, may I get a download link, in Github ?
This is part of QCAD since version 3.12.7 (released 2016/02/15).

Our git repository is at:
https://github.com/qcad/qcad

The alt-click context menu is implemented in scripts/EAction.js (EAction.getEntityId).
This can be helpful for me, to find out easily the length of a line.
That is not really the idea. The context menu is only shown if there are multiple entities close to the cursor. You can see the length of a line in the property editor. View > Property Editor
Would it be possible to trim and combined arcs with overlapping ends, too?
This feature is only about selecting entities that are on top of each other or very close to each other. It does not modify the entities in any way.

Re: Select overlapping entities

Posted: Wed Feb 24, 2016 3:28 pm
by tkmbi
Thanks for your quick answer :-)

"Would it be possible to trim and combined arcs with overlapping ends, too?
you said
This feature is only about selecting entities that are on top of each other or very close to each other. It does not modify the entities in any way."

Ok, that I understood.

Meanwhile I found out, if you select both arcs, then it is possible to trim together with already included "trim both", I surprised !! :-)

[img]two_arcs[/img]

tkmbi

Re: Select overlapping entities

Posted: Wed Feb 24, 2016 7:47 pm
by Husky
@Andrew and riverbuoy,

I was now forced a couple times to use/test this new feature and I have to say - it works perfectly for me. Thank you both to work on it and spot this great solution!