1
$\begingroup$

I have these geodesic meshes from the geodesic add-on, every flat face is not made just by the vertices of the border.enter image description here How can I separate every face as diferent object or linked meshes making them stay in place?

$\endgroup$
2
$\begingroup$

Look at the edges face angle

This answer https://blender.stackexchange.com/a/177913/15543 separates a mesh into all its faces, and makes the face center the origin of the new single face mesh.

enter image description here Result, all flat regions separated, showing one "face object" in edit mode

Instead for script below, make a bmesh, find all the edges whos face angle is greater than 1 degree and split them. Note a boundary edge has no face angle

Then pop into object mode and separate into loose parts. As in prior answer the origin is moved to center of geom of new object, rather than keeping that of old.

Run the script with object of interest active and in edit mode.

import bpy
import bmesh
from mathutils import Quaternion, Vector
from math import radians


context = bpy.context

tol_angle = radians(1) # one degree tolerance of flat

ob = context.edit_object
me = context.object.data
bm = bmesh.from_edit_mesh(me)
edges = [e for e in bm.edges 
        if not e.is_boundary 
        and e.calc_face_angle() > tol_angle]

bmesh.ops.split_edges(bm, edges=edges)

bpy.ops.mesh.separate(type='LOOSE')

bpy.ops.object.mode_set()
z = Quaternion()
for ob in context.selected_objects:
    print(ob)
    me = ob.data
    mw = ob.matrix_world
    mwi = mw.inverted()
    c = sum((v.co for v in me.vertices), Vector()) / len(me.vertices)
    n = sum((f.normal for f in me.polygons), Vector()).normalized()


    q = z.rotation_difference(n.to_track_quat())
    M =  q.to_matrix().to_4x4()
    M.translation = c
    me.transform(mwi @ M.inverted())
    ob.matrix_world = M

Note the edge split modifier could be added and applied to emulate the edge split bmesh modifier (may be quicker on large meshes). Would need to be in object mode to apply modifier. Still need to be in edit mode to separate loose.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.