78
$\begingroup$

I need to put a point at the intersection of two edges. Below is a picture with red circles around where I need points to be placed.

$\endgroup$
3

9 Answers 9

51
$\begingroup$

With Blender 2.8+ you can use the Auto Merge Tool to insert a vertex between intersecting edges.

enter image description here

Just enable the option Auto Merge and Split Edges & Faces in the Tool Shelf, then select a vertex and move it. Upon placing it down the tool will create vertices between the connected edges and the edges intersecting them.

If you don't want to move any vertices just select the intersecting edges or their vertices and press GEnter

$\endgroup$
1
  • 4
    $\begingroup$ This is most definitely the best solution now! Thank you for making me aware of it. If you want to make sure to not move it at all, G Z 0 Enter would be the safest way to avoid moving it even a pixel. $\endgroup$
    – Keavon
    Commented Jul 26, 2020 at 21:34
37
$\begingroup$

If all you really want is to add a vertex at the position of intersection, then something like this script would work: (this even adds the vertex at the projected intersection of two lines, or the closest point if they never intersect)

import bmesh
import bpy
from mathutils import geometry

def add_vertex_to_intersection():

    obj = bpy.context.object
    me = obj.data
    bm = bmesh.from_edit_mesh(me)

    edges = [e for e in bm.edges if e.select]

    if len(edges) == 2:
        [[v1, v2], [v3, v4]] = [[v.co for v in e.verts] for e in edges]

        iv = geometry.intersect_line_line(v1, v2, v3, v4)
        iv = (iv[0] + iv[1]) / 2
        bm.verts.new(iv)
        bmesh.update_edit_mesh(me)

add_vertex_to_intersection()

this does not attach the vertex to any edges/faces. Here it is packaged as an addon accessible from: W > Place vertex at intersection


This is now part of mesh_tinyCAD

A while back I added this feature to mesh_tinyCAD, and called it (Vertex to Intersection) V2X. I use it to add guide-vertices to intersections and it is less potentially destructive than the XALL or VTX operations.

$\endgroup$
1
  • $\begingroup$ You make it looks easy. $\endgroup$
    – Ari
    Commented Sep 12, 2018 at 1:55
25
$\begingroup$

I found tinyCAD addon the most helpful solution for this problem. It can be downloaded here:

https://github.com/zeffii/Blender_CAD_utils

You can install several ways but the easiest is to download the zip linked in the readme and use the Install from File option in UserPreferences > Addons. Then you can enable it as usual.

To use it, just select intersecting edges, press W and select TinyCAD > TinyCAD XALL

tiny cad

$\endgroup$
2
  • $\begingroup$ Great find. This is the question that originally brought me to this site, and this addon is the only solution I've really liked so far. $\endgroup$
    – user7952
    Commented Dec 22, 2014 at 13:26
  • $\begingroup$ Unfortunately this also removes any faces connected to the edges. $\endgroup$
    – gatzkerob
    Commented May 7, 2021 at 9:33
10
$\begingroup$

To expand on Haunt_house's answer, to place a vertex at the intersection you can use the Dynamic spacebar addon

This is include with development builds of blender by default, but you will still have to enable it in the User preferences:

enter image description here

If you are using a release version, you can get it here

Press Space> Snap Cursor menu > Cursor to edge intersection:

enter image description here

This snaps the 3D cursor the the intersection between the selected edges.

Now you can add a new mesh (press ShiftA while still in edit mode) and then press ShiftS> Selection to cursor:

enter image description here

Then select the vertices you want to merge with one of the ones on the intersection selected last and press AltM> At last:

enter image description here

Alternate Workflows

For something like this, You might be better off with a different workflow:

Array modifier

You could use the Array modifier with an object offset, see this answer

enter image description here

Note that in the above image, the plane object as been rotated -120 degrees in object mode.

(This would be similar to Haunt_house's solution of using different objects)

Primitives

You might be able to use a primitive to get the desired geometry, Add a circle and set the vertices to 3 in the Redo menu or the F6 menu:

enter image description here enter image description here

Extrude upwards, select all, then press AltE> Individual faces:

enter image description here

Delete the top vertices:

enter image description here

$\endgroup$
1
  • 3
    $\begingroup$ I would suggest you remove the Alternate Workflows section because they are specific only to the model I showed in the example and not helpful to anyone else visiting this question. $\endgroup$
    – Keavon
    Commented Jun 13, 2015 at 9:19
8
$\begingroup$

There are several approaches. The Dynamic Spacebar Addon answer might be one of them.

Here are some other:

  1. Instead of creating the three parts in Edit Mode, create them in Object Mode as linked copies with AltD and rotate them. If you now go into editmode, you can adjust the length by using G and restraining to a local axis by pressing X, Y, or Z twice. With enough zoom you can adjust the verts to meet and then merge them with AltM or the Magnet Tool. Remove Doubles should work too.

  2. You can use the Knife. Select all verts, zoom in a lot and cut the edges with ShiftK (shift to cut all edges) where they intersect. Then clean up.

  3. You can select the verts of the upper vertical part, and move them up until they meet the side part's edges. Then use the cursor as pivot point with Dot. Copy one of them and rotate it 120 degrees around the cursor to get the third intersection point.

  4. You can use the Knife Project Tool to cut them

  5. You can use a three sided cylinder and extrude it outward. While in Face Select mode, select the three sides and use Mesh>>Extrude>>Individual Faces (if you have cubes instead of planes in your example). Sometimes reversing the workflow is a good idea.

  6. You can use Vertex slide. Select the vertices and press G twice, then slide the vertices along the edges.

  7. If the placement of the parts isn't critical, you can use the Magnet to snap the edges together.

  8. The ordinary Knife Tool has snapping functionality. With everything selected, snap it to both ends of an edge and the intersecting edge will be cut.

$\endgroup$
7
$\begingroup$

So, I had to play with this until I solved it in the basic mathematical sense. So, here's a solution that will work for a pair of edges that really intersect, and it will also edd a vertex at the intersection point.

To activate:

  1. Open a text editor window and create a new text file.
  2. Paste the code from below there.
  3. Select the intersecting edges.
  4. Press Run Script.

enter image description here

Here's the code:

import bpy, bmesh
from mathutils import Vector

globCo = lambda co, o: o.matrix_world * co

def find_intersection( edges, o ):
    # Calculate global locations of edge verts
    p1, p2 = [ globCo( v.co, o ) for v in edges[0].verts ]
    p3, p4 = [ globCo( v.co, o ) for v in edges[1].verts ]

    v1 = p2 - p1 # Edge 1 line vector
    v2 = p4 - p3 # Edge 2 line vector

    # Calcualte intersection
    # Based on paramteric line equation: (x,y,z) = p0 + t * lineVec
    numer = v2.y * ( p3.x - p1.x ) + v2.x * ( p1.y - p3.y )
    denom = v1.x * v2.y - v1.y * v2.x
    t1    = numer / denom

    co = Vector( [ getattr( p1, i ) + t1 * getattr( v1, i ) for i in 'xyz' ] )

    bpy.context.scene.cursor_location = co

    return co

o  = bpy.context.object
if o.mode == 'EDIT':
    bm    = bmesh.from_edit_mesh( o.data )
    edges = [ e for e in bm.edges if e.select ]

    if len( edges ) == 2:
        co = find_intersection( edges, o )

        # Split edges and add new vert to newly created edges
        for e in edges:
            p1, p2 = [ globCo( v.co, o ) for v in e.verts ]
            fac = ( co - p1 ).length / ( p2 - p1 ).length
            bmesh.utils.edge_split( e, e.verts[0], fac )

# Remove doubles
bpy.ops.mesh.select_mode( type = 'VERT' )
bpy.ops.mesh.select_all( action = 'SELECT' )
bpy.ops.mesh.remove_doubles()
bpy.ops.mesh.select_all( action = 'DESELECT' )
$\endgroup$
1
  • 1
    $\begingroup$ I'd like to point out that matrix multiplications now use @ instead of *. "o: o.matrix_world * co" would become "o: o.matrix_world @ co" $\endgroup$
    – Xylvier
    Commented Dec 30, 2019 at 7:02
7
$\begingroup$

Just a brief contribution, no-code solution and perfect precision:

  1. Select the edges you want to intersect
  2. Extrude them out to make faces (direction doesn't matter much)
  3. Select the faces, Ctrl + F, Intersect (Knife)
  4. Expand the context menu that appears bottom-left (subtle)
  5. Under the Source drop-down menu, select Self Intersect
  6. Select all, merge by distance to merge vertices
  7. Delete the extra vertices which made up the temporary faces, and you're done!

Enjoy your new intersection.

$\endgroup$
1
$\begingroup$

Another way that I find easier is to just use the knife tool K. Press K then left click near the intersection, draw the line over the intersection and left click again, then hit enter. This creates three new vertices, one of which is at the intersection. Delete the others and fill in any faces that get removed and you are done.

$\endgroup$
-1
$\begingroup$

Quick & Dirty solution

This I use and should work for you in any case (no cutting) without creating unnecessary geometry in the end. This method is manual and might not be fast for cases with multiple intersections in different locations.

  1. Fill in edges from verticies (select two vertices, F to fill edge)
  2. Extrude (E) half-length edge from any original vertex (in corners) (overlay any existing edge with one new while having snapping set to "Edge Center") Center Snapping
  3. Delete the half-length edge (X or DEL) as in "Only faces & vertices" (The vertex of the intersection will be preserved)
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .