Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Managing Mesh with text commands

1 REPLY 1
Reply
Message 1 of 2
maximilien.werderer
156 Views, 1 Reply

Managing Mesh with text commands

Hello everyone,

From what i've read on this forum, the F360 API has no objects for the functionality in the "mesh" menu. I need to handle a large of meshes at a time so I need automation. I managed to make a script to repair multiple meshes using text commands thanks to this post . Now I would like to use other text commands to do other function such as "Mesh to Brep" or "separate". I understand there is no official documentation on such text commands. @kandennti explained how to use the commands in this post : and also provided command to generate the list of all commands and hosts a list of commands here. The thing is, in this list of command i cannot find the one to manipulate meshes, even the one provided in the first post "ParaMeshRepairCommand". So does anyone know where to finds the commands to manipulate meshes ? thanks !

  

Labels (1)
1 REPLY 1
Message 2 of 2

Hi @maximilien.werderer .

 

We made a simple sample.

# Fusion360API Python script

import traceback
import adsk.core as core
import adsk.fusion as fusion

def run(context):
    ui = core.UserInterface.cast(None)
    try:
        app: core.Application = core.Application.get()
        ui = app.userInterface
        des: fusion.Design = app.activeProduct
        root: fusion.Component = des.rootComponent

        meshBody: fusion.MeshBody = root.meshBodies[0]

        sels: core.Selections = ui.activeSelections
        sels.clear()
        sels.add(meshBody)

        cmds = [
            u'Commands.Start ParaMeshRepairCommand', 
            u'Commands.SetString infoRepairType infoTypeSimple',
            u'NuCommands.CommitCmd'
        ]

        [app.executeTextCommand(cmd) for cmd in cmds]

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


It executes commands by command ID.
For more information, please see this link.

https://github.com/kantoku-code/Fusion360_Small_Tools_for_Developers/tree/master/TextCommands 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report