Download

Datasmith import exemple not fully working on 4.26.1

i try to import CAD file with datasmith from the script exemple on documentation

i try to filter all the mesh like on the exemple, but the list is empty.
but the import work’s well all the object are imported but not filtered by the code below

my problem is get_all_mesh_actors() list is empty is the same for all other list material, custom etc…

# Modify the data in the scene to filter out or combine elements.
remove_keyword = "ROUTE"         # we'll remove any actors with this string in their names.
meshes_to_skip = set([])         # we'll use this set to temporarily store the meshes we don't need.

    # Remove from the scene any mesh actors whose names match the string set above.
    for mesh_actor in ds_scene_in_memory.**get_all_mesh_actors()**:
        print("FIND actor named: " + actor_label)
        actor_label = mesh_actor.get_label()
        if remove_keyword in actor_label:
            print("removing actor named: " + actor_label)
            # add this actor's mesh asset to the list of meshes to skip
            mesh = mesh_actor.get_mesh_element()
            meshes_to_skip.add(mesh)
            ds_scene_in_memory.remove_mesh_actor(mesh_actor)

# Remove all the meshes we don't need to import.
for mesh in meshes_to_skip:
    mesh_name = mesh.get_element_name()
    print("removing mesh named " + mesh_name)
    ds_scene_in_memory.remove_mesh(mesh)

also this seem dosen’t exist anymore:
# Additional CAD-only options:
#cad_import_options = ds_scene_in_memory.get_options(unreal.DatasmithCADImportOptions)
#cad_import_options.uv_generation = unreal.CADUVGeneration.KEEP
#cad_import_options.num_threads = 8

thank you for your help
Best Regards
Dabiel

Hello Dabiel try performing your operations on the datasmith_scene after running a translate_scene: ds_scene_in_memory.translate_scene(). The documentation states the options should have been set adequately before running the translate scene function.

Hi Flavien,

thank you very much it works.
Have nice day,
Best Regards
daniel