# Selecting verices by angle

I am working on a road net mesh that only contains edges, no faces. They all share a common plane (I'm basically working in 2D). There is a ton of redundant edges that form ALMOST perfectly straight paths between crossings and could be dissolved but doing it manually with take me ages. On the other hand, there are some road turns that I want to keep.

I'd like to know if Blender has any command that will select my vertices by angle or select similar angle to the one I selected, so I could later dissolve them. Say, my selected vertex connects two edges that are almost parallel, and I want to dissolve all vertices that are like that. I want to be able to set a threshold, so I can keep vertices that connect edges with deviation from parallel larger than 2 degrees, for example.

Here goes a screenshot where I manually selected what I want to be done automatically. The whole mesh is much larger, that's why I'm asking.

If there's no such an option, natively or with an addon, please tell me if it would be difficult to write a script for such an action. Any help greatly appreciated.

X > Limited Dissolve does almost exactly what you're asking for, allowing you to set a threshold by angle. It works for frameworks without faces:

(Limited dissolve with increasing thresholds.)

I don't think there's a way to select vertices by edge-angle, though.

You can select edges by face-angle, but that wouldn't suit this case.

• Limited dissolve works fine and it might even substitute your script in my case. But thank you for it anyway! Do you share somewhere all of your scripts? – michalpe Jan 20 at 18:32
• @michalpe I think this might have been for batFINGER? The reason I put the select-by-angle remark in, though, is that you could tweak his script to select all verts on angles in a range, which would be very useful, and Limited Dissolve can't do. – Robin Betts Jan 20 at 18:44
• Sure, sorry, I haven't noticed that this answer was not from batFINGER. But it's useful too! – michalpe Jan 20 at 19:01

Select inline verts.

Quick edit mode bmesh script. Run in vert select mode. Selects all vertices connected to 2 edges that have an angle of within 2 degrees of 180 degrees. Think of it like a clock, and the angle between the two hands with respect to the clock centre.

import bpy
import bmesh

context = bpy.context

ob = context.edit_object
me = ob.data
bm = bmesh.from_edit_mesh(me)

def is_inline(vert, eps=1e-4):

o = vert.co
v0 = e0.other_vert(vert).co - o
v1 = e1.other_vert(vert).co - o
return pi - v0.angle(v1) < eps

for v in bm.verts:
v.select_set(