[Kr...] Posted February 8, 2023 Share Posted February 8, 2023 Hello, I keep getting this error when trying to export a file. In this case a mesh. Below is the script. gom.script.sys.export_stl ( bgr_coding=False, binary=True, color=False, elements=gom.ElementSelection ({'category': ['key', 'elements', 'part', gom.app.project.parts['Part'], 'explorer_category', 'actual_part']}), export_in_one_file=True, export_stages_mode='current', file=gom.app.project.name + 'Example', length_unit='default', set_stl_color_bit=False) I'm trying to get the mesh to export to the same folder location as the currently opening project. This works in some projects but not others. Any input is greatly appreciated as always. Many thanks Kris Link to comment Share on other sites More sharing options...
[Lo...] Posted February 8, 2023 Share Posted February 8, 2023 (edited) Hi, using gom.app.project.name will only give you the projects file name. It comes without any path information. Try using gom.app.project.project_file instead and create your export file name from there. Best, Lorenz Edited February 8, 2023 Link to comment Share on other sites More sharing options...
[Lo...] Posted February 8, 2023 Share Posted February 8, 2023 (edited) Try this as an export file name, for example: gom.app.project.project_file[0:gom.app.project.project_file.rfind(gom.app.project.project_name)] + gom.app.project.project_name + '.stl' Edited February 8, 2023 Link to comment Share on other sites More sharing options...
[Ja...] Posted February 9, 2023 Share Posted February 9, 2023 other guess /observation would be if the file name you end up with is too long for Windows. Link to comment Share on other sites More sharing options...
[Kr...] Posted February 13, 2023 Author Share Posted February 13, 2023 Good Morning Gents, I will give the following a try and see if it works. Please sign in to view this quote. I did however find a work around by adapting another script I found on this forum. It required importing of path lib and some project keyword set up. Probably a bit long winded compared to the above but it seems to work. I've attached a link below for future reference or in case anyone else is interesting. Many Thanks Again Kristian Wain Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in