How to exclude or delete edge lines from a rectangular grid?

Hello everyone. I want to know how to exclude or “delete” edge lines from a rectangular grid. I want to delete them because I need a net of pipes into a rectangular section frame.
It’s not an option to erase them manually because I will need to adjust the grid parameters, such as size and number of cells.

rectangular (6.9 KB)

The green rectangle represents the segments I want to erase, and the red lines, the segments that I want the base curve of a pipe to be.

This is what I’m trying to do, if you need more information:


As I have written, I don’t want the pipes marked with the purple X.

Thanks in advance for your attention and your help

rectangular (10.2 KB)

Thanks a lot. I’m a new user and analyze your answer will be useful for my learning process.

Excelent. Thanks.