Exemple #1
0
        internal static void ShowToolbars(SceneGLControl sceneControl)
        {
            var controlsToRemove = new List <Control>();

            foreach (Control control in sceneControl.Controls)
            {
                if (control is SceneControlToolbarBase || control is ExportUserControl)
                {
                    controlsToRemove.Add(control);
                }
            }

            foreach (var control in controlsToRemove)
            {
                sceneControl.Controls.Remove(control);
            }

            //add new controls
            foreach (var panel in Toolbars)
            {
                sceneControl.Controls.Add(panel);
            }

            sceneControl.Render();
        }
Exemple #2
0
        internal static void Initialize(StatusStrip statusbar, SceneGLControl sceneControl)
        {
            if (!_disabled)
            {
                Core.Models.STLModel3D.OpenFileProcessing += STLModel3D_OpenFileProcessing;
                _statusbar   = statusbar;
                SceneControl = sceneControl;

                foreach (ToolStripItem control in statusbar.Items)
                {
                    if (control.Name == "pgStatusOfCurrentProgress")
                    {
                        CurrentProcessProgressbar = (ToolStripProgressBar)control;
                    }
                    else if (control.Name == "lblStatusOfCurrentProgress")
                    {
                        CurrentProcessProgressLabel = (ToolStripStatusLabel)control;
                    }
                    else if (control.Name == "lblActionMessage")
                    {
                        CurrentActionMessage = (ToolStripStatusLabel)control;
                    }
                }

                //always hide progress status
                HideProgressStatus();
            }
        }
Exemple #3
0
        internal static void Reinitialize(SceneGLControl sceneControl)
        {
            if (sceneControl != null)
            {
                sceneControl.ModelContextFormMenu.Close(false);
                sceneControl.SupportConeContextFormMenu.Close(false);

                for (var controlIndex = sceneControl.Controls.Count - 1; controlIndex > 1; controlIndex--)
                {
                    if (sceneControl.Controls[controlIndex] is SceneControlToolbarBase)
                    {
                        sceneControl.Controls.RemoveAt(controlIndex);
                    }
                }

                if (frmStudioMain.SceneControl.Controls.OfType <ExportUserControl>().Count() == 0)
                {
                    Initialize(sceneControl.Parent);

                    ShowToolbars(sceneControl);

                    var selectedModel = ObjectView.SelectedModel;
                    if (selectedModel != null)
                    {
                        UpdateModelDimensions(selectedModel.Width, selectedModel.Depth, selectedModel.Height);
                    }

                    //sceneControl.Render();
                }
            }
        }
        internal ModelSelectedToolTip(SceneGLControl parentControl)
        {
            this.Visible = false;

            this._parentControl      = parentControl;
            this._showDelay.Interval = 500;
            this._showDelay.Tick    += _showDelay_Tick;
            this._showDelay.Start();

            this.Size    = new System.Drawing.Size(40, 24);
            this.Margin  = new Padding();
            this.Padding = new Padding();

            this.btnMove                       = new Button();
            this.btnMove.Size                  = new System.Drawing.Size(24, 24);
            this.btnMove.BackgroundImage       = Properties.Resources.Add;
            this.btnMove.BackgroundImageLayout = ImageLayout.Zoom;
            this.btnMove.Text                  = string.Empty;
            this.btnMove.Click                += btnMove_Click;
            this.Controls.Add(this.btnMove);

            this.btnRotate                       = new Button();
            this.btnRotate.Left                  = this.btnMove.Width;
            this.btnRotate.Top                   = 0;
            this.btnRotate.Size                  = new System.Drawing.Size(24, 24);
            this.btnRotate.BackgroundImage       = Properties.Resources.orbit_24x24;
            this.btnRotate.BackgroundImageLayout = ImageLayout.Zoom;
            this.btnRotate.Text                  = string.Empty;
            this.btnRotate.Click                += btnRotate_Click;
            this.Controls.Add(this.btnRotate);
        }
Exemple #5
0
        public static void ChangeViewMode(ViewMode viewMode, SceneGLControl sceneControl, PictureBox buttonPressed)
        {
            ResetObjectsCache();

            CurrentViewMode = viewMode;


            switch (viewMode)
            {
            case ViewMode.ModelRotation:
                SceneActionControlManager.ShowPanel(Enums.MainFormToolStripActionType.btnRotatePressed, buttonPressed, sceneControl);
                break;

            case ViewMode.SelectObject:
                SceneActionControlManager.ShowPanel(Enums.MainFormToolStripActionType.btnSelectPressed, buttonPressed, sceneControl);
                SceneView.Reset3DGizmos();
                sceneControl.RightMouseDown = false;
                break;

            case ViewMode.MoveTranslation:
                SceneActionControlManager.ShowPanel(Enums.MainFormToolStripActionType.btnMovePressed, buttonPressed, sceneControl);
                break;

            case ViewMode.Pan:
                sceneControl.RightMouseDown = false;
                break;

            case ViewMode.Duplicate:
                SceneActionControlManager.ShowPanel(Enums.MainFormToolStripActionType.btnModelActionDuplicate, buttonPressed, sceneControl);
                break;

            case ViewMode.ModelScale:
                SceneActionControlManager.ShowPanel(Enums.MainFormToolStripActionType.btnScalePressed, buttonPressed, sceneControl);
                break;

            case ViewMode.MagsAI:
                SceneActionControlManager.ShowPanel(Enums.MainFormToolStripActionType.btnModelActionMagsAI, buttonPressed, sceneControl);
                sceneControl.RightMouseDown = false;
                break;

            case ViewMode.MagsAIManualSupport:
                SceneActionControlManager.ShowPanel(Enums.MainFormToolStripActionType.btnModelActionMagsAIManualSupport, buttonPressed, sceneControl);
                sceneControl.RightMouseDown = false;
                break;

            case ViewMode.MagsAIGridSupport:
                SceneActionControlManager.ShowPanel(Enums.MainFormToolStripActionType.btnModelActionMagsAIGridSupport, buttonPressed, sceneControl);
                sceneControl.RightMouseDown = false;
                break;

            case ViewMode.LayFlat:
                sceneControl.RightMouseDown = false;
                break;
            }

            sceneControl.DrawSelectedTriangleRayTrace = true;
            sceneControl.Render(true);
        }
Exemple #6
0
 public static void UpdateSceneControlEvents(SceneGLControl sceneControl)
 {
     if (sceneControl != null)
     {
         sceneControl.ContextMenu_DeleteModel       += SceneControl_ContextMenu_DeleteModel;
         sceneControl.ContextMenu_Undo              += SceneControl_ContextMenu_Undo;
         sceneControl.ContextMenu_DeleteSupportCone += SceneControl_ContextMenu_DeleteSupportCone;
     }
 }
Exemple #7
0
 internal static void Redraw(SceneGLControl sceneControl)
 {
     sceneControl.ModelContextFormMenu.Close(false);
     sceneControl.SupportConeContextFormMenu.Close(false);
     foreach (Control control in sceneControl.Controls)
     {
         if (control is SceneControlToolbarBase)
         {
             control.Invalidate();
             control.Refresh();
         }
     }
 }
Exemple #8
0
        internal static void HideToolbars(SceneGLControl sceneControl)
        {
            var controlsToRemove = new List <Control>();

            foreach (Control control in sceneControl.Controls)
            {
                controlsToRemove.Add(control);
            }
            foreach (var control in controlsToRemove)
            {
                sceneControl.Controls.Remove(control);
            }

            sceneControl.Render();
        }
Exemple #9
0
 private static void DrawSolidColorBackground(SceneGLControl sceneControl, System.Drawing.Color color)
 {
     GL.Disable(EnableCap.DepthTest);
     GL.Disable(EnableCap.Lighting);
     GL.Begin(PrimitiveType.Triangles);
     GL.Color3(color);
     GL.Vertex3(-1.0, -1.0, 0.0);
     GL.Color3(color);
     GL.Vertex3(1.0, 1.0, 0.0);
     GL.Vertex3(-1.0, 1.0, 0.0);
     GL.Color3(color);
     GL.Vertex3(-1.0, -1.0, 0.0);
     GL.Vertex3(1.0, -1.0, 0.0);
     GL.Color3(color);
     GL.Vertex3(1.0, 1.0, 0.0);
     GL.End();
     GL.Ortho(0.0, (double)sceneControl.Width, 0.0, (double)sceneControl.Height, -1.0, 1.0);
     GL.Enable(EnableCap.DepthTest);
     GL.Enable(EnableCap.Lighting);
 }
Exemple #10
0
        internal static void ShowPanel(Enums.MainFormToolStripActionType actionType, PictureBox btnToolstrip, SceneGLControl sceneControl)
        {
            var selectedModel = ObjectView.SelectedModel;

            if ((actionType == Enums.MainFormToolStripActionType.btnModelActionMagsAI || actionType == Enums.MainFormToolStripActionType.btnModelActionMagsAIGridSupport || actionType == Enums.MainFormToolStripActionType.btnModelActionMagsAIManualSupport) &&
                IsActionPanelMagsAIVisible)
            {
            }
            else
            {
                ResetPanels();
            }

            switch (actionType)
            {
            case Enums.MainFormToolStripActionType.btnMovePressed:
                if (UserProfileManager.UserProfiles[0].Settings_Use_Numeric_Input_For_Positioning)
                {
                    var modelMovePanel = new SceneControlModelMove();
                    //modelMovePanel.ValueChanged += CloneModels;
                    modelMovePanel.Show(btnToolstrip);
                    var selectedLinkedClone = selectedModel.LinkedClones.FirstOrDefault(s => s.Selected);
                    if (selectedLinkedClone != null)
                    {
                        modelMovePanel.DataSource = selectedLinkedClone.Translation + new Vector3Class(0, 0, selectedModel.BottomPoint);
                    }
                    else
                    {
                        modelMovePanel.DataSource = selectedModel.MoveTranslation;
                    }
                    modelMovePanel.Select();
                    ActionPanels.Add(modelMovePanel);
                }
                break;

            case Enums.MainFormToolStripActionType.btnRotatePressed:
                if (UserProfileManager.UserProfiles[0].Settings_Use_Numeric_Input_For_Positioning)
                {
                    var modelRotatePanel = new SceneControlModelRotate();
                    //modelMovePanel.ValueChanged += CloneModels;
                    modelRotatePanel.Show(btnToolstrip);
                    // modelRotatePanel.DataSource=selectedModel.RotationAngleX;
                    modelRotatePanel.RotateX = selectedModel.RotationAngleX;
                    modelRotatePanel.RotateY = selectedModel.RotationAngleY;
                    modelRotatePanel.RotateZ = selectedModel.RotationAngleZ;
                    modelRotatePanel.Select();
                    ActionPanels.Add(modelRotatePanel);
                }
                break;

            case Enums.MainFormToolStripActionType.btnModelActionDuplicate:
                var duplicatePanel = new SceneControlModelDuplicate();
                duplicatePanel.ValueChanged            += CloneModels;
                duplicatePanel.FillBuildPlateCompleted += DuplicatePanel_FillBuildPlateCompleted;
                duplicatePanel.Init();
                duplicatePanel.Show(btnToolstrip);
                duplicatePanel.Select();
                ActionPanels.Add(duplicatePanel);
                break;

            case Enums.MainFormToolStripActionType.btnModelActionMagsAI:
                var magsAIPanel = ActionPanelMagsAI;
                if (magsAIPanel == null)
                {
                    magsAIPanel = new SceneControlModelMagsAI();
                    magsAIPanel.MAGSAICompleted += MagsAIPanel_MAGSAICompleted;
                    magsAIPanel.Show(btnToolstrip);
                    magsAIPanel.ChangeDefaultView(Enums.MainFormToolStripActionType.btnModelActionMagsAI);
                    ActionPanels.Add(magsAIPanel);
                }
                else
                {
                    magsAIPanel.ChangeDefaultView(Enums.MainFormToolStripActionType.btnModelActionMagsAI);
                }
                break;

            case Enums.MainFormToolStripActionType.btnModelActionMagsAIManualSupport:
                var magsAIManualSupportPanel = ActionPanelMagsAI;
                if (magsAIManualSupportPanel == null)
                {
                    magsAIManualSupportPanel = new SceneControlModelMagsAI();
                    magsAIManualSupportPanel.MAGSAICompleted += MagsAIPanel_MAGSAICompleted;
                    magsAIManualSupportPanel.Show(btnToolstrip);
                    magsAIManualSupportPanel.ChangeDefaultView(Enums.MainFormToolStripActionType.btnModelActionMagsAIManualSupport);
                    ActionPanels.Add(magsAIManualSupportPanel);
                }
                else
                {
                    magsAIManualSupportPanel.ChangeDefaultView(Enums.MainFormToolStripActionType.btnModelActionMagsAIManualSupport);
                }

                break;

            case Enums.MainFormToolStripActionType.btnModelActionMagsAIGridSupport:
                var magsAIGridSupportPanel = ActionPanelMagsAI;
                if (magsAIGridSupportPanel == null)
                {
                    magsAIGridSupportPanel = new SceneControlModelMagsAI();
                    magsAIGridSupportPanel.MAGSAICompleted += MagsAIPanel_MAGSAICompleted;
                    magsAIGridSupportPanel.Show(btnToolstrip);
                    magsAIGridSupportPanel.ChangeDefaultView(Enums.MainFormToolStripActionType.btnModelActionMagsAIGridSupport);
                    ActionPanels.Add(magsAIGridSupportPanel);
                }
                else
                {
                    magsAIGridSupportPanel.ChangeDefaultView(Enums.MainFormToolStripActionType.btnModelActionMagsAIGridSupport);
                }
                break;

            case Enums.MainFormToolStripActionType.btnScalePressed:
                var scalePanel = new SceneControlModelScale();
                scalePanel.DataSource    = selectedModel;
                scalePanel.ValueChanged += ScalingPanel_ValueChanged;
                scalePanel.Show(btnToolstrip);
                scalePanel.Select();
                ActionPanels.Add(scalePanel);
                break;
            }

            foreach (var panel in ActionPanels)
            {
                if (sceneControl.InvokeRequired)
                {
                    sceneControl.Invoke(new MethodInvoker(delegate
                    {
                        if (panel.InvokeRequired)
                        {
                            sceneControl.Controls.Add(panel);
                        }
                    }));
                }
                else
                {
                    sceneControl.Controls.Add(panel);
                }
            }
        }