How do I select all elements that BOTH ends do connect with another element. Or do not(for deletion)

Use this forum to ask questions about how to do things in QCAD.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
spdkils
Newbie Member
Posts: 3
Joined: Wed Jun 29, 2022 6:30 pm

How do I select all elements that BOTH ends do connect with another element. Or do not(for deletion)

Post by spdkils » Wed Jun 29, 2022 6:43 pm

Image

In this image, I have 4 lines.

L1 connect to L2, that connects to L3 and L4.

I have a line without any end points touching other end points. (The white line in the middle)

I want to select lines that only connect on both ends, to other end/start points.

So, in the case of this image... Nothing would get selected, because I do not have a closed loop.

Why do I want this? Well when using my water-jet, sometimes I import SVG, and there are lots of duplicate lines, single points, and other artifacts that take me a while to clean up.

If I could select shapes that are complete loops, end to end, and drag them out, I would leave behind the mess in many cases, and greatly speed up my work.

I've already been working on a script to do this, but the queryIntersectedEntitiesXY seems to have some tolerances built in, seems to grab things that don't share a point with what I'm doing.

Is there some other way to select all entities that have a start/end point with a specific point.

I could just grab ALLL entities and brute force loop it. I was hoping there was some modifier on the contour select, that ensured it only selected segments in a closed loop.
Attachments
Screenshot 2022-06-29 103643.png
Screenshot 2022-06-29 103643.png (7.69 KiB) Viewed 3799 times

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: How do I select all elements that BOTH ends do connect with another element. Or do not(for deletion)

Post by andrew » Wed Jun 29, 2022 7:39 pm

1. Select > Select All
2. Draw > Polyline > Polyline from Selection
3. View > Selection Filter
Screenshot 2022-06-29 at 20.36.00.png
Screenshot 2022-06-29 at 20.36.00.png (26.44 KiB) Viewed 3793 times
4. Enter the data as shown and click the button at the bottom left to select all closed polylines.

You can then move them, copy them, etc. These are all your closed loops.

Optional:
Modify > Explode if you do not want to work with polylines.

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4931
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: How do I select all elements that BOTH ends do connect with another element. Or do not(for deletion)

Post by Husky » Wed Jun 29, 2022 9:00 pm

Interesting question and I still don't know how to solve it. :oops:
andrew wrote:
Wed Jun 29, 2022 7:39 pm
4. Enter the data as shown and click the button at the bottom left to select all closed polylines.
Maybe I'm missing something but I can't figure out where to find a closed polyline. e_confused
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..."

spdkils
Newbie Member
Posts: 3
Joined: Wed Jun 29, 2022 6:30 pm

Re: How do I select all elements that BOTH ends do connect with another element. Or do not(for deletion)

Post by spdkils » Wed Jun 29, 2022 11:07 pm

Thanks for the response!

It appears I can only select a closed path if it is already a poly line.

I've exploded all the shapes to find these tails, duplicates, zero length items, partial overlaps, etc.

You end up with hundreds of random "noise" in the drawing that you can't really see no matter how far you zoom in.
So you need tools/options to find them.

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4931
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: How do I select all elements that BOTH ends do connect with another element. Or do not(for deletion)

Post by Husky » Wed Jun 29, 2022 11:24 pm

We can help more efficient when you attache a drawing or at least an example drawing which shows the issue in question.
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..."

spdkils
Newbie Member
Posts: 3
Joined: Wed Jun 29, 2022 6:30 pm

Re: How do I select all elements that BOTH ends do connect with another element. Or do not(for deletion)

Post by spdkils » Thu Jun 30, 2022 12:51 am

Husky wrote:
Wed Jun 29, 2022 11:24 pm
We can help more efficient when you attache a drawing or at least an example drawing which shows the issue in question.
I did... That is why there is an image attachment with labels on the line segments.

However I'll draw a super simple example and attach that as well.


I have 5 line segments.
I want to select the 4 line segments where both the start/end point are at the same coordinates as another segment.

So click 1 button, select all lines head to tail, and then the next segment head to tail, and only segments, in the graph that have a neighbor on both head and tail, until I get back to my starting segment.

If I can't get all the way back to my starting segment... Fail, no selection, tell me where the last piece was in the chain, or select the last piece or something.

So line 5 should not be selected in this example, but the other 4 should be if I start with any segment except 5.

If I start with line 5, NO selection at all, because it doesn't form a loop.
Simple Drawing.dxf
(103.17 KiB) Downloaded 203 times

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4931
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: How do I select all elements that BOTH ends do connect with another element. Or do not(for deletion)

Post by Husky » Thu Jun 30, 2022 2:32 am

You're changing the scope of the application ...

the dxf:
Andrews suggestion will work on this 5 line example based on the possibility to create a closed loop.

the image:
Andrews suggestion will not work on this open loop example. The Selection Filter can't cover that with an open/closed condition.
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..."

CVH
Premier Member
Posts: 3364
Joined: Wed Sep 27, 2017 4:17 pm

Re: How do I select all elements that BOTH ends do connect with another element. Or do not(for deletion)

Post by CVH » Thu Jun 30, 2022 6:57 am

Hi,
There is no uniform answer on how to clean up a drawing.
This issue pops up every now and then.
There is no AutoCad 'Overkill' command under QCAD.
It may even be a bit too aggressive.
spdkils wrote:
Wed Jun 29, 2022 6:43 pm
but the queryIntersectedEntitiesXY seems to have some tolerances built in, seems to grab things that don't share a point with what I'm doing.
This queries entities that intersect with an RBox and not only those that end in the box.
The double click to select 'contours' (All connected entities), TC, OG or OC methods look at the endpoints of entities.
But decision making gets more complicated when 3 or more entities end in the same spot.
spdkils wrote:
Wed Jun 29, 2022 6:43 pm
Why do I want this? Well when using my water-jet, sometimes I import SVG, and there are lots of duplicate lines, single points, and other artifacts that take me a while to clean up.
You might want to Detect Zero Length Entities (MZ) first.
Then Detect Duplicates (MD).

Both methods have some parameters. MD will not easily detect partially overlapping.
I usually don't delete them at once but will first send them to a 'trash' layer.

Polyline from Segments (OG) may chain elements as desired.
OC does the same but the starting segments are arbitrary.
OG creates geometrically closed forms, OC creates logical closed forms.
In both cases there might still be artifacts like going partially back and forth.

It may have a different outcome starting at a different segment.
In your first image (not a drawing :wink: ) select any of the 4 line segments.
In your second example (a dxf drawing) select 1,2 or 4 but not 3 or 5.

Where all methods stop chaining into an open shape, there might be partially duplicates/overlapping.
These can be selected individually with Alt-select.

And no, there is no one-click solution for any problem. :wink:

Regards,
CVH
Last edited by CVH on Thu Jun 30, 2022 6:47 pm, edited 1 time in total.

CVH
Premier Member
Posts: 3364
Joined: Wed Sep 27, 2017 4:17 pm

Re: How do I select all elements that BOTH ends do connect with another element. Or do not(for deletion)

Post by CVH » Thu Jun 30, 2022 7:55 am

spdkils wrote:
Wed Jun 29, 2022 6:43 pm
Is there some other way to select all entities that have a start/end point with a specific point.
Maybe this is a solution.
https://qcad.org/doc/qcad/3.0/developer ... c737669802

Otherwise you need to evaluate endpoints of entities that match your case.

Regards,
CVH

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: How do I select all elements that BOTH ends do connect with another element. Or do not(for deletion)

Post by andrew » Thu Jun 30, 2022 8:22 am

Husky wrote:
Thu Jun 30, 2022 2:32 am
the image:
Andrews suggestion will not work on this open loop example. The Selection Filter can't cover that with an open/closed condition.
The user does not want anything to be selected in that first example:
spdkils wrote:So, in the case of this image... Nothing would get selected, because I do not have a closed loop

zilmosantos
Active Member
Posts: 28
Joined: Fri Aug 13, 2021 9:55 am

Re: How do I select all elements that BOTH ends do connect with another element. Or do not(for deletion)

Post by zilmosantos » Thu Jun 30, 2022 2:54 pm

I was just checking the forum, I'm away of my home computer... but just giving a double click on an entity doesn't select the connected entities? I have discovered this by accident some time ago, but can't remember if it only works with closed loops.

Post Reply

Return to “QCAD 'How Do I' Questions”