Beispiel #1
0
 private void SetTexts()
 {
     this.cmdOK.Text = (DesignMode)
         ? "OK"
         : ((DesignMode) ? "OK" : UVDLPApp.Instance().resman.GetString("OK", UVDLPApp.Instance().cul));
     this.cmdCancel.Text = (DesignMode)
         ? "Cancel"
         : ((DesignMode) ? "Cancel" : UVDLPApp.Instance().resman.GetString("Cancel", UVDLPApp.Instance().cul));
     this.cmdselectfore.Text = (DesignMode)
         ? "Select"
         : ((DesignMode) ? "Select" : UVDLPApp.Instance().resman.GetString("Select", UVDLPApp.Instance().cul));
     this.label1.Text = (DesignMode)
         ? "ForegroundColor"
         : ((DesignMode)
             ? "ForegroundColor"
             : UVDLPApp.Instance().resman.GetString("ForegroundColor", UVDLPApp.Instance().cul));
     this.label1.Text = (DesignMode)
         ? "ForegroundColor"
         : ((DesignMode)
             ? "ForegroundColor"
             : UVDLPApp.Instance().resman.GetString("ForegroundColor", UVDLPApp.Instance().cul));
     this.label2.Text = ((DesignMode)
         ? "BackgroundColor"
         : UVDLPApp.Instance().resman.GetString("BackgroundColor", UVDLPApp.Instance().cul));
     this.cmdselectback.Text = ((DesignMode)
         ? "Select"
         : UVDLPApp.Instance().resman.GetString("Select", UVDLPApp.Instance().cul));
     this.grpDebug.Text = ((DesignMode)
         ? "Debugging"
         : UVDLPApp.Instance().resman.GetString("Debugging", UVDLPApp.Instance().cul));
     this.chkIgnoreGCRsp.Text = ((DesignMode)
         ? "IgnoreGCodeResponses"
         : UVDLPApp.Instance().resman.GetString("IgnoreGCodeResponses", UVDLPApp.Instance().cul));
     this.chkDriverLog.Text = ((DesignMode)
         ? "LogDriverDebuggingToCommLog"
         : UVDLPApp.Instance().resman.GetString("LogDriverDebuggingToCommLog", UVDLPApp.Instance().cul));
     this.Text = ((DesignMode)
         ? "ProgramPreferences"
         : UVDLPApp.Instance().resman.GetString("ProgramPreferences", UVDLPApp.Instance().cul));
 }
        /*Move the model in object space */
        public virtual void Translate(float x, float y, float z, bool updateUndo = false)
        {
            foreach (Point3d p in m_lstpoints)
            {
                p.x += x;
                p.y += y;
                p.z += z;
            }
            // translate connected supports as well
            if ((x != 0) || (y != 0))
            {
                foreach (Object3d sup in m_supports)
                {
                    sup.Translate(x, y, 0);
                }
            }
            if (z != 0)
            {
                foreach (Object3d sup in m_supports)
                {
                    if (sup is Support)
                    {
                        ((Support)sup).AddToHeight(z);
                    }
                }
            }
            m_center.Translate(x, y, z);
            m_min.Translate(x, y, z);
            m_max.Translate(x, y, z);

            foreach (Polygon p in m_lstpolys)
            {
                p.UpdateMove(x, y, z);
            }
            m_listid = -1; // invalidate the list id
            if (updateUndo)
            {
                UVDLPApp.Instance().m_undoer.SaveTranslation(this, x, y, z);
            }
        }
Beispiel #3
0
        public Slice GetSlice(int layer)
        {
            try
            {
                //if (m_mode == SFMode.eImmediate)
                {
                    // we're rendering slices immediately here
                    float zlev = (float)(layer * m_config.ZThick);
                    return(UVDLPApp.Instance().m_slicer.GetSliceImmediate(zlev));
                }
                //else
                // {

                //}
                return(null);
            }
            catch (Exception ex)
            {
                DebugLogger.Instance().LogRecord(ex.Message);
                return(null);
            }
        }
Beispiel #4
0
        public bool ExecuteSequence(string name)
        {
            try
            {
                CommandSequence seq = Find(name);
                if (seq == null)
                {
                    return(false);
                }
                switch (seq.m_seqtype)
                {
                case CommandSequence.COMMAND_TYPE_GCODE:
                    //a gcode command sequence - execute it with a pseudo-build manager/sequencer
                    GCodeFile gcf = new GCodeFile(seq.m_seq);
                    if (!UVDLPApp.Instance().m_buildmgr.IsPrinting)
                    {
                        DebugLogger.Instance().LogInfo("Running GCode Sequence " + seq.m_name);
                        UVDLPApp.Instance().m_buildmgr.StartPrint(UVDLPApp.Instance().m_slicefile, gcf, true);
                    }
                    break;

                case CommandSequence.COMMAND_TYPE_SPAWN_PROCESS:
                    //use the parameter variables to fill in the args, then spawn the process
                    // a flag can be to wait for the process to end , or simply start it.
                    ProcessSequence psc = (ProcessSequence)seq;
                    foreach (ProcessEntry pe in psc.m_entries)
                    {
                        pe.RunProcess();
                    }
                    break;
                }
                return(true);
            }
            catch (Exception ex)
            {
                DebugLogger.Instance().LogError(ex);
            }
            return(false);
        }
        public void SaveScene(object sender, EventArgs e)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new MethodInvoker(delegate() { SaveScene(sender, e); }));
            }
            else
            {
                //saveFileDialog1.Filter = "Scene files (*.cws)|*.cws|STL File (*.stl)|*.stl";
                saveFileDialog1.Filter      = "Scene files (*." + SceneFileExt + ")|*." + SceneFileExt + "|STL File (*.stl)|*.stl";
                saveFileDialog1.FilterIndex = 0;
                if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    //check the filter index
                    switch (saveFileDialog1.FilterIndex) // index starts at 1 instead of 0
                    {
                    case 1:
                        SceneFile.Instance().SaveModelsIntoScene(saveFileDialog1.FileName);
                        if (UVDLPApp.Instance().m_buildparms.exportpreview != PreviewGenerator.ePreview.None)
                        {
                            PreviewGenerator pg = new PreviewGenerator();
                            pg.ViewAngle = UVDLPApp.Instance().m_buildparms.exportpreview;
                            Bitmap preview = pg.GeneratePreview(512, 512);
                            SceneFile.Instance().AddPreviewImage(UVDLPApp.Instance().SceneFileName, preview, "Default", "ScenePreview.png");
                        }
                        UVDLPApp.Instance().RaiseAppEvent(eAppEvent.eSceneSaved, "cws");
                        break;

                    case 2:
                        //stl file
                        UVDLPApp.Instance().CalcScene();     // calc the scene object
                        UVDLPApp.Instance().Scene.SaveSTL_Binary(saveFileDialog1.FileName);
                        UVDLPApp.Instance().Scene.m_fullname = saveFileDialog1.FileName;
                        UVDLPApp.Instance().RaiseAppEvent(eAppEvent.eSceneSaved, "stl");
                        break;
                    }
                }
            }
        }
 /*
  * private void buttSetup_Click(object sender, EventArgs e)
  * {
  *  if (buttSetup.Checked)
  *  {
  *      Width = widthopen;
  *      Location = new Point(Location.X, Location.Y - (heightopen - Height));
  *      Height = heightopen;
  *  }
  *  else
  *  {
  *      Width = 170;
  *      Location = new Point(Location.X, Location.Y + (Height - 96));
  *      Height = 96;
  *  }
  * }
  */
 private void chkDownPolys_Click(object sender, EventArgs e)
 {
     UVDLPApp.Instance().m_supportconfig.m_downpoly = chkDownPolys.Checked;
     if (UVDLPApp.Instance().SelectedObject == null)
     {
         return;
     }
     // tell the 3d engine to only show polygons from objects that are facing downward at the specified angle
     if (chkDownPolys.Checked == true)
     {
         UVDLPApp.Instance().m_supportconfig.downangle = (double)numDownAngle.FloatVal;
         // I think this should affect all objects in the scene
         // and it should be more of a global setting
         UVDLPApp.Instance().SelectedObject.MarkPolysDown(UVDLPApp.Instance().m_supportconfig.downangle);
     }
     else
     {
         // restore the object
         UVDLPApp.Instance().SelectedObject.ClearPolyTags();
     }
     UVDLPApp.Instance().RaiseAppEvent(eAppEvent.eReDraw, "redraw");
 }
Beispiel #7
0
 private void cmdSendProj_Click(object sender, EventArgs e)
 {
     try
     {
         // get the index from the combo box
         int idx = cmbCommands.SelectedIndex;
         if (idx == -1)
         {
             return;
         }
         ProjectorCommand cmd = UVDLPApp.Instance().m_proj_cmd_lst.m_commands[idx];
         byte[]           dat = cmd.GetBytes();
         if (dat != null)
         {
             UVDLPApp.Instance().m_deviceinterface.DriverProjector.Write(dat, dat.Length);
         }
     }
     catch (Exception ex)
     {
         DebugLogger.Instance().LogError(ex.Message);
     }
 }
Beispiel #8
0
 protected void ScaleObject(ctlTextBox var, float x, float y, float z)
 {
     try
     {
         if (UVDLPApp.Instance().SelectedObject == null)
         {
             return;
         }
         float val = var.FloatVal / 100f;
         x = (x == 0) ? 1 : x * val;
         y = (y == 0) ? 1 : y * val;
         z = (z == 0) ? 1 : z * val;
         UVDLPApp.Instance().SelectedObject.Scale(x, y, z);
         UVDLPApp.Instance().m_undoer.SaveScale(UVDLPApp.Instance().SelectedObject, x, y, z);
         UVDLPApp.Instance().SelectedObject.Update(); // make sure we update
         //ShowObjectInfo();
         UVDLPApp.Instance().RaiseAppEvent(eAppEvent.eUpdateSelectedObject, ((DesignMode) ? "Updateobject" :UVDLPApp.Instance().resman.GetString("Updateobject", UVDLPApp.Instance().cul)));
     }
     catch (Exception)
     {
     }
 }
        private void testSaveSceneToolStripMenuItem_Click(object sender, EventArgs e)
        {
            saveFileDialog1.Filter      = "Scene files (*.cws)|*.cws|STL File (*.stl)|*.stl";
            saveFileDialog1.FilterIndex = 0;
            if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                //check the filter index
                switch (saveFileDialog1.FilterIndex) // index starts at 1 instead of 0
                {
                case 1:
                    Scene.Instance().Save(saveFileDialog1.FileName);
                    break;

                case 2:
                    //stl file
                    UVDLPApp.Instance().CalcScene();     // calc the scene object
                    UVDLPApp.Instance().Scene.SaveSTL_Binary(saveFileDialog1.FileName);
                    UVDLPApp.Instance().Scene.m_fullname = saveFileDialog1.FileName;
                    break;
                }
            }
        }
        private void cmdRemoveObject_Click(object sender, EventArgs e)
        {
            // delete the current selected object
            if (UVDLPApp.Instance().SelectedObject != null)
            {
                //if this is a support, remove it from the parent as to not create an orphan
                if (UVDLPApp.Instance().SelectedObject.tag == Object3d.OBJ_SUPPORT || UVDLPApp.Instance().SelectedObject.tag == Object3d.OBJ_SUPPORT_BASE)
                {
                    UVDLPApp.Instance().RemoveSupport(UVDLPApp.Instance().SelectedObject, true);
                }
                else
                {
                    UVDLPApp.Instance().RemoveCurrentModel();
                }

                UVDLPApp.Instance().SelectedObject = null;

                // by esyeon 2016-02-17
                SetupSceneTree_All();
                // by esyeon
            }
        }
        private void AppEventDel(eAppEvent ev, String Message)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new MethodInvoker(delegate() { AppEventDel(ev, Message); }));
            }
            else
            {
                switch (ev)
                {
                case eAppEvent.eObjectSelected:
                    Object3d sel = UVDLPApp.Instance().SelectedObject;
                    if (sel != null)
                    {
                        //highlist the selected
                        HighLightSelected(sel);
                    }
                    break;

                case eAppEvent.eModelRemoved:
                case eAppEvent.eModelAdded:
                    if (ignorerefresh)
                    {
                        return;
                    }
                    UpdateSceneTree();

                    break;

                // bye esyeon 2016-02-17
                case eAppEvent.eModelSupportCompleted:
                    UpdateSceneTree(2);

                    break;
                    // by esyeon
                }
                Refresh();
            }
        }
Beispiel #12
0
 public void Save()
 {
     try
     {
         string fname = UVDLPApp.Instance().m_apppath + UVDLPApp.m_pathsep + "pluginconfig.cfg";
         using (StreamWriter writer = new StreamWriter(fname))
         {
             foreach (PluginEntry pe in UVDLPApp.Instance().m_plugins)
             {
                 if (pe.m_enabled == false)  // only write out the disabled entries for now
                 {
                     writer.WriteLine(pe.m_filename);
                 }
             }
             writer.Close();
         }
     }
     catch (Exception ex)
     {
         DebugLogger.Instance().LogError(ex);
     }
 }
        void m_timer_Tick(object sender, EventArgs e)
        {
            try
            {
                if (UVDLPApp.Instance().m_splashStop&& (m_total < (max - 50)))
                {
                    m_total = max - 50;
                    Visible = false;
                    Update();
                    Visible = true;
                    //this.Opacity = 1;
                    //Update();
                }
                if (m_total >= max)// check for closing
                {
                    m_timer.Stop();
                    Close();
                    UVDLPApp.Instance().RaiseAppEvent(eAppEvent.eReDraw, "splash end");
                    return;
                }

                if (m_total > (max - 10)) // fade out
                {
                    this.Opacity -= .1;
                }

                if (m_total < 10) // fade in
                {
                    this.Opacity += .1;
                }
                m_total++;
            }
            catch (Exception ex)
            {
                m_timer.Stop();
                DebugLogger.Instance().LogError(ex.Message);
                Close();
            }
        }
 private void cmdEdit_Click(object sender, EventArgs e)
 {
     if (lstSliceBuildProfiles.SelectedIndex != -1)
     {
         string fn = FNFromIndex(lstSliceBuildProfiles.SelectedIndex);
         if (fn != null)
         {
             SliceBuildConfig sbc = null;
             if (UVDLPApp.Instance().m_buildparms.m_filename.Equals(fn))
             {
                 sbc = UVDLPApp.Instance().m_buildparms; // current slicing profile
             }
             else
             {
                 sbc = new SliceBuildConfig(); // existing but not current
                 sbc.Load(fn);
             }
             frmSliceOptions m_frmsliceopt = new frmSliceOptions(ref sbc);
             m_frmsliceopt.ShowDialog();
         }
     }
 }
Beispiel #15
0
 private void UpdateProfiles()
 {
     try
     {
         // get a list of profiles in the /machines directory
         string[] filePaths = Directory.GetFiles(UVDLPApp.Instance().m_PathMachines, "*.machine");
         //lstMachineProfiles.Items.Clear();
         cmbMachineProfiles.Items.Clear();
         foreach (String profile in filePaths)
         {
             String pn = Path.GetFileNameWithoutExtension(profile);
             //lstMachineProfiles.Items.Add(pn);
             cmbMachineProfiles.Items.Add(pn);
         }
         MachineConfig cfg = UVDLPApp.Instance().m_printerinfo;
         cmbMachineProfiles.SelectedItem = cfg.m_name; // show the current profile in the combo box
     }
     catch (Exception ex)
     {
         DebugLogger.Instance().LogError(ex.Message);
     }
 }
Beispiel #16
0
 private void cmdEdit_Click(object sender, EventArgs e)
 {
     if (lstMachineProfiles.SelectedIndex != -1)
     {
         string fn = FNFromIndex(lstMachineProfiles.SelectedIndex);
         if (fn != null)
         {
             MachineConfig mc = null;
             if (UVDLPApp.Instance().m_printerinfo.m_filename.Equals(fn))
             {
                 mc = UVDLPApp.Instance().m_printerinfo; // current machine profile
             }
             else
             {
                 mc = new MachineConfig(); // existing but not current
                 mc.Load(fn);
             }
             frmMachineConfig maccfg = new frmMachineConfig(ref mc);
             maccfg.Show();
         }
     }
 }
Beispiel #17
0
 private void cmdEnable_Click(object sender, EventArgs e)
 {
     if (ipsel == null)
     {
         return;
     }
     if (cmdEnable.Text.Contains("Disable"))
     {
         //disable the current ipsel
         ipsel.m_enabled = false;
     }
     else
     {
         ipsel.m_enabled = true;
     }
     // save the enabled status
     UVDLPApp.Instance().m_pluginstates.Save(); // save the state of the plugin enabled statuses
     //now refresh the buttons
     UpdateButtons();
     //refresh the plugin list as well
     SetupPlugins();
 }
        private void DisplayFunc()
        {
            if (!loaded)
            {
                return;
            }

            glControl1.MakeCurrent();

            //glControl1.SelectBackPainting();
            /* Clear the buffer, clear the matrix */
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            if (Render3dSpace)
            {
                //GL.LoadIdentity(); // assuming we're in the model matrix still
                SetAlpha(UVDLPApp.Instance().m_engine3d.m_alpha);
                DrawBackground();

                UVDLPApp.Instance().Engine3D.RenderGL();
                //glControl1.SelectForePainting();
                //DrawISect();
                Render3dSlice();
                RenderAxisIndicator();

                GL.BindTexture(TextureTarget.Texture2D, mColorBuffer);
                GL.CopyTexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba8, 0, 0, Width, Height, 0);
                GL.BindTexture(TextureTarget.Texture2D, 0);
            }
            //GL.Flush();
            DrawForeground();
            GL.Flush();
            glControl1.SwapBuffers();
            if (Event3DViewRedraw != null)
            {
                Event3DViewRedraw();
            }
            Render3dSpace = false;
        }
Beispiel #19
0
        private bool GetData(bool suppresspopup = false)
        {
            try
            {
                if (cmbMultiSel.SelectedIndex != -1)
                {
                    m_config.m_multimontype = (MachineConfig.eMultiMonType)Enum.Parse(typeof(MachineConfig.eMultiMonType), cmbMultiSel.SelectedItem.ToString());
                }
                if (m_saved != m_config.m_driverconfig.m_drivertype)
                {
                    UVDLPApp.Instance().SetupDriver();
                }

                m_config.m_PlatXSize = double.Parse(txtPlatWidth.Text);
                m_config.m_PlatYSize = double.Parse(txtPlatHeight.Text);
                m_config.m_PlatZSize = double.Parse(txtPlatTall.Text);
                m_config.XRenderSize = int.Parse(txtXRes.Text);
                m_config.YRenderSize = int.Parse(txtYRes.Text);
                m_config.CalcPixPerMM();
                m_config.MachineControls = GetMachineControls();
                labelPressApply.Visible  = false;

                if (lbConfigured.SelectedIndex != -1 && curmc != null)
                {
                    //Configs.MonitorConfig mc = m_config.m_lstMonitorconfigs[lbConfigured.SelectedIndex];
                    curmc.m_usemask = chkEnableMask.Checked;
                }
                return(true);
            }
            catch (Exception ex)
            {
                if (!suppresspopup)
                {
                    DebugLogger.Instance().LogRecord(ex.Message);
                    MessageBox.Show("Please check input parameters\r\n" + ex.Message, "Input Error");
                }
                return(false);
            }
        }
 public void SetNumLayers(int val)
 {
     if (val < 0)
     {
         val = 0;
     }
     if (UVDLPApp.Instance().m_appconfig.m_viewslice3d&& (val > 0))
     {
         numLayer.MaxInt         = scrollLayer.Maximum = val;
         numLayer.IntVal         = 1;
         numLayer.Visible        = true;
         ctlInfoItemZLev.Visible = true;
         scrollLayer.Visible     = true;
     }
     else
     {
         numLayer.Visible        = false;
         ctlInfoItemZLev.Visible = false;
         scrollLayer.Visible     = false;
     }
     ViewLayer(0);
 }
        public void UpdateView(bool update3D)
        {
            if (update3D)
            {
                Render3dSpace = true;
            }
            glControl1.Invalidate();
            if (UVDLPApp.Instance().SelectedObject != null)
            {
                if (UVDLPApp.Instance().SelectedObject.tag == Object3d.OBJ_SUPPORT)
                {
                    Support sup = (Support)UVDLPApp.Instance().SelectedObject;

                    RTUtils.UpdateObjectSelectionPlane(sup.Centroid(), m_camera.m_right, m_camera.m_up);
                }
                else
                {
                    RTUtils.UpdateObjectSelectionPlane(UVDLPApp.Instance().SelectedObject.m_center, m_camera.m_right, m_camera.m_up);
                }
            }
            //DisplayFunc();
        }
 protected void ScaleObject(ctlTextBox var, float x, float y, float z)
 {
     try
     {
         if (UVDLPApp.Instance().SelectedObject == null)
         {
             return;
         }
         float val = var.FloatVal / 100f;
         x = (x == 0) ? 1 : x * val;
         y = (y == 0) ? 1 : y * val;
         z = (z == 0) ? 1 : z * val;
         UVDLPApp.Instance().SelectedObject.Scale(x, y, z);
         UVDLPApp.Instance().m_undoer.SaveScale(UVDLPApp.Instance().SelectedObject, x, y, z);
         UVDLPApp.Instance().SelectedObject.Update(); // make sure we update
         //ShowObjectInfo();
         UVDLPApp.Instance().RaiseAppEvent(eAppEvent.eReDraw, "redraw");
     }
     catch (Exception)
     {
     }
 }
        /// <summary>
        /// For now this is the editing mode for the currently selected support
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void glControl1_Click(object sender, EventArgs e)
        {
            // single click on GL Control
            if (UVDLPApp.Instance().SupportEditMode == UVDLPApp.eSupportEditMode.eAddSupport)
            {
                // if we're adding supports
                MouseEventArgs me = e as MouseEventArgs;
                // MouseButtons buttonPushed = me.Button;
                int xPos = me.X;
                int yPos = me.Y;
                List <ISectData> isects = TestHitTest(xPos, yPos);
                if (isects.Count == 0)
                {
                    return;                    // no intersections
                }
                ISectData isd1 = null;
                foreach (ISectData isd in isects)
                {
                    // find the closest object we clicked
                    if (isd.obj.tag == Object3d.OBJ_NORMAL)
                    {
                        isd1 = isd; //  save it
                        break;
                    }
                }
                if (isd1 == null)
                {
                    return;               // no object intersection
                }
                //add a support
                Support sup = AddNewSupport(isd1.intersect.x, isd1.intersect.y, isd1.intersect.z, isd1.obj);
                sup.SelectionType = Support.eSelType.eTip;
                sup.MoveFromTip(isd1);
                sup.SelectionType = Support.eSelType.eWhole;

                UpdateView();
                return;
            }
        }
        private void AppEvent(eAppEvent ev, string message)
        {
            switch (ev)
            {
            case eAppEvent.eModelRemoved:
                ListSupports();
                break;

            case eAppEvent.eModelAdded:
                ListSupports();
                break;

            case eAppEvent.eObjectSelected:
                Object3d sel = UVDLPApp.Instance().SelectedObject;
                if (sel != null)
                {
                    //highlist the selected
                    HighLightSelected(sel);
                }
                break;
            }
        }
        private void cmdSaveGCode_Click(object sender, EventArgs e)
        {
            try
            {
                // save the gcode to the right section
                string gcode = txtGCode.Text;
                if (lbGCodeSection.SelectedIndex == -1)
                {
                    return;
                }
                switch (lbGCodeSection.SelectedItem.ToString())
                {
                case "Start": m_config.HeaderCode = gcode; break;

                case "Pre-Slice": m_config.PreSliceCode = gcode; break;

                case "Lift": m_config.LiftCode = gcode; break;

                case "End": m_config.FooterCode = gcode; break;
                }
                // m_config.SaveFile(CurPrefGcodePath() + GCodeSection2FName(), gcode);
                //really just need to save the profile name here.
                // make sure main build params are updated if needed
                string shortname = lstSliceProfiles.SelectedItem.ToString();
                string fname     = GetSlicingFilename(shortname);
                m_config.Save(fname);

                shortname = lstSliceProfiles.SelectedItem.ToString();
                if (cmbSliceProfiles.SelectedItem.ToString() == shortname)
                {
                    UVDLPApp.Instance().LoadBuildSliceProfile(GetSlicingFilename(shortname));
                }
            }
            catch (Exception ex)
            {
                DebugLogger.Instance().LogError(ex.Message);
            }
        }
 private void cmdSendProj_Click(object sender, EventArgs e)
 {
     try
     {
         // get the index from the combo box
         int idx = cmbCommands.SelectedIndex;
         if (idx == -1)
         {
             return;
         }
         ProjectorCommand cmd = UVDLPApp.Instance().m_proj_cmd_lst.m_commands[idx];
         byte[]           dat = cmd.GetBytes();
         if (dat != null)
         {
             int idx2 = cmbDisplays.SelectedIndex;
             if (idx2 == -1)
             {
                 return;
             }
             MonitorConfig mc = UVDLPApp.Instance().m_printerinfo.m_lstMonitorconfigs[idx2];
             //mc.m_displayconnection.
             //get the correct projector driver
             DeviceDriver prjdrv = UVDLPApp.Instance().m_deviceinterface.GetDriver(idx2);
             if (prjdrv.Connected)
             {
                 prjdrv.Write(dat, dat.Length); // write it
             }
             else
             {
                 MessageBox.Show("Projector Driver Not connected");
             }
         }
     }
     catch (Exception ex)
     {
         DebugLogger.Instance().LogError(ex.Message);
     }
 }
        private void AddControls()
        {
            // the main title buttons

            UVDLPApp.Instance().m_gui_config.AddControl("ctlTitle3dView", ctlTitle3dView);
            UVDLPApp.Instance().m_gui_config.AddControl("ctlTitleViewSlice", ctlTitleViewSlice);
            UVDLPApp.Instance().m_gui_config.AddControl("ctlTitleViewControls", ctlTitleViewControls);
            UVDLPApp.Instance().m_gui_config.AddControl("ctlTitleConfigure", ctlTitleConfigure);
            UVDLPApp.Instance().m_gui_config.AddControl("ctlSliceGCodePanel1", ctlSliceGCodePanel1);

            UVDLPApp.Instance().m_gui_config.AddControl("ctlMainConfig1", ctlMainConfig1);

            //left side controls
            UVDLPApp.Instance().m_gui_config.AddControl("ctlSupports1", ctlSupports1);
            //right side controls
            UVDLPApp.Instance().m_gui_config.AddControl("ctlScene1", ctlScene1);
            UVDLPApp.Instance().m_gui_config.AddControl("ctlMoveExpand1", ctlMoveExpand1);
            UVDLPApp.Instance().m_gui_config.AddControl("ctlScale1", ctlScale1);
            UVDLPApp.Instance().m_gui_config.AddControl("ctlRotate1", ctlRotate1);
            //UVDLPApp.Instance().m_gui_config.AddControl("ctlMirror1", ctlMirror1);
            UVDLPApp.Instance().m_gui_config.AddControl("ctlView1", ctlView1);
            UVDLPApp.Instance().m_gui_config.AddControl("ctlObjectInfo1", ctlObjectInfo1);

            // panels on the main form
            UVDLPApp.Instance().m_gui_config.AddControl("pnlTopIcons", pnlTopIcons);
            UVDLPApp.Instance().m_gui_config.AddControl("pnlTopTabs", pnlTopTabs);
            UVDLPApp.Instance().m_gui_config.AddControl("pnlTopIconsMain", pnlTopIconsMain);

            UVDLPApp.Instance().m_gui_config.AddControl("pnlRightBar", flowLayoutPanel1);
            UVDLPApp.Instance().m_gui_config.AddControl("pnlLeftBar", flowLayoutPanel2);

            //
            UVDLPApp.Instance().m_gui_config.AddControl("mainmsg", lblMainMessage);
            UVDLPApp.Instance().m_gui_config.AddControl("timemsg", lblTime);

            UVDLPApp.Instance().m_gui_config.AddControl("ctlMainManual", ctlMainManual1);
            //UVDLPApp.Instance().m_gui_config.AddControl("preferencesToolStripMenuItem", preferencesToolStripMenuItem);
        }
        public void Redo()
        {
            while (m_undopointer < m_undoItemList.Count)
            {
                UndoItem item = m_undoItemList[m_undopointer];
                m_undopointer++;
                switch (item.opType)
                {
                case eOperationType.Translate:
                    item.obj.Translate((float)item.x, (float)item.y, (float)item.z);
                    break;

                case eOperationType.Rotate:
                    item.obj.Rotate((float)item.x, (float)item.y, (float)item.z);
                    break;

                case eOperationType.Scale:
                    item.obj.Scale((float)item.x, (float)item.y, (float)item.z);
                    break;

                case eOperationType.Add:
                    UVDLPApp.Instance().m_engine3d.AddObject(item.obj);
                    break;

                case eOperationType.Del:
                    UVDLPApp.Instance().m_engine3d.RemoveObject(item.obj);
                    break;
                }
                item.obj.Update();
                if ((m_undopointer < m_undoItemList.Count) &&
                    (m_undoItemList[m_undopointer].linkedToPrev == false))
                {
                    break;
                }
            }
            UVDLPApp.Instance().RaiseAppEvent(eAppEvent.eUpdateSelectedObject, "updateobject");
            UpdateButtons();
        }
Beispiel #29
0
        protected override void OnPaint(PaintEventArgs pevent)
        {
            if (GLDisplay)
            {
                base.OnPaint(pevent);
                return;
            }
            Image img = mImage;

            if (img == null)
            {
                img = UVDLPApp.Instance().m_2d_graphics.GetBitmap(mGLImage);
            }
            if (img == null)
            {
                return;
            }
            Graphics gr = pevent.Graphics;

            if (Style.SubImgCount == 4)
            {
                OnPaint4(gr, img);
            }
            if (Style.SubImgCount == 1)
            {
                OnPaint1(gr, img);
            }

            if (mImage != null)
            {
                if (Enabled && (mCheckImage != null))
                {
                    mCheckrc.X = Checked ? mSubChkImgWidth : 0;
                    gr.DrawImage(mCheckImage, mDstrc, mCheckrc, GraphicsUnit.Pixel);
                }
            }
            //base.OnPaint(pevent);
        }
 private void cmdDelete_Click(object sender, EventArgs e)
 {
     try
     {
         string shortname = lstSliceProfiles.SelectedItem.ToString();
         if (shortname.ToLower().Contains("default"))
         {
             MessageBox.Show("Cannot delete default profile");
         }
         else
         {
             string fname = GetSlicingFilename(shortname);
             File.Delete(fname); // delete the file
             string pname = UVDLPApp.Instance().m_PathProfiles + UVDLPApp.m_pathsep + shortname;
             // Directory.Delete(pname, true); // no longer creating specific directories for profiles - gcode is now embedded
             PopulateProfiles();
         }
     }
     catch (Exception ex)
     {
         DebugLogger.Instance().LogError(ex.Message);
     }
 }