-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsave_file.py
More file actions
25 lines (22 loc) · 1.1 KB
/
save_file.py
File metadata and controls
25 lines (22 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
exec("""
import adsk.core, adsk.fusion, adsk.cam, traceback
def save_view_as_png(filename_prefix):
app = adsk.core.Application.get()
ui = app.userInterface
design = app.activeProduct
viewport = app.activeViewport
visual_styles = {
'shaded': adsk.core.VisualStyles.ShadedVisualStyle,
'shaded_with_hidden_edges': adsk.core.VisualStyles.ShadedWithHiddenEdgesVisualStyle,
'shaded_with_visible_edges': adsk.core.VisualStyles.ShadedWithVisibleEdgesOnlyVisualStyle,
'wireframe': adsk.core.VisualStyles.WireframeVisualStyle,
'wireframe_with_hidden_edges': adsk.core.VisualStyles.WireframeWithHiddenEdgesVisualStyle,
'wireframe_with_visible_edges': adsk.core.VisualStyles.WireframeWithVisibleEdgesOnlyVisualStyle
}
for style_name, visual_style in visual_styles.items():
viewport.visualStyle = visual_style
#app.executeTextCommand('ViewFit')
filepath = f'{filename_prefix}-{style_name}.png'
viewport.saveAsImageFile(filepath, 3200, 1359)
#save_view_as_png('/tmp/robot')
""")