Jump to content

Auto refresh report


Recommended Posts

Excuse me, is there a PY program that can automatically import the stl data of a certain folder into the project template, and automatically output the report to the specified folder according to the name of the stl.
  For example, I have 20 parts that need to be updated, I already have project templates, and I want to automatically generate these 20 reports into a folder.
Thanks for the support!

Link to comment
Share on other sites

For this type of situation, I typically use the scripting tool in combination with an already loaded program. Here is the basic format I use:

# -*- coding: utf-8 -*-

import gom
import os

# Manually specify the location of the folder containing all orientations

FolderLocation = 'C:/Users... '

# Collect all file names in the specified folder

files = os.listdir(FolderLocation)

# Run through each file and perform whatever actions you need to with each one

for file in files:


	# Record the import and export steps in this section of code


Link to comment
Share on other sites

What adam describes is a good basis to think about.  I think as i put on a similar post, it would be difficult to create an out the box solution that fits every possible need . i would take the concept Adam describes as a framework for creating what you need.


To get the command for open template record the action in the editor. The potential complexity is a consideration of what template?  I.e is it a fixed template name? Is there logic of template name to know which one to open?

The directory listing function referenced also lists sub directories if there are any..

There are python string tools like ' split' that assist when getting names .   I.e when you look at the filename it contains the complete path in the string.   On import could get the name of the mesh ( in script editor F2 is your friend to see what you can access in gom)

Python can create directories including checking whether they exist first , this can help write generic statements for output

Could consider saving the recalculated project also , perhaps in presentation mode.

Python can get the pc time and date and has functions to convert to a text string , you could consider if this is needed in your output.

I hope some of these thoughts are helpful in some way.  My view on coding is that the first step is to look through logically what you want to do and identify the ' what if'.  Decide which what ifs are complex or nice to have and take it step by step in building up the complexity.


Link to comment
Share on other sites

This is a simple solution for import all .g3d in a folder.

# -*- coding: utf-8 -*-

import gom

dir = "C:/Users/...."
for filename in os.listdir(dir):
	print (filenamepath)
print (lst)

gom.script.sys.import_g3d (


Link to comment
Share on other sites


  • Create New...