From n.kyriazis at engys.com Thu Jul 13 11:01:52 2023 From: n.kyriazis at engys.com (Nikolaos Kyriazis) Date: Thu, 13 Jul 2023 09:01:52 +0000 Subject: [Bf-python] Get geometry displacement after applying modifier Message-ID: Hello, I am struggling the past two weeks with the following problem. I have tried different approaches but none of them worked so far, therefore I would like your help/advice. I have created a geometry in Blender, for instance a BezierCurve, and I have connected it with a Lattice modifier and a vertex group. So, once I move one point or a family of points of the lattice, the geometry shape changes as well. Is there a way to get the displacement vector, i.e. how much each geometry point (neither the lattice points nor the BezierCurce control points) has moved? i. The only way I have found so far is exporting the new geometry to stl format and comparing the old and the new (after applying bpy.ops.transform.translate()) stl files. The problem is that the stl files are not consistent. ii. I have tried using the python API to subtract the vertices of bpy.data.objects["BezierCurve"].data.vertices before and after applying bpy.ops.transform.translate(), but the list of the vectors with the vertice coordinates is identical before and after applying the lattice modifier. I also tried getting the coordinates of the geometry shape from the mesh, once in the beginning and once after the lattice translation, but the results was the same: bm = bmesh.new() bm.from_mesh(bpy.data.objects["BezierCurve"].data) vertices = bm.verts original_positions = [list(vertex.co) for vertex in vertices] Surprisingly enough, when I tried to plot the range of each coordinate, i.e the min, max values of the x,y,z coordinates of the vertices, they are not the same as the ones noticed when I do a visual inspection of the geometry, i.e with ParaView. iii. Finally, I tried getting the necessary functions from the blender source code in c, c++ but I don't think this is the correct way. To begin with, I couldn't find another executable apart from ./blender to run and test some isolated functionalities. Secondly, it wasn't so easy to grab and extract the relevant functions BKE_lattice_deform_coords_with_mesh, deformVerts to a c++ file outside blender and perform the necessary operations. I feel like the best way to proceed is (ii) but I cannot get why the vertices location is not updated although the exported stl looks different. I tried doing: bpy.ops.object.modifier_apply(modifier=bpy.data.objects["BezierCurve"].name) bpy.data.objects["BezierCurve"].data.update() after applying applying bpy.ops.transform.translate(). Any advice or idea is more than welcome. Thanks and kind regards, Nikos -------------- next part -------------- An HTML attachment was scrubbed... URL: From francesco at blender.org Thu Jul 13 19:03:18 2023 From: francesco at blender.org (Francesco Siddi) Date: Thu, 13 Jul 2023 10:03:18 -0700 Subject: [Bf-python] Sunsetting mailing list Message-ID: Dear all, As proposed a few weeks ago at https://devtalk.blender.org/t/sunsetting-mailing-lists-proposal/29377, this mailing list will be sunset today. The conversation continues on https://devtalk.blender.org! The list archive will remain available at https://archive.blender.org/. Thanks, Francesco -------------------------------------------------------------- Francesco Siddi - francesco at blender.org - www.blender.org COO at Blender and Producer at Blender Studio Buikslotermeerplein 161 - 1025 ET Amsterdam - The Netherlands -------------- next part -------------- An HTML attachment was scrubbed... URL: