# Create Shaft Opening From CAD (Remove diagonal line)

Hi all,
I’m trying to create shaft openings from a CAD file. But I have an issue.

The opening in my CAD contains diagonal lines, so when I group curver and create shaft opening from them it gives error. Only lines created from circles or openings in cad without diagonal lines can be created.

Can you guys help me come up with the best solution in this case.

Thank all very much.

Hi @bao1296 ,

You could try something like this:

• Split the list up, after the group curves node, by list length, assuming you only have lists containing 1 or 5 items, such that you now have a list with sublists of 5 to work with.
• Sort the sublists in this list by curve length.
• Remove the first or last list, depending on which one is the longest one, since the diagonal is always the longest one.

I think this proposal is not reasonable because any opening don’t have diagonal

as far as i think it is possible to get the contour of the whole cuvers and get the contour of that group however i can’t find any node that matches my thinking

In addition, there are some cases where the diagonal is shorter than the contour, so it is not reasonable to arrange to remove the line with the largest length.

I see.

You could use a Convex Hull algorithm for that, just note that this doesn’t really work well for circles, so you will still have to split those before.

I’ll try to create a simple script working for you.

See if this works for you:

2022-12-24 Create Duct Perimeter Curves from Various Shapes.dyn (29.5 KB)

PS: I used the Springs Convex Hull for 2D shapes because I couldn’t get the OOTB Convex Hull node to work.

Convex hull should account for most cases, but if not you could take each curve and check how many other curves it meets. In total a diagonal should meet 4 other curves, whilst a non diagonal edge should meet 3 or less.

Thank you so much for your great plan. I have worked on most of the openings, however some of my openings are not working properly.
Can you