Tool for convert FreeCAD sub-assemblies to URDF-world according to config

This commit is contained in:
brothermechanic 2023-10-10 16:32:29 +00:00 committed by Igor Brylyov
parent 03bc34539c
commit 184ac7df88
12 changed files with 327 additions and 119 deletions

View file

@ -24,15 +24,16 @@ logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
def setup_meshes(bobjs, cleanup=False, sharpness=False, shading=False):
def setup_meshes(obj_names, cleanup=False, sharpness=False, shading=False):
''' Setup raw meshes list after importing '''
logger.info('Hightpoly meshes setup launched...')
for bobj in bobjs:
if not bobj.type == 'MESH':
for obj_name in obj_names:
obj = bpy.data.objects[obj_name]
if not obj.type == 'MESH':
continue
bpy.ops.object.select_all(action='DESELECT')
bobj.select_set(state=True)
bpy.context.view_layer.objects.active = bobj
obj.select_set(state=True)
bpy.context.view_layer.objects.active = obj
if cleanup:
# remove doubles
@ -68,4 +69,4 @@ def setup_meshes(bobjs, cleanup=False, sharpness=False, shading=False):
bpy.context.object.modifiers['triangulate'].keep_custom_normals = 1
bpy.context.object.modifiers['triangulate'].show_expanded = 0
return logger.info('Hightpoly meshes setup finished!')
return logger.info('Setup of %s hightpoly meshes is finished!', len(obj_names))