private void btnModelActionMove_Click(object sender, EventArgs e)
        {
            if (this.btnModelActionMove.BackColor == this.defaultButtonBackgroundColor) //not selected state
            {
                var selectedModel = ObjectView.SelectedModel;
                if (selectedModel != null)
                {
                    //if (selectedModel.LinkedClones.Count > 1)
                    //{
                    //    MoveSelectedModelContainsLinkedClones?.Invoke(null, null);
                    //    ToolbarActionsManager.Update(Enums.MainFormToolStripActionType.btnSelectPressed, frmStudioMain.SceneControl, null);
                    //    SceneView.CurrentViewMode = SceneView.ViewMode.MoveTranslation;
                    //}
                    //else
                    //{
                    this.ResetBackgroundColors();
                    ToolbarActionsManager.Update(Enums.MainFormToolStripActionType.btnMovePressed, frmStudioMain.SceneControl, this.btnModelActionMove);
                    UpdateSelectedButtonBackground(this.btnModelActionMove);
                    // }
                }
            }
            else
            {
                DeselectButtons();

                ToolbarActionsManager.Update(Enums.MainFormToolStripActionType.btnSelectPressed, frmStudioMain.SceneControl, null);
            }
        }
        private void btnModelActionSupport_Click(object sender, EventArgs e)
        {
            var forceMAGSAIInit = this.btnModelActionSupport.BackColor == this.defaultButtonBackgroundColor;

            if (sender != null && sender is bool)
            {
                forceMAGSAIInit = (bool)sender;
            }
            if (forceMAGSAIInit) //not selected state
            {
                var selectedModel = ObjectView.SelectedModel;
                if (selectedModel != null)
                {
                    this.ResetBackgroundColors();
                    ToolbarActionsManager.Update(Enums.MainFormToolStripActionType.btnModelActionMagsAI, frmStudioMain.SceneControl, this.btnModelActionSupport);
                    UpdateSelectedButtonBackground(this.btnModelActionSupport);
                }
                else
                {
                    ToolbarActionsManager.Update(Enums.MainFormToolStripActionType.btnSelectPressed, frmStudioMain.SceneControl, null);
                    MAGSAINoModelSelected?.Invoke(null, null);
                }
            }
            else
            {
                DeselectButtons();

                ToolbarActionsManager.Update(Enums.MainFormToolStripActionType.btnSelectPressed, frmStudioMain.SceneControl, null);
            }
        }
Exemplo n.º 3
0
 private void lblMoreOptions_Click(object sender, EventArgs e)
 {
     this.UpdateMoreOptionsCollapseState(this._showMoreOptionsCollapsed);
     if (this._showMoreOptionsCollapsed)
     {
         ToolbarActionsManager.Update(MainFormToolStripActionType.btnModelActionMagsAIManualSupport, frmStudioMain.SceneControl, null);
     }
     else
     {
         ToolbarActionsManager.Update(MainFormToolStripActionType.btnModelActionMagsAI, frmStudioMain.SceneControl, null);
     }
 }
 private void btnModelActionGridSupport_Click(object sender, EventArgs e)
 {
     if (this.btnModelActionSupport.BackColor == this.defaultButtonBackgroundColor) //not selected state
     {
         if (ObjectView.SelectedModel != null)
         {
             this.ResetBackgroundColors();
             ToolbarActionsManager.Update(Enums.MainFormToolStripActionType.btnModelActionMagsAI, frmStudioMain.SceneControl, this.btnModelActionSupport);
             UpdateSelectedButtonBackground(this.btnModelActionSupport);
         }
     }
 }
Exemplo n.º 5
0
        private void tbWizard_Selecting(object sender, TabControlCancelEventArgs e)
        {
            if (e.TabPage == this.tbPreview)
            {
                this.magsAIPreview1.GLControl = this.magsAIOrientationTabPanel1.GLControl;
                ToolbarActionsManager.Update(MainFormToolStripActionType.btnSelectPressed, this.magsAIPreview1.GLControl, null);

                this.magsAIPreview1.GLControl.Render();

                foreach (var model in ObjectView.Objects3D)
                {
                    if (model is STLModel3D && !(model is GroundPane))
                    {
                        var stlModel = model as STLModel3D;

                        if (this.magsAIOrientationTabPanel1.OrientationType == MagsAIOrientationTabPanel.TypeOfOrientation.SelectedTriangles)
                        {
                            //calc new model normal
                            var autorotationNormal = stlModel.Triangles.CalcSelectedOrientationTrianglesNormal();

                            float zAngle; float yAngle;
                            VectorHelper.CalcRotationAnglesYZFromVector(autorotationNormal, false, out zAngle, out yAngle);

                            //rotate model
                            stlModel.Rotate(0, 0, stlModel.RotationAngleZ - zAngle, RotationEventArgs.TypeAxis.Z);
                            stlModel.UpdateDefaultCenter();
                            stlModel.Rotate(0, stlModel.RotationAngleY - yAngle, 0, RotationEventArgs.TypeAxis.Y);
                            stlModel.UpdateDefaultCenter();
                            stlModel.UpdateBoundries();
                        }
                        else
                        {
                            stlModel.Triangles.ClearSelectedOrientationTriangles();
                        }

                        if (this.magsAIMaterialTabPanel1.LiftModelOnSupport)
                        {
                            stlModel.MoveTranslationZ = 5f;
                            stlModel.LiftModelOnSupport();
                        }
                    }
                }
            }
            else if (e.TabPage == this.tbMagsAIOrientation)
            {
                //ToolStripActionsManager.Update(MainFormToolStripActionType.btnLayFlatPressed, frmStudioMain.SceneControl);
            }
        }
Exemplo n.º 6
0
        internal static void ImportWorkspaceFileAsync(Form mainForm, string argumentFileName = null)
        {
            ProgressBarManager.UpdateMainPercentage(5);
            ToolbarActionsManager.Update(Enums.MainFormToolStripActionType.btnSelectPressed, frmStudioMain.SceneControl, null);

            if (argumentFileName == null)
            {
                using (var popup = new OpenFileDialog())
                {
                    popup.Filter      = "(*.apf)|*.apf";
                    popup.Multiselect = false;
                    if (popup.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(popup.FileName))
                    {
                        if (File.Exists(popup.FileName))
                        {
                            var           fileName         = popup.FileName;
                            var           backgroundWorker = new BackgroundWorker();
                            List <object> arguments        = new List <object>()
                            {
                                fileName
                            };
                            UserProfileManager.UserProfile.AddRecentOpenedFile(new Controls.NewGui.SplashControl.UnlicensedControl.RecentFiles.RecentOpenedFile()
                            {
                                FileName = new FileInfo(popup.FileName).Name, FullPath = popup.FileName, AccessedDateTime = DateTime.Now
                            });
                            UserProfileManager.Save();

                            backgroundWorker.DoWork += new DoWorkEventHandler(ImportWorkspaceFile);
                            backgroundWorker.RunWorkerAsync(arguments);
                        }
                    }
                }
            }
            else
            {
                var           backgroundWorker = new BackgroundWorker();
                List <object> arguments        = new List <object>()
                {
                    argumentFileName
                };

                backgroundWorker.DoWork             += new DoWorkEventHandler(ImportWorkspaceFile);
                backgroundWorker.RunWorkerCompleted += ImportWorkspaceFile_RunWorkerCompleted;
                backgroundWorker.RunWorkerAsync(arguments);
            }
        }
        private void btnModelActionDuplicate_Click(object sender, EventArgs e)
        {
            if (this.btnModelActionDuplicate.BackColor == this.defaultButtonBackgroundColor) //not selected state
            {
                if (ObjectView.SelectedModel != null)
                {
                    this.ResetBackgroundColors();
                    ToolbarActionsManager.Update(Enums.MainFormToolStripActionType.btnModelActionDuplicate, frmStudioMain.SceneControl, this.btnModelActionDuplicate);
                    UpdateSelectedButtonBackground(this.btnModelActionDuplicate);
                }
            }
            else
            {
                DeselectButtons();

                ToolbarActionsManager.Update(Enums.MainFormToolStripActionType.btnSelectPressed, frmStudioMain.SceneControl, null);
            }
        }
 private void btnCameraActionOrbit_Click(object sender, EventArgs e)
 {
     ToolbarActionsManager.Update(MainFormToolStripActionType.btnOrbitPressed, frmStudioMain.SceneControl, this.CameraActionOrbit);
 }
Exemplo n.º 9
0
        private void rdOrbit_CheckedChanged(object sender, System.EventArgs e)
        {
            var cameraToolbar = SceneControlToolbarManager.Toolbars.OfType <SceneControlCameraActionsToolbar>().First();

            ToolbarActionsManager.Update(Core.Enums.MainFormToolStripActionType.btnOrbitPressed, this._glControl, cameraToolbar.CameraActionOrbit);
        }
Exemplo n.º 10
0
 private void SceneControlModelMagsAI_onClosed(object sender, EventArgs e)
 {
     ToolbarActionsManager.Update(MainFormToolStripActionType.btnSelectPressed, frmStudioMain.SceneControl, null);
 }
Exemplo n.º 11
0
        internal void RefreshCurrentDuplicates()
        {
            if (ObjectView.Objects3D.Count > 1)
            {
                _packModelsRequest = PackingHelper.CreatePackModelsRequest(null);
                var solutions = PackingHelper.CalculatePackingSolutions(_packModelsRequest);
                this.spcModelControls.Panel1.Controls.Clear();
                int i             = 0;
                var summaryHeight = 0;
                this.Height = 215;
                foreach (var model in ObjectView.Objects3D)
                {
                    if (model != null && (!(model is GroundPane)))
                    {
                        var stlModel = model as STLModel3D;

                        ModelFootprint modelFootprint = null;
                        if (solutions.BestSolution == null)
                        {
                            modelFootprint       = new ModelFootprint(stlModel.RightPoint - stlModel.LeftPoint, stlModel.FrontPoint - stlModel.BackPoint);
                            modelFootprint.Model = stlModel;
                        }
                        else
                        {
                            modelFootprint = solutions.BestSolution.Footprints.First(f => f.Model == stlModel);
                        }

                        if (i > 0)
                        {
                            this.Height += defaultItemHeight;
                        }

                        DuplicateModelControl duplicateModelControl = new DuplicateModelControl(modelFootprint);
                        if (i % 2 != 0)
                        {
                            duplicateModelControl.BackgroundColor = Color.FromArgb(237, 237, 237);
                        }
                        else
                        {
                            duplicateModelControl.BackgroundColor = Color.FromArgb(224, 224, 224);
                        }

                        duplicateModelControl.Left = 0;
                        duplicateModelControl.Top  = summaryHeight;
                        duplicateModelControl.DuplicatesCount_KeyUp += DuplicateModelControl_DuplicatesCount_KeyPress;
                        duplicateModelControl.DuplicatesMinus_Click += DuplicateModelControl_DuplicatesMinus_Click;
                        duplicateModelControl.DuplicatesPlus_Click  += DuplicateModelControl_DuplicatesPlus_Click;
                        this.spcModelControls.Panel1.Controls.Add(duplicateModelControl);
                        summaryHeight += defaultItemHeight;
                        i++;
                    }
                }
            }
            else
            {
                this.Visible = false;

                //show message
                var tt = new SceneControlManualToolTip();
                tt.SetText("No models available");

                var modelActionsToolbar    = SceneControlToolbarManager.ModelActionsToolbar;
                var btnDuplicationButton   = modelActionsToolbar.ModelDuplicateButton;
                var duplicationButtonPoint = new Point(btnDuplicationButton.Left + btnDuplicationButton.Width + modelActionsToolbar.Left + 16, btnDuplicationButton.Top + modelActionsToolbar.Top);
                duplicationButtonPoint.Y += (btnDuplicationButton.Height / 2) - (tt.Height / 2);
                tt.ShowToolTip(duplicationButtonPoint);

                ToolbarActionsManager.Update(Core.Enums.MainFormToolStripActionType.btnSelectPressed, frmStudioMain.SceneControl, null);
            }
        }
 private void ResetActionPanels()
 {
     ToolbarActionsManager.Update(Enums.MainFormToolStripActionType.btnSelectPressed, frmStudioMain.SceneControl, this.btnModelActionRotate);
 }