Jump to content

Mesh Export Python Error


---
 Share

Recommended Posts

Hello,

I keep getting this error when trying to export a file. In this case a mesh. 

image.png.6dcd44676b8cbff62b05cbdf460f549f.png

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

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

 Share

×
×
  • Create New...