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.
-
$\begingroup$ related: blender.stackexchange.com/questions/805/… Do you just want to add a vert there, or do you want to merge the existing verts? (see blender.stackexchange.com/questions/1759/…) $\endgroup$– gandalf3Commented Sep 18, 2013 at 3:40
-
$\begingroup$ Either way. If it just adds the vert there, I can manually merge it. $\endgroup$– KeavonCommented Sep 18, 2013 at 3:46
-
$\begingroup$ <kbd>CTRL</kbd> + <kbd>R</kbd> Sometimes finds those intersections $\endgroup$– Vasco Cansado CarvalhoCommented Jun 15, 2020 at 22:22
9 Answers
With Blender 2.8+ you can use the Auto Merge Tool to insert a vertex between intersecting edges.
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
-
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$– KeavonCommented Jul 26, 2020 at 21:34
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.
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
-
$\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$– user7952Commented Dec 22, 2014 at 13:26
-
$\begingroup$ Unfortunately this also removes any faces connected to the edges. $\endgroup$ Commented May 7, 2021 at 9:33
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:
If you are using a release version, you can get it here
Press Space> Snap Cursor menu > Cursor to edge intersection:
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:
Then select the vertices you want to merge with one of the ones on the intersection selected last and press AltM> At last:
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
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:
Extrude upwards, select all, then press AltE> Individual faces:
Delete the top vertices:
-
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$– KeavonCommented Jun 13, 2015 at 9:19
There are several approaches. The Dynamic Spacebar Addon answer might be one of them.
Here are some other:
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.
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.
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.
You can use the Knife Project Tool to cut them
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.
You can use Vertex slide. Select the vertices and press G twice, then slide the vertices along the edges.
If the placement of the parts isn't critical, you can use the Magnet to snap the edges together.
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.
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:
- Open a text editor window and create a new text file.
- Paste the code from below there.
- Select the intersecting edges.
- Press Run Script.
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' )
-
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$– XylvierCommented Dec 30, 2019 at 7:02
Just a brief contribution, no-code solution and perfect precision:
- Select the edges you want to intersect
- Extrude them out to make faces (direction doesn't matter much)
- Select the faces, Ctrl + F, Intersect (Knife)
- Expand the context menu that appears bottom-left (subtle)
- Under the Source drop-down menu, select Self Intersect
- Select all, merge by distance to merge vertices
- Delete the extra vertices which made up the temporary faces, and you're done!
Enjoy your new intersection.
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.
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.
- Fill in edges from verticies (select two vertices, F to fill edge)
- 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")
- Delete the half-length edge (X or DEL) as in "Only faces & vertices" (The vertex of the intersection will be preserved)