/// <summary>
    /// Export a robot from Inventor
    /// </summary>
    public void LoadFromInventor()
    {
        if (SkeletonBase != null && !WarnUnsaved())
        {
            return;
        }

        try
        {
            var exporterThread = new Thread(() =>
            {
                exporter = new ExporterForm(ExporterSettings);

                exporter.ShowDialog();
            });

            exporterThread.SetApartmentState(ApartmentState.STA);
            exporterThread.Start();

            exporterThread.Join();

            GC.Collect();
        }
        catch (System.Runtime.InteropServices.InvalidComObjectException)
        {
        }
        catch (Exception e)
        {
            MessageBox.Show(e.Message);
            return;
        }

        ReloadPanels();
    }
Exemple #2
0
    /// <summary>
    /// Export a robot from Inventor
    /// </summary>
    public bool ExportMeshes(bool warnUnsaved = false)
    {
        if (SkeletonBase != null && warnUnsaved && !WarnUnsaved())
        {
            return(false);
        }

        try
        {
            var exporterThread = new Thread(() =>
            {
#if LITEMODE
                liteExporter = new LiteExporterForm();
                liteExporter.ShowDialog();
#else
                exporter = new ExporterForm(PluginSettings);
                exporter.ShowDialog();
#endif
            });

            exporterThread.SetApartmentState(ApartmentState.STA);
            exporterThread.Start();

            exporterThread.Join();

            GC.Collect();
        }
        catch (InvalidComObjectException)
        {
        }
        catch (TaskCanceledException)
        {
            return(true);
        }
        catch (Exception e)
        {
            MessageBox.Show(e.Message);
            return(false);
        }

        List <RigidNode_Base> nodes = SkeletonBase.ListAllNodes();

        for (int i = 0; i < Meshes.Count; i++)
        {
            ((OGL_RigidNode)nodes[i]).loadMeshes(Meshes[i]);
        }
        RobotSaveAs(NameRobotForm.NameMode.Initial);

        ReloadPanels();
        return(true);
    }