Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| projekte:autodesk_fusion [2020/02/07 19:33] – angelegt admin | projekte:autodesk_fusion [2020/04/28 14:32] (aktuell) – [Open active product in Slic3r] admin | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| ====== Autodesk Fusion 360 ====== | ====== Autodesk Fusion 360 ====== | ||
| - | ===== Open active product | + | ===== Open all components |
| <code python> | <code python> | ||
| # | # | ||
| Zeile 9: | Zeile 9: | ||
| import os | import os | ||
| import subprocess | import subprocess | ||
| + | import threading | ||
| + | |||
| + | def startAndWait(cmd, | ||
| + | p = subprocess.Popen(cmd) | ||
| + | p.wait() | ||
| + | for f in filelist: | ||
| + | os.unlink(f) | ||
| + | |||
| def run(context): | def run(context): | ||
| Zeile 16: | Zeile 24: | ||
| app = adsk.core.Application.get() | app = adsk.core.Application.get() | ||
| ui = app.userInterface | ui = app.userInterface | ||
| - | # | ||
| f = tempfile.NamedTemporaryFile(delete=False) | f = tempfile.NamedTemporaryFile(delete=False) | ||
| f.close() | f.close() | ||
| Zeile 25: | Zeile 32: | ||
| silcerCmd.append(f) | silcerCmd.append(f) | ||
| - | | + | |
| + | t.start() | ||
| except: | except: | ||
| Zeile 35: | Zeile 43: | ||
| ui = app.userInterface | ui = app.userInterface | ||
| rv = [] | rv = [] | ||
| - | | + | |
| - | product = app.activeProduct | + | product = app.activeProduct |
| - | design = adsk.fusion.Design.cast(product) | + | design = adsk.fusion.Design.cast(product) |
| - | exportMgr = design.exportManager | + | exportMgr = design.exportManager |
| - | + | ||
| - | i = 0 | + | i=0 |
| - | for comp in design.allComponents: | + | for comp in design.allComponents: |
| - | for body in comp.bRepBodies: | + | #for body in comp.bRepBodies: |
| - | fileName = " | + | fileName = " |
| - | # create stl exportOptions | + | # |
| - | stlExportOptions = exportMgr.createSTLExportOptions(body, fileName) | + | # |
| - | stlExportOptions.sendToPrintUtility = False | + | |
| - | stlExportOptions.meshRefinement = adsk.fusion.MeshRefinementSettings.MeshRefinementHigh | + | try: |
| + | | ||
| + | stlExportOptions = exportMgr.createSTLExportOptions(comp, fileName) | ||
| + | stlExportOptions.sendToPrintUtility = False | ||
| + | stlExportOptions.meshRefinement = adsk.fusion.MeshRefinementSettings.MeshRefinementHigh | ||
| + | exportMgr.execute(stlExportOptions) | ||
| + | rv.append(fileName) | ||
| + | i+=1 | ||
| + | except: | ||
| + | if ui: | ||
| + | ui.messageBox(' | ||
| | | ||
| - | exportMgr.execute(stlExportOptions) | ||
| - | i+=1 | ||
| - | rv.append(fileName) | ||
| - | except: | ||
| - | if ui: | ||
| - | ui.messageBox(' | ||
| return rv | return rv | ||
| </ | </ | ||