<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic RuntimeError: 2 : InternalValidationError : results in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/runtimeerror-2-internalvalidationerror-results/m-p/11967838#M3614</link>
    <description>&lt;P&gt;I currently write an &lt;STRONG&gt;add-in&lt;/STRONG&gt; to import models into design but I can only import one model at a time.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NuofanQiu_0-1684250458125.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1215175i54C85BB67A203F95/image-size/medium?v=v2&amp;amp;px=400" role="button" title="NuofanQiu_0-1684250458125.png" alt="NuofanQiu_0-1684250458125.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NuofanQiu_1-1684250471934.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1215176iE67EC72F4BF16641/image-size/medium?v=v2&amp;amp;px=400" role="button" title="NuofanQiu_1-1684250471934.png" alt="NuofanQiu_1-1684250471934.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Import only one manipulator or one gripper works. But import manipulator and gripper at the same time, something went wrong:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Traceback (most recent call last):
  File "C:\Users/Aspartame/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/AddIns/ImportRobot\lib\fusion360utils\event_utils.py", line 84, in notify
    callback(args)
  File "C:\Users/Aspartame/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/AddIns/ImportRobot\commands\importRobot\entry.py", line 138, in command_execute
    import_robot.importManipulator(gripper.name)
  File "C:\Users/Aspartame/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/AddIns/ImportRobot\commands\importRobot\import_robot.py", line 40, in importManipulator
    importManager.importToTarget(f3dOptions, rootComp)
  File "C:\Users/Aspartame/AppData/Local/Autodesk/webdeploy/production/b4885f4229f39fee5ad2bce82f309e671e5c9ccd/Api/Python/packages\adsk\core.py", line 10892, in importToTarget
    return _core.ImportManager_importToTarget(self, importOptions, target)
RuntimeError: 2 : InternalValidationError : results&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;But I test it using a script works well, here is the `test.py`:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;import adsk, adsk.core, adsk.fusion
import os, sys
import pathlib
import time

def importManipulator(name: str):
    """
    name: name of manipulator
    """
    app = adsk.core.Application.get()
    ui = app.userInterface
    product = app.activeProduct
    design = adsk.fusion.Design.cast(product)
    rootComp = design.rootComponent
    importManager = app.importManager
    viewPort = app.activeViewport
    currentCamera = viewPort.camera

    # change the view to make z-axis with a up direction
    camera_up_vector = adsk.core.Vector3D.create(0.0, 0.0, 1.0)
    currentCamera.upVector = camera_up_vector
    viewPort.camera = currentCamera
    _ = viewPort.refresh()

    current_dir = os.path.dirname(os.path.abspath(__file__))
    if name == "None":
        return # do nothing
    if name == "UR5e":
        model_file = current_dir + "/robot_models/UR5e.f3d"
        f3dOptions = importManager.createFusionArchiveImportOptions(model_file)
        f3dOptions.isViewFit = True
        importManager.importToTarget(f3dOptions, rootComp)
    if name == "Robotiq85 Gripper":
        model_file = current_dir + "/robot_models/Robotiq_2F85_Gripper.f3d"
        f3dOptions = importManager.createFusionArchiveImportOptions(model_file)
        f3dOptions.isViewFit = True
        importManager.importToTarget(f3dOptions, rootComp)

importManipulator("UR5e")
importManipulator("Robotiq85 Gripper")&lt;/LI-CODE&gt;&lt;P&gt;But I don't know what is wrong with the add-in code. I iput it at GoogleDrive hoping you can help with me. By now, I only have two `f3d` file so you can just pick `UR5e` model and `Robotiq85 Gripper` as the selection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My add-in file at GoogleDrive:&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/1ad8LfsAsPdy1XbhzdLIrc0DNmNjpY16D/view?usp=sharing" target="_blank" rel="noopener"&gt;Add-in at GoogleDrive&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
    <pubDate>Tue, 16 May 2023 15:33:14 GMT</pubDate>
    <dc:creator>NuofanQiu</dc:creator>
    <dc:date>2023-05-16T15:33:14Z</dc:date>
    <item>
      <title>RuntimeError: 2 : InternalValidationError : results</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/runtimeerror-2-internalvalidationerror-results/m-p/11967838#M3614</link>
      <description>&lt;P&gt;I currently write an &lt;STRONG&gt;add-in&lt;/STRONG&gt; to import models into design but I can only import one model at a time.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NuofanQiu_0-1684250458125.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1215175i54C85BB67A203F95/image-size/medium?v=v2&amp;amp;px=400" role="button" title="NuofanQiu_0-1684250458125.png" alt="NuofanQiu_0-1684250458125.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NuofanQiu_1-1684250471934.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1215176iE67EC72F4BF16641/image-size/medium?v=v2&amp;amp;px=400" role="button" title="NuofanQiu_1-1684250471934.png" alt="NuofanQiu_1-1684250471934.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Import only one manipulator or one gripper works. But import manipulator and gripper at the same time, something went wrong:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Traceback (most recent call last):
  File "C:\Users/Aspartame/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/AddIns/ImportRobot\lib\fusion360utils\event_utils.py", line 84, in notify
    callback(args)
  File "C:\Users/Aspartame/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/AddIns/ImportRobot\commands\importRobot\entry.py", line 138, in command_execute
    import_robot.importManipulator(gripper.name)
  File "C:\Users/Aspartame/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/AddIns/ImportRobot\commands\importRobot\import_robot.py", line 40, in importManipulator
    importManager.importToTarget(f3dOptions, rootComp)
  File "C:\Users/Aspartame/AppData/Local/Autodesk/webdeploy/production/b4885f4229f39fee5ad2bce82f309e671e5c9ccd/Api/Python/packages\adsk\core.py", line 10892, in importToTarget
    return _core.ImportManager_importToTarget(self, importOptions, target)
RuntimeError: 2 : InternalValidationError : results&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;But I test it using a script works well, here is the `test.py`:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;import adsk, adsk.core, adsk.fusion
import os, sys
import pathlib
import time

def importManipulator(name: str):
    """
    name: name of manipulator
    """
    app = adsk.core.Application.get()
    ui = app.userInterface
    product = app.activeProduct
    design = adsk.fusion.Design.cast(product)
    rootComp = design.rootComponent
    importManager = app.importManager
    viewPort = app.activeViewport
    currentCamera = viewPort.camera

    # change the view to make z-axis with a up direction
    camera_up_vector = adsk.core.Vector3D.create(0.0, 0.0, 1.0)
    currentCamera.upVector = camera_up_vector
    viewPort.camera = currentCamera
    _ = viewPort.refresh()

    current_dir = os.path.dirname(os.path.abspath(__file__))
    if name == "None":
        return # do nothing
    if name == "UR5e":
        model_file = current_dir + "/robot_models/UR5e.f3d"
        f3dOptions = importManager.createFusionArchiveImportOptions(model_file)
        f3dOptions.isViewFit = True
        importManager.importToTarget(f3dOptions, rootComp)
    if name == "Robotiq85 Gripper":
        model_file = current_dir + "/robot_models/Robotiq_2F85_Gripper.f3d"
        f3dOptions = importManager.createFusionArchiveImportOptions(model_file)
        f3dOptions.isViewFit = True
        importManager.importToTarget(f3dOptions, rootComp)

importManipulator("UR5e")
importManipulator("Robotiq85 Gripper")&lt;/LI-CODE&gt;&lt;P&gt;But I don't know what is wrong with the add-in code. I iput it at GoogleDrive hoping you can help with me. By now, I only have two `f3d` file so you can just pick `UR5e` model and `Robotiq85 Gripper` as the selection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My add-in file at GoogleDrive:&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/1ad8LfsAsPdy1XbhzdLIrc0DNmNjpY16D/view?usp=sharing" target="_blank" rel="noopener"&gt;Add-in at GoogleDrive&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2023 15:33:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/runtimeerror-2-internalvalidationerror-results/m-p/11967838#M3614</guid>
      <dc:creator>NuofanQiu</dc:creator>
      <dc:date>2023-05-16T15:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: RuntimeError: 2 : InternalValidationError : results</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/runtimeerror-2-internalvalidationerror-results/m-p/11969040#M3615</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13720789"&gt;@NuofanQiu&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I made a script and tried it. The f3d files used are the same.&lt;BR /&gt;This one simply imports two f3d files.&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# Fusion360API Python script

import traceback
import adsk.core as core
import adsk.fusion as fusion

import pathlib
THIS_DIR = pathlib.Path(__file__).resolve().parent

def run(context):
    ui: core.UserInterface = None
    try:
        app: core.Application = core.Application.get()
        ui = app.userInterface

        paths = [
            str(THIS_DIR / 'robot_models' / 'Robotiq_2F85_Gripper.f3d'),
            str(THIS_DIR / 'robot_models' / 'UR5e.f3d'),
        ]

        import_f3ds(paths)

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


def import_f3ds(paths: list[str]) -&amp;gt; None:
    app: core.Application = core.Application.get()
    try:
        des: fusion.Design = app.activeProduct
        root: fusion.Component = des.rootComponent

        importMgr: core.ImportManager = app.importManager

        for path in paths:
            importOpt: core.FusionArchiveImportOptions = importMgr.createFusionArchiveImportOptions(
                path,
            )
            importMgr.importToTarget(importOpt , root)
    except:
        app.log('Failed:\n{}'.format(traceback.format_exc()))&lt;/LI-CODE&gt;
&lt;P&gt;This one was handled correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The next script uses a dialog.&lt;BR /&gt;It is longer, but the import process itself is the same.&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# Fusion360API Python script

import traceback
import adsk
import adsk.core as core
import adsk.fusion as fusion

import pathlib
THIS_DIR = pathlib.Path(__file__).resolve().parent

_app: core.Application = None
_ui: core.UserInterface = None
_handlers = []

CMD_INFO = {
    'id': 'kantoku_test',
    'name': 'test',
    'tooltip': 'test'
}

class MyCommandCreatedHandler(core.CommandCreatedEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args: core.CommandCreatedEventArgs):
        core.Application.get().log(args.firingEvent.name)
        try:
            global _handlers
            cmd: core.Command = core.Command.cast(args.command)
            inputs: core.CommandInputs = cmd.commandInputs

            onDestroy = MyCommandDestroyHandler()
            cmd.destroy.add(onDestroy)
            _handlers.append(onDestroy)

            onExecute = MyExecuteHandler()
            cmd.execute.add(onExecute)
            _handlers.append(onExecute)

            txtIpt: core.TextBoxCommandInput = inputs.addTextBoxCommandInput(
                'txtIpt',
                'test',
                'Click OK',
                1,
                True
            )

        except:
            _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


class MyExecuteHandler(core.CommandEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args: core.CommandEventArgs):
        paths = [
            str(THIS_DIR / 'robot_models' / 'Robotiq_2F85_Gripper.f3d'),
            str(THIS_DIR / 'robot_models' / 'UR5e.f3d'),
        ]

        import_f3ds(paths)


class MyCommandDestroyHandler(core.CommandEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args: core.CommandEventArgs):
        adsk.terminate()


def run(context):
    try:
        global _app, _ui
        _app = core.Application.get()
        _ui = _app.userInterface

        cmdDef: core.CommandDefinition = _ui.commandDefinitions.itemById(
            CMD_INFO['id']
        )

        if not cmdDef:
            cmdDef = _ui.commandDefinitions.addButtonDefinition(
                CMD_INFO['id'],
                CMD_INFO['name'],
                CMD_INFO['tooltip']
            )

        global _handlers
        onCommandCreated = MyCommandCreatedHandler()
        cmdDef.commandCreated.add(onCommandCreated)
        _handlers.append(onCommandCreated)

        cmdDef.execute()

        adsk.autoTerminate(False)

    except:
        if _ui:
            _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


def import_f3ds(paths: list[str]) -&amp;gt; None:
    app: core.Application = core.Application.get()
    try:
        des: fusion.Design = app.activeProduct
        root: fusion.Component = des.rootComponent

        importMgr: core.ImportManager = app.importManager

        for path in paths:
            importOpt: core.FusionArchiveImportOptions = importMgr.createFusionArchiveImportOptions(
                path,
            )
            importMgr.importToTarget(importOpt , root)
    except:
        app.log('Failed:\n{}'.format(traceback.format_exc()))&lt;/LI-CODE&gt;
&lt;P&gt;This one can reproduce the situation because it is not possible to import.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The main difference is the use of CommandDefinition.&lt;BR /&gt;The first f3d is imported, but the second one fails and the imported one disappears.&lt;BR /&gt;Perhaps the transaction is causing the process to revert.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There was a crash bug with the importToTarget method in the past.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/fusion-360-api-and-scripts/addin-cause-the-crash-shutdown-of-fusion-after-last-update-18-1/m-p/10890738" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/fusion-360-api-and-scripts/addin-cause-the-crash-shutdown-of-fusion-after-last-update-18-1/m-p/10890738&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It was fixed in a relatively short time, but I think it is probably incomplete.&lt;BR /&gt;Also, using the importToTarget2 method causes the same problem.&lt;BR /&gt;I feel it is a bug.&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 03:31:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/runtimeerror-2-internalvalidationerror-results/m-p/11969040#M3615</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2023-05-17T03:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: RuntimeError: 2 : InternalValidationError : results</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/runtimeerror-2-internalvalidationerror-results/m-p/11969128#M3616</link>
      <description>&lt;P&gt;Yes, I have the same result as you mentioned:"The first f3d is imported, but the second one fails and the imported one disappears.".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for you reply. I will try to avoid it.&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 04:39:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/runtimeerror-2-internalvalidationerror-results/m-p/11969128#M3616</guid>
      <dc:creator>NuofanQiu</dc:creator>
      <dc:date>2023-05-17T04:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: RuntimeError: 2 : InternalValidationError : results</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/runtimeerror-2-internalvalidationerror-results/m-p/13068161#M3617</link>
      <description>&lt;P&gt;I just had the same problem. I see it hasn't been fixed yet because I'm also trying to load the f3d file for the second time and I can't because I get this error: "RuntimeError: 2 : InternalValidationError : pBase"&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 00:44:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/runtimeerror-2-internalvalidationerror-results/m-p/13068161#M3617</guid>
      <dc:creator>espablo</dc:creator>
      <dc:date>2024-10-07T00:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: RuntimeError: 2 : InternalValidationError : results</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/runtimeerror-2-internalvalidationerror-results/m-p/13068202#M3618</link>
      <description>&lt;P&gt;I recently learned about an undocumented limitation when opening and importing files. Internally, the API calls a command to do this, which causes problems when you're running within a command, which you are in this case. That's why it works as a script because you're not in a command. I'm not sure how to work around this limitation. I think it might be possible, but it would take some experimenting to see what will work.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 01:36:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/runtimeerror-2-internalvalidationerror-results/m-p/13068202#M3618</guid>
      <dc:creator>BrianEkins</dc:creator>
      <dc:date>2024-10-07T01:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: RuntimeError: 2 : InternalValidationError : results</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/runtimeerror-2-internalvalidationerror-results/m-p/13375528#M3619</link>
      <description>&lt;P&gt;Have you managed to solve this problem?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 15:52:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/runtimeerror-2-internalvalidationerror-results/m-p/13375528#M3619</guid>
      <dc:creator>espablo</dc:creator>
      <dc:date>2025-03-17T15:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: RuntimeError: 2 : InternalValidationError : results</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/runtimeerror-2-internalvalidationerror-results/m-p/13940450#M22435</link>
      <description>&lt;P&gt;Just commenting to see if there have been any improvements on this problem. I am currently in a situation where I need to import multiple step files and can't seem to find a simple workaround for this issue.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Dec 2025 23:01:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/runtimeerror-2-internalvalidationerror-results/m-p/13940450#M22435</guid>
      <dc:creator>tjbatche</dc:creator>
      <dc:date>2025-12-10T23:01:03Z</dc:date>
    </item>
    <item>
      <title>Re: RuntimeError: 2 : InternalValidationError : results</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/runtimeerror-2-internalvalidationerror-results/m-p/13940544#M22436</link>
      <description>&lt;P&gt;I believe that this situation can be solved with a custom event or with a second process thread, which emit a message to import each file.&lt;/P&gt;&lt;P&gt;This way the execute event handler from the AddIn runs to collect user input and prepare the messages to be sent to the custom event handler.&lt;/P&gt;&lt;P&gt;Then in the custom event handler (not in parallel with the execute handler) it can import each file or make any operation on its own working space.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd made it in the past with some implementations without any problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Jorge Jaramillo&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Dec 2025 01:14:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/runtimeerror-2-internalvalidationerror-results/m-p/13940544#M22436</guid>
      <dc:creator>Jorge_Jaramillo</dc:creator>
      <dc:date>2025-12-11T01:14:49Z</dc:date>
    </item>
  </channel>
</rss>

