Typical airplane has many different holes, in its fuselage and wings. Blender has some Boolean commands. You can use them, to create a hole in a mesh, but they can sometimes produce not exactly the results, you want. Usually there are problems with the faces around the new (crossing) edge. I have found myself many times on deleting the ones, originally created by the Boolean operation. After their removal, I had to create manually a more “regular” face pattern around such hole.

Ultimately, I concluded, that I need a tool, which would produce just the common edge of two crossing meshes. It was more practical to create the new faces around it manually, not spending time on removing the automatically created ones. So, here is such tool. I have found it useful, maybe you also utilize it.

Here you can download the CrossSection.py script file.

To follow this tutorial, you should place the Cross Section script into your Blender script directory (here is the tutorial, which explains how to do that).

1. Crossing two meshes in six clicks

To the default Blender cube I have added a second mesh object – a cylinder:

Fig. 1.1. Meshes, that will be crossed. Fig. 1.2. The same meshes, but from isometric view.

If you want to repeat exactly what I have done: I have just added new cylinder it in the "three-quarters" isometric view (Fig. 1.2.). It was created using Add=>Mesh=>Cylinder command, with following parameters: vertices: 32, radius: 1, depth: 2, no cap ends.

Now:

  • Select the Tube object (the cylinder on the Fig. 1.1);
  • Add to the selection the Cube object;
  • Issue Object=>Scripts=>Cross Section command. A dialog box will appear:
  • Fig. 1.3. Cross Section dialog box.

    Do not change anything on the dialog box. Just click the OK button.

    Fig. 1.4. The result – cross section edge, added to the active object.

    Almost immediately (because both meshes are rather simple) the active object has been switched into Edit mode. The new edge – containing the vertices of the cross section – has been added to it. Do with the cross-section edge what you want. If you are not satisfied with this result – just press [X] to remove it, and then [Tab] to switch back into Object mode.

    2. Script options – details of its dialog box
    Fig. 2.1. The script dialog box.

    The dialog box of the Cross Section script contains a short description of operation, and two option toggles.

    Description of the operation informs about the number of the faces, that will be examined, in each mesh. The “A” mesh is the mesh of the active object – the object, which you have selected as the second one. The cross section edge is always added to the “A” mesh. From the operation description you can also learn the name of the “A” mesh (in Fig. 2.1 – Cube). The second mesh is called “B”. This dialog box presents analogical information for it, like for the “A” mesh: number of triangle faces, mesh name (in Fig. 2.1. – Tube).

    Use B edges option. If you switch it off, the result will contain the vertices found along the “A” mesh edges, only. It is turned on by default, what means that the result will contain vertices obtained from both meshes;

    Use diagonals option. During the calculations every four-vertex face is turned into two triangles, along the shorter diagonal. If you want to have include the results of crossing such diagonals with opposite mesh faces, turn this option on. Usually you will need it in special cases, only (like calculation of the cross section of two cubes).

    3. Crossing mesh fragments

    It is possible to calculate the common edge for selected fragments of the object's meshes, only. To do it, in Edit mode just select the faces, you want to use for these calculations, in each mesh. Then select both objects for the Cross Section operation, like in the previous section:

    Fig. 3.1. Selected fragment of the first mesh. Fig. 3.2. Selected fragment of the second mesh.

    Issue the Object=>Scripts=>Cross Section command. A dialog box will appear. Compare it to the one from Fig. 3.3. Have you noticed, that the one from Fig. 3.3 declares smaller number of the faces?

    Fig. 3.3. Cross Section dialog box - notice smaller number of faces in the operation description.

    When you click the OK button, you will see the result:

    Fig. 3.4. The result of crossing two mesh fragments – a corresponding fragment of crossing edge;
    4. Troubleshooting

    I have worked hard on the algorithm that connects properly the cross-section vertices, which have been found. Anyway, sometimes it may happen, that you will miss some important fragment of this edge. It is usually a problem of the script with determining the order of the vertices along the cross edge. Such case you can see in Fig. 4.1.

    Fig. 4.1. Improper result of cross section calculation – missing a part of the crossing edge;

    There are two possible workarounds:

  • move a little one of the objects – usually the problem appears, when an edge from one mesh crosses exactly an edge from another mesh. Even minimal movement will resolve the problem;
  • reduce the number of the faces for the cross operation, selecting the “active fragments” of the mesh – as shown in the paragraph 3. You can still build whole edge from a few pieces, obtained by subsequent calls to the Cross Section script;