Hi, everyone
I want use merge to join same faces in the same body.
But i can not find the api to do it.
Who konw the merge api like the picture.
Thank you for your help.
Solved! Go to Solution.
Hi, everyone
I want use merge to join same faces in the same body.
But i can not find the api to do it.
Who konw the merge api like the picture.
Thank you for your help.
Solved! Go to Solution.
Solved by kandennti. Go to Solution.
Hi @ho-kou -San.
Since merge commands do not seem to be provided by the API, this sample uses text commands.
# Fusion360API Python script
import traceback
import adsk.core as core
import adsk.fusion as fusion
def run(context):
ui: core.UserInterface = None
try:
app: core.Application = core.Application.get()
ui = app.userInterface
des: fusion.Design = app.activeProduct
if des.designType == fusion.DesignTypes.ParametricDesignType:
ui.messageBox("Valid only in direct mode.")
return
root: fusion.Component = des.rootComponent
exec_surface_merge_command(root.bRepBodies[0])
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
def exec_surface_merge_command(
body: fusion.BRepBody
) -> None:
app: core.Application = core.Application.get()
ui: core.UserInterface = app.userInterface
sels: core.Selections = ui.activeSelections
[sels.add(f) for f in body.faces]
app.executeTextCommand(u"Commands.Start FusionSurfaceMergeCommand")
app.executeTextCommand(u'NuCommands.CommitCmd')
In the GUI, the merge command is only available in direct mode, but when I tried it, it worked in parametric mode as well.
However, since nothing appears on the timeline, we felt that this might cause problems, so the sample works only in direct mode.
Hi @ho-kou -San.
Since merge commands do not seem to be provided by the API, this sample uses text commands.
# Fusion360API Python script
import traceback
import adsk.core as core
import adsk.fusion as fusion
def run(context):
ui: core.UserInterface = None
try:
app: core.Application = core.Application.get()
ui = app.userInterface
des: fusion.Design = app.activeProduct
if des.designType == fusion.DesignTypes.ParametricDesignType:
ui.messageBox("Valid only in direct mode.")
return
root: fusion.Component = des.rootComponent
exec_surface_merge_command(root.bRepBodies[0])
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
def exec_surface_merge_command(
body: fusion.BRepBody
) -> None:
app: core.Application = core.Application.get()
ui: core.UserInterface = app.userInterface
sels: core.Selections = ui.activeSelections
[sels.add(f) for f in body.faces]
app.executeTextCommand(u"Commands.Start FusionSurfaceMergeCommand")
app.executeTextCommand(u'NuCommands.CommitCmd')
In the GUI, the merge command is only available in direct mode, but when I tried it, it worked in parametric mode as well.
However, since nothing appears on the timeline, we felt that this might cause problems, so the sample works only in direct mode.
Can't find what you're looking for? Ask the community or share your knowledge.