Select overlapping entities
Moderators: andrew, Husky, J-J
Select overlapping entities
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.
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
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.
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
- Attachments
-
- DefaultAction.js
- (26.42 KiB) Downloaded 974 times
Re: Select overlapping entities
Hi riverbuoy,
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 ...
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
Yes - I think its a very good start!riverbuoy wrote:Is this a useful first attempt?
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 ...
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
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Re: Select overlapping entities
Hi Husky,
Thanks for your feedback.
riverbuoy
Thanks for your feedback.
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.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 ...
riverbuoy
Re: Select overlapping entities
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: - 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):
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.
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: - 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):
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).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 ...
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
Hi Andrew,
By the way, I think the ToolMatrix is also great.
Your hard work is much appreciated.
Thanks
riverbuoy
Thanks for the tip. I wasn't aware of this.andrew wrote:- Use Alt-click instead of Ctrl-Click (Ctrl-Click is the same as right-click on most Mac systems)
I think you're too modest. You've completely changed this and created a much better solution. A great addition.andrew wrote:Thanks riverbuoy. I've extended / modified this a bit and integrated it into the current development version.
By the way, I think the ToolMatrix is also great.
Your hard work is much appreciated.
Thanks
riverbuoy
Re: Select overlapping entities
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 otherwiseriverbuoy wrote:I think you're too modest. You've completely changed this and created a much better solution. A great addition.
Cool, thanks!By the way, I think the ToolMatrix is also great.
Re: Select overlapping entities
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
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
This is part of QCAD since version 3.12.7 (released 2016/02/15).tkmbi wrote:Hey, I would like test the script, may I get a download link, in Github ?
Our git repository is at:
https://github.com/qcad/qcad
The alt-click context menu is implemented in scripts/EAction.js (EAction.getEntityId).
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 EditorThis can be helpful for me, to find out easily the length of a line.
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.Would it be possible to trim and combined arcs with overlapping ends, too?
Re: Select overlapping entities
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
"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
- Attachments
-
- two_arcs
- two_arcs.JPG (11.9 KiB) Viewed 23565 times
Re: Select overlapping entities
@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!
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!
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."