Download

[Python] A way to import CAD files?

First, Loving the python scripting.

However I’m trying to get some stp and/or .asm/.prt files in to my scene automatically, it seems that [FONT=courier new]construct_datasmith_scene_from_file(…) only takes udatasmith exports from the plugin. Is there a way I can either:

  1. Generate a udatasmith xml for my target file types or
  2. Import those file types natively through the python tools

Thanks.

Nevermind, I found what I was looking for:

[FONT=courier new]DatasmithCADScene

| construct_datasmith_scene_from_file(…)
| X.construct_datasmith_scene_from_file(file_path, destination_folder) → DatasmithCADScene – Open a CAD format file from disk. The Datasmith scene is not yet created. Call ProcessScene to create the DatasmithScene.
| param: file_path (String) – UDatasmith file path to open. ie: c:/MyFolder/MyFiles.udatasmith
| param: destination_folder (String) – Destination of where you want the asset to be imported. ie: /Game/MyFolder1
| param: return_value (DatasmithCADScene)
| return: An empty DatasmithScene, that can be modified and can be imported.