Fusion360のスクリプトを新作した際、雛形のコードがありますが、
恐らくあれは、インストールフォルダ内の何処かにあるものをコピペ
されるのだろうと思い、以前探したことがあります。(Win10)
C:\Users\<UserName>\AppData\Local\Autodesk\webdeploy\production\<バージョン毎のフォルダ>\Python\Default¥default.py
のファイルになります。
毎回ちょっとしたスクリプトを作成したい時に面倒な為、
雛形自体をこんな感じに変更しました。
#Author- #Description- #Fusion360API Python script import sys sys.path.append("C:/Users/xxx/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/Python/defs") import adsk.core, adsk.fusion, adsk.cam, traceback def run(context): ui = None try: app :adsk.core.Application = adsk.core.Application.get() ui :adsk.core.UserInterface = app.userInterface des :adsk.fusion.Design = app.activeProduct root :adsk.fusion.Component = des.rootComponent msg :str = 'Select' selFiltter :str = 'Bodies' sel :adsk.core.Selection = selectEnt(ui, msg ,selFiltter) if not sel: return ui.messageBox('Done') except: if ui: ui.messageBox('Failed:\n{}'.format(traceback.format_exc())) def selectEnt( ui :adsk.core.UserInterface, msg :str, filtterStr :str) -> adsk.core.Selection : try: sel = ui.selectEntity(msg, filtterStr) return sel except: return None
最初のコメント部分は書き換えられるようです。
後は、処理したい内容を作れば良いだけになります。大体ですが。
実は、ちょっと前の再インストール時にバックアップを忘れ
全て元の状態に・・・。
ファイルの位置からしてもUpdate時に消えてしまう可能性もあるかも。
その為の覚書。