こちらの続きです。
メッシュの六角形分割に挑む8 - C#ATIA
何時まで続くのか・・・。
新たな作成に欠かせない、メッシュの結合です。
以前の結合は、結合でしたが今度は交差です。
# Fusion360API Python script import traceback import adsk.fusion import adsk.core def run(context): ui = adsk.core.UserInterface.cast(None) try: app: adsk.core.Application = adsk.core.Application.get() ui = app.userInterface root: adsk.fusion.Component = app.activeProduct.rootComponent execMeshCombine_Intersect( root.meshBodies[1], [root.meshBodies[0]] ) except: if ui: ui.messageBox('Failed:\n{}'.format(traceback.format_exc())) def execMeshCombine_Intersect( target: adsk.fusion.MeshBody, tools: list): app: adsk.core.Application = adsk.core.Application.get() ui: adsk.core.UserInterface = app.userInterface sels: adsk.core.Selections = ui.activeSelections sels.clear() app.executeTextCommand(u'Commands.Start ParaMeshCombineCommand') app.executeTextCommand(u'UI.EnableCommandInput infoTargetBody') sels.add(target) for tool in tools: app.executeTextCommand(u'UI.EnableCommandInput infoToolBody') sels.add(tool) cmds = [ u'Commands.SetString infoType infoTypeIntersect', u'Commands.SetBool newComponent 0', u'Commands.SetBool infoKeepToolBodies 1', u'Commands.SetBool infoPreview 0', u'NuCommands.CommitCmd' ] [app.executeTextCommand(cmd) for cmd in cmds]
オプションにしても良かったのですが、ツール側は残る設定になってます。
処理を行いたい六角柱側をターゲットにし、目的のメッシュを
ツール側にしてます。
これで実行するとこんな感じ。
処理は間違いなく出来るのですが、処理時間が長い。
ひょっとしたら何十個も処理する必要が出て来そうなので
恐ろしい事になりそう。
Meshmixerにもマクロがあるようなのですが、ドキュメントが
無い状態の様です。それは無理だな。