예제 #1
0
 private void glControl1_KeyDown(object sender, KeyEventArgs e)
 {
     // if the delete key is pressed, deleted the currently selected object
     if (e.KeyCode == Keys.Delete)
     {
         UVDLPApp.Instance().RemoveCurrentModel();
     }
     if ((e.KeyCode == Keys.Z) && (e.Modifiers == Keys.Control))
     {
         UVDLPApp.Instance().m_undoer.Undo();
     }
     if (e.KeyCode == Keys.ShiftKey)
     {
         if (m_movingobjectmode == false)
         {
             m_movingobjectmode = true;
             Object3d obj = UVDLPApp.Instance().SelectedObject;
             if (obj != null)
             {
                 m_savex = obj.m_center.x;
                 m_savey = obj.m_center.y;
                 //m_savez = obj.m_center.z;
                 if (obj.tag == Object3d.OBJ_SUPPORT)
                 {
                     obj.CalcMinMaxes();
                     m_saveh = obj.m_max.z - obj.m_min.z;
                 }
             }
         }
     }
 }
예제 #2
0
 private void glControl1_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.ShiftKey)
     {
         m_movingobjectmode = false;
         // update object info
         UpdateObjectInfo();
         //SetupSceneTree();
         Object3d obj = UVDLPApp.Instance().SelectedObject;
         if (obj != null)
         {
             m_savex = obj.m_center.x - m_savex;
             m_savey = obj.m_center.y - m_savey;
             //m_savez = obj.m_center.z - m_savez;
             UVDLPApp.Instance().m_undoer.SaveTranslation(obj, m_savex, m_savey, 0);
             if (obj.tag == Object3d.OBJ_SUPPORT)
             {
                 obj.CalcMinMaxes();
                 m_saveh = (obj.m_max.z - obj.m_min.z) / m_saveh;
                 UVDLPApp.Instance().m_undoer.SaveScale(obj, 1, 1, m_saveh);
                 UVDLPApp.Instance().m_undoer.LinkToPrev();
             }
         }
     }
 }
예제 #3
0
 private void slicefunc()
 {
     try
     {
         //determine the number of slices
         m_obj.FindMinMax();
         // I think I should calculate the number of slices from the world 0 position, not just the bottom of the object
         int numslices = (int)((m_obj.m_max.z - m_obj.m_min.z) / m_sf.m_config.ZThick);
         // I should start slicing at Wz 0, not Oz 0
         double curz = (double)m_obj.m_min.z;
         RaiseSliceEvent(eSliceEvent.eSliceStarted, 0, numslices);
         DebugLogger.Instance().LogRecord("Slicing started");
         int c = 0;
         m_obj.CalcMinMaxes();
         m_obj.ClearCached();
         for (c = 0; c < numslices; c++)
         {
             // check for cancelation
             if (m_cancel)
             {
                 isslicing = false;
                 m_cancel  = false;
                 RaiseSliceEvent(eSliceEvent.eSliceCancelled, c, numslices);
                 return;
             }
             //get a list of polygons at this slice z height that potentially intersect
             ArrayList lstply = GetZPolys(m_obj, curz);
             //iterate through all the polygons and generate x/y line segments at this 3d z level
             ArrayList lstintersections = GetZIntersections(lstply, curz);
             // move the slice for the next layer
             curz += m_sf.m_config.ZThick;
             //create a new slice
             Slice sl = new Slice();
             // Set the list of intersections
             sl.m_segments = lstintersections;
             // add the slice to slicefile
             m_sf.m_slices.Add(sl);
             //raise an event to say we've finished a slice
             RaiseSliceEvent(eSliceEvent.eLayerSliced, c, numslices);
         }
         RaiseSliceEvent(eSliceEvent.eSliceCompleted, c, numslices);
         DebugLogger.Instance().LogRecord("Slicing Completed");
         isslicing = false;
     }
     catch (Exception ex)
     {
         DebugLogger.Instance().LogRecord(ex.Message);
         //RaiseSliceEvent(eSliceEvent.eSliceCancelled,0,0);
         m_cancel = true;
     }
 }