diff --git a/nodes/analyzer/weighted_vector_sum.py b/nodes/analyzer/weighted_vector_sum.py index 1ceca07e3a..f66705a140 100644 --- a/nodes/analyzer/weighted_vector_sum.py +++ b/nodes/analyzer/weighted_vector_sum.py @@ -47,17 +47,17 @@ class SvWeightedVectorSumNode(SverchCustomTreeNode, bpy.types.Node, SvRecursiveN def updateSizeSocket(self, context): if self.center_mode == 'VERTICES': - self.outputs['output_sizes'].label = 'Count of verts' - self.outputs['output_size' ].label = 'Total Verts' + self.outputs['output_sizes'].label = 'Count of Verts of Every Object' + self.outputs['output_size' ].label = 'Sum Verts of All Objects' elif self.center_mode == 'EDGES': - self.outputs['output_sizes'].label = 'Lengths' - self.outputs['output_size' ].label = 'Total Length' + self.outputs['output_sizes'].label = 'Lengths of Edges of Every Object' + self.outputs['output_size' ].label = 'Summ Length of All Objects' elif self.center_mode == 'FACES': - self.outputs['output_sizes'].label = 'Areas' - self.outputs['output_size' ].label = 'Total Area' + self.outputs['output_sizes'].label = 'Areas of Surfaces of Every Object' + self.outputs['output_size' ].label = 'Sum Area of All Objects' elif self.center_mode == 'VOLUMES': - self.outputs['output_sizes'].label = 'Volumes' - self.outputs['output_size' ].label = 'Total Volume' + self.outputs['output_sizes'].label = 'Volumes of Every Object' + self.outputs['output_size' ].label = 'Sum Volume of All Objects' updateNode(self, context) @@ -187,13 +187,13 @@ def sv_init(self, context): self.outputs['output_vertices'] .label = 'Vertices' self.outputs['output_edges'] .label = 'Edges' self.outputs['output_polygons'] .label = 'Polygons' - self.outputs['output_centers_of_mass'].label = 'Centers of mass of objects' - self.outputs['output_total_center'].label = 'Total center' + self.outputs['output_centers_of_mass'].label = 'Center mass of Every objects' + self.outputs['output_total_center'].label = 'Center mass of All objects' self.outputs['output_sizes'].label = '' self.outputs['output_size'] .label = '' - self.outputs['output_masses'] .label = 'Masses' - self.outputs['output_mass'] .label = 'Mass' - self.outputs['output_mask'] .label = 'Mask' + self.outputs['output_masses'] .label = 'Masses of Every Object' + self.outputs['output_mass'] .label = 'Mass of All Object' + self.outputs['output_mask'] .label = 'Mask Validity Every Object' self.updateSizeSocket(context) self.update_sockets(context) diff --git a/utils/sv_bmesh_utils.py b/utils/sv_bmesh_utils.py index 1549bd7479..c633697bc3 100644 --- a/utils/sv_bmesh_utils.py +++ b/utils/sv_bmesh_utils.py @@ -914,33 +914,35 @@ def recalc_normals(verts, edges, faces, loop=False): bm.free() return verts, edges, faces -def calc_center_mass_bmesh(center_mode, vertices_I, edges_I, faces_I, mass_of_vertices_I=None, density_I=None, skip_test_volume_are_closed=False, quad_mode="BEAUTY", ngon_mode="BEAUTY"): +def calc_center_mass_bmesh(center_mode, mesh_vertices, mesh_edges, mesh_faces, mass_of_vertices=None, object_density=None, skip_test_volume_are_closed=False, quad_mode="BEAUTY", ngon_mode="BEAUTY"): ''' Calculate center of mass for single mesh. Input: - center_mode=['VERTICES', 'EDGES', 'FACES', 'VOLUMES'] - - vertices_I = [[x1,y1,z1],[x2,y2,z2],...] (float) - vertices of mesh - - edges_I = [[0,1],[1,2],[2,3],...] (int) - indixes of verts (edges) - - faces_I = [[0,1,2],[1,2,3,4,...], ...] - indixes of verts (faces) - - mass_of_vertices_I = [ [ 1.1, 1.0, 5.2, 0.2,...] ] - mass of every vert in mesh. Extrapolate a last value to the all vertices - - density_I = [1.2] - density of volume. If center_mode is EDGES or FACES then mass of objects are proportional to length or area. + - mesh_vertices = [[x1,y1,z1],[x2,y2,z2],...] (float) - vertices of mesh + - mesh_edges = [[0,1],[1,2],[2,3],...] (int) - indixes of verts (edges) + - mesh_faces = [[0,1,2],[1,2,3,4,...], ...] - indixes of verts (faces) + - mass_of_vertices = [ [ 1.1, 1.0, 5.2, 0.2,...] ] - mass of every vert in mesh. Extrapolate a last value to the all vertices + - object_density = [1.2] - density of volume. If center_mode is EDGES or FACES then mass of objects are proportional to length or area. - skip_test_volume_are_closed - (only for volume node) If you know that volume are close then you can speed up performance if you set this parameter to True. False - force test mesh are closed. - quad_mode [BEAUTY, FIXED, ALTERNATE, SHORT_EDGE], ngon_mode [BEAUTY, EAR_CLIP] - modes for triangulation if mesh has faces with 4 and more vertices (for center_mode FACES of VOLUMES only) Output: - result_mask - True/False. If False then another output params are None - - result_vertices_I, result_edges_I, result_polygons_I - result mesh (source mesh or triangulated mesh) - - result_center_mass_mesh_I - center of mass of mesh - - result_mass_mesh_I - mass of mesh - - result_size_mesh_I - for VERTICES - count vertices, for EDGES - length of edges, for FACES - area of mesh, for VOLUMES - volume of mesh + - result_vertices, result_edges, result_polygons - result mesh (source mesh or triangulated mesh) + - result_center_mass_mesh - center of mass of mesh + - result_mass_mesh - mass of mesh + - result_size_mesh - for VERTICES - count vertices, for EDGES - length of edges, for FACES - area of mesh, for VOLUMES - volume of mesh Example: https://github.com/nortikin/sverchok/assets/14288520/e432b5c0-35e5-432b-8c9f-798f58b71f13 ''' result_mask = result_vertices_I = result_edges_I = result_polygons_I = result_center_mass_mesh_I = result_mass_mesh_I = result_size_mesh_I = None - + + vertices_I, edges_I, faces_I, mass_of_vertices_I, density_I = mesh_vertices, mesh_edges, mesh_faces, mass_of_vertices, object_density + if mass_of_vertices_I is None: mass_of_vertices_I=[1] if density_I is None: