void attachpointComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (!isExportedToMax)
     {
         return;
     }
     if (attachpointComboBox.SelectedItem != null && file != null && file.Mesh.Count > 0)
     {
         Maxscript.Command("selectDummy = getNodeByName \"{0}\"", ((BrgAttachpoint)attachpointComboBox.SelectedItem).GetMaxName());
         if (Maxscript.QueryBoolean("selectDummy != undefined"))
         {
             Maxscript.Command("select selectDummy");
         }
         else
         {
             DialogResult dlgR = MessageBox.Show("Could not find \"" + ((BrgAttachpoint)attachpointComboBox.SelectedItem).GetMaxName() + "\"! Would you like to delete it?", "ABE",
                                                 MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
             if (dlgR == DialogResult.Yes)
             {
                 file.Mesh[0].Attachpoint.Remove(((BrgAttachpoint)attachpointComboBox.SelectedItem).Index);
                 loadUIAttachpoint();
             }
         }
     }
 }
        private void exportToMaxToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (file == null)
            {
                return;
            }

            try
            {
                DialogResult dlgR = MessageBox.Show("Do you want to clear the scene?", "ABE", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3);
                if (dlgR == DialogResult.Yes)
                {
                    Maxscript.Command("resetMaxFile #noprompt");
                    //Maxscript.Command("if checkForSave() do resetMaxFile #noprompt");
                }
                else if (dlgR == DialogResult.Cancel)
                {
                    return;
                }

                file.ExportToMax();
                //debug();
                isExportedToMax = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to export model!" + Environment.NewLine + Environment.NewLine + ex.Message, "ABE", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }