示例#1
0
        private static IntPtr[] CreateChildDialog()
        {
            try
            {
                GUI = new SynthesisGUI(StandardAddInServer.Instance.MainApplication)// pass the main application to the GUI so classes RobotExporter can access Inventor to read the joints
                {
                    Opacity = 0.00d
                };
                GUI.Show();
                GUI.Hide();
                GUI.Opacity = 1.00d;

                return(new IntPtr[] { GUI.JointPaneForm.Handle });
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                throw;
            }
        }
示例#2
0
        private static IntPtr[] CreateChildDialog()
        {
            try
            {
                GUI = new SynthesisGUI()
                {
                    Opacity = 0.00d
                };
                GUI.Show();
                GUI.Hide();
                GUI.Opacity = 1.00d;

                return(new IntPtr[] { GUI.JointPaneForm.Handle, GUI.BXDAViewerPaneForm.Handle });
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                throw;
            }
        }
示例#3
0
    public SynthesisGUI(bool MakeOwners = false)
    {
        InitializeComponent();

        Instance = this;

        bxdaEditorPane1.Units = "lbs";
        BXDAViewerPaneForm.Controls.Add(bxdaEditorPane1);
        if (MakeOwners)
        {
            BXDAViewerPaneForm.Owner = this;
        }
        BXDAViewerPaneForm.FormClosing += Generic_FormClosing;

        JointPaneForm.Controls.Add(jointEditorPane1);
        if (MakeOwners)
        {
            JointPaneForm.Owner = this;
        }
        JointPaneForm.FormClosing += Generic_FormClosing;


        RigidNode_Base.NODE_FACTORY = delegate(Guid guid)
        {
            return(new OGL_RigidNode(guid));
        };

        settingsExporter.Click += SettingsExporter_OnClick;

        Shown += SynthesisGUI_Shown;

        FormClosing += new FormClosingEventHandler(delegate(object sender, FormClosingEventArgs e)
        {
            if (SkeletonBase != null && !WarnUnsaved())
            {
                e.Cancel = true;
            }
            InventorManager.ReleaseInventor();
        });

        jointEditorPane1.ModifiedJoint += delegate(List <RigidNode_Base> nodes)
        {
            if (nodes == null || nodes.Count == 0)
            {
                return;
            }

            foreach (RigidNode_Base node in nodes)
            {
                if (node.GetSkeletalJoint() != null && node.GetSkeletalJoint().cDriver != null &&
                    node.GetSkeletalJoint().cDriver.GetInfo <WheelDriverMeta>() != null &&
                    node.GetSkeletalJoint().cDriver.GetInfo <WheelDriverMeta>().radius == 0 &&
                    node is OGL_RigidNode)
                {
                    (node as OGL_RigidNode).GetWheelInfo(out float radius, out float width, out BXDVector3 center);

                    WheelDriverMeta wheelDriver = node.GetSkeletalJoint().cDriver.GetInfo <WheelDriverMeta>();
                    wheelDriver.center = center;
                    wheelDriver.radius = radius;
                    wheelDriver.width  = width;
                    node.GetSkeletalJoint().cDriver.AddInfo(wheelDriver);
                }
            }
        };

        jointEditorPane1.SelectedJoint += bxdaEditorPane1.SelectJoints;

        bxdaEditorPane1.NodeSelected += (BXDAMesh mesh) =>
        {
            List <RigidNode_Base> nodes = new List <RigidNode_Base>();
            SkeletonBase.ListAllNodes(nodes);

            jointEditorPane1.AddSelection(nodes[Meshes.IndexOf(mesh)], true);
        };
    }
示例#4
0
    public static void Main(String[] args)
    {
        SynthesisGUI GUI = new SynthesisGUI();

        GUI.ShowDialog();
    }
    public SynthesisGUI()
    {
        InitializeComponent();

        Instance = this;

        robotViewer1.LoadSettings(ViewerSettings);
        bxdaEditorPane1.Units = ViewerSettings.modelUnits;

        RigidNode_Base.NODE_FACTORY = delegate(Guid guid)
        {
            return(new OGL_RigidNode(guid));
        };

        fileNew.Click += new System.EventHandler(delegate(object sender, System.EventArgs e)
        {
            SetNew();
        });
        fileLoad.Click += new System.EventHandler(delegate(object sender, System.EventArgs e)
        {
            LoadFromInventor();
        });
        fileOpen.Click += new System.EventHandler(delegate(object sender, System.EventArgs e)
        {
            OpenExisting();
        });
        fileSave.Click += new System.EventHandler(delegate(object sender, System.EventArgs e)
        {
            SaveRobot(false);
        });
        fileSaveAs.Click += new System.EventHandler(delegate(object sender, System.EventArgs e)
        {
            SaveRobot(true);
        });
        fileExit.Click += new System.EventHandler(delegate(object sender, System.EventArgs e)
        {
            Close();
        });

        settingsExporter.Click += new System.EventHandler(delegate(object sender, System.EventArgs e)
        {
            var defaultValues = BXDSettings.Instance.GetSettingsObject("Exporter Settings");

            ExporterSettingsForm eSettingsForm = new ExporterSettingsForm((defaultValues != null) ? (ExporterSettingsForm.ExporterSettingsValues)defaultValues :
                                                                          ExporterSettingsForm.GetDefaultSettings());

            eSettingsForm.ShowDialog(this);

            BXDSettings.Instance.AddSettingsObject("Exporter Settings", eSettingsForm.values);
            ExporterSettings = eSettingsForm.values;
        });
        settingsViewer.Click += new System.EventHandler(delegate(object sender, System.EventArgs e)
        {
            var defaultValues = BXDSettings.Instance.GetSettingsObject("Viewer Settings");

            ViewerSettingsForm vSettingsForm = new ViewerSettingsForm((defaultValues != null) ? (ViewerSettingsForm.ViewerSettingsValues)defaultValues :
                                                                      ViewerSettingsForm.GetDefaultSettings());

            vSettingsForm.ShowDialog(this);

            BXDSettings.Instance.AddSettingsObject("Viewer Settings", vSettingsForm.values);
            ViewerSettings = vSettingsForm.values;

            robotViewer1.LoadSettings(ViewerSettings);
            bxdaEditorPane1.Units = ViewerSettings.modelUnits;
        });

        helpAbout.Click += new System.EventHandler(delegate(object sender, System.EventArgs e)
        {
            AboutDialog about = new AboutDialog();
            about.ShowDialog(this);
        });

        this.FormClosing += new FormClosingEventHandler(delegate(object sender, FormClosingEventArgs e)
        {
            if (SkeletonBase != null && !WarnUnsaved())
            {
                e.Cancel = true;
            }
            else
            {
                BXDSettings.Save();
            }

            InventorManager.ReleaseInventor();
        });

        jointEditorPane1.ModifiedJoint += delegate(List <RigidNode_Base> nodes)
        {
            if (nodes == null || nodes.Count == 0)
            {
                return;
            }

            foreach (RigidNode_Base node in nodes)
            {
                if (node.GetSkeletalJoint() != null && node.GetSkeletalJoint().cDriver != null &&
                    node.GetSkeletalJoint().cDriver.GetInfo <WheelDriverMeta>() != null &&
                    node.GetSkeletalJoint().cDriver.GetInfo <WheelDriverMeta>().radius == 0 &&
                    node is OGL_RigidNode)
                {
                    float      radius, width;
                    BXDVector3 center;

                    (node as OGL_RigidNode).GetWheelInfo(out radius, out width, out center);

                    WheelDriverMeta wheelDriver = node.GetSkeletalJoint().cDriver.GetInfo <WheelDriverMeta>();
                    wheelDriver.center = center;
                    wheelDriver.radius = radius;
                    wheelDriver.width  = width;
                    node.GetSkeletalJoint().cDriver.AddInfo(wheelDriver);
                }
            }
        };


        jointEditorPane1.SelectedJoint += robotViewer1.SelectJoints;
        jointEditorPane1.SelectedJoint += bxdaEditorPane1.SelectJoints;

        robotViewer1.NodeSelected += jointEditorPane1.AddSelection;
        robotViewer1.NodeSelected += bxdaEditorPane1.AddSelection;

        bxdaEditorPane1.NodeSelected += (BXDAMesh mesh) =>
        {
            List <RigidNode_Base> nodes = new List <RigidNode_Base>();
            SkeletonBase.ListAllNodes(nodes);

            jointEditorPane1.AddSelection(nodes[Meshes.IndexOf(mesh)], true);
        };

        bxdaEditorPane1.NodeSelected += (BXDAMesh mesh) =>
        {
            List <RigidNode_Base> nodes = new List <RigidNode_Base>();
            SkeletonBase.ListAllNodes(nodes);

            robotViewer1.SelectJoints(nodes.GetRange(Meshes.IndexOf(mesh), 1));
        };
    }