Example #1
0
        public void UpdateConfigurations(Calibration calibration, PrinterSizeProfile sizeprofile, bool bUseSpecialPrintTestPoints)
        {
            entire_z_height_offset    = calibration.ENTIRE_Z_HEIGHT_OFFSET;
            corner_height_back_right  = calibration.CORNER_HEIGHT_BACK_RIGHT + calibration.CORNER_HEIGHT_BACK_RIGHT_OFFSET;
            corner_height_back_left   = calibration.CORNER_HEIGHT_BACK_LEFT + calibration.CORNER_HEIGHT_BACK_LEFT_OFFSET;
            corner_height_front_left  = calibration.CORNER_HEIGHT_FRONT_LEFT + calibration.CORNER_HEIGHT_FRONT_LEFT_OFFSET;
            corner_height_front_right = calibration.CORNER_HEIGHT_FRONT_RIGHT + calibration.CORNER_HEIGHT_FRONT_RIGHT_OFFSET;
            g32_version = calibration.G32_VERSION;
            RectCoordinates rectCoordinates = !bUseSpecialPrintTestPoints || !sizeprofile.G32ProbePoints.ContainsKey(byte.MaxValue) ? (!sizeprofile.G32ProbePoints.ContainsKey(g32_version) ? sizeprofile.G32ProbePoints.First <KeyValuePair <int, RectCoordinates> >().Value : sizeprofile.G32ProbePoints[g32_version]) : sizeprofile.G32ProbePoints[byte.MaxValue];

            backRight  = new Vector(rectCoordinates.right, rectCoordinates.back, corner_height_back_right);
            backLeft   = new Vector(rectCoordinates.left, rectCoordinates.back, corner_height_back_left);
            frontLeft  = new Vector(rectCoordinates.left, rectCoordinates.front, corner_height_front_left);
            frontRight = new Vector(rectCoordinates.right, rectCoordinates.front, corner_height_front_right);
            center     = new Vector(sizeprofile.HomeLocation.x, sizeprofile.HomeLocation.y, 0.0f);
        }
        public static List <string> GenerateEndGCode(JobDetails jobdetails, InternalPrinterProfile printerProfile, bool retract)
        {
            var stringList = new List <string>();
            InitialPrintPreProcessorData initialPrint         = jobdetails.jobParams.preprocessor.initialPrint;
            PrinterSizeProfile           printerSizeConstants = printerProfile.PrinterSizeConstants;

            stringList.Add("G91");
            if (retract)
            {
                var primeAmount = (float)initialPrint.PrimeAmount;
                var num1        = (float)Math.Round(0.25 * primeAmount);
                var num2        = primeAmount - num1;
                var num3        = 1800f;
                stringList.Add(PrinterCompatibleString.Format("G0 X5 Y5 E{1} F{0}", num3, (float)-(double)num1));
                var num4 = 360f;
                stringList.Add(PrinterCompatibleString.Format("G0 E{1} F{0}", num4, (float)-(double)num2));
            }
            stringList.Add("M104 S0");
            if (printerProfile.AccessoriesConstants.HeatedBedConstants.HasBuiltinHeatedBed && jobdetails.jobParams.options.use_heated_bed)
            {
                stringList.Add("M140 S0");
            }

            if (jobdetails.bounds.max.z > (double)printerSizeConstants.BoxTopLimitZ)
            {
                BoundingBox bounds = printerSizeConstants.WarningRegion.bounds_list[printerSizeConstants.WarningRegion.bounds_list.Count - 1];
                if (jobdetails.bounds.max.z + 1.0 < bounds.max.z)
                {
                    var num = 90f;
                    stringList.Add(PrinterCompatibleString.Format("G0 Z1 F{0}", (object)num));
                }
                var num1 = 1800f;
                stringList.Add("G90");
                stringList.Add(PrinterCompatibleString.Format("G0 X{0} Y{1} F{2}", printerSizeConstants.BackCornerPositionBoxTop.x, printerSizeConstants.BackCornerPositionBoxTop.y, num1));
            }
            else
            {
                var num1 = 90f;
                stringList.Add(PrinterCompatibleString.Format("G0 Z3 F{0}", (object)num1));
                stringList.Add("G90");
                var num2 = 1800f;
                stringList.Add(PrinterCompatibleString.Format("G0 X{0} Y{1} F{2}", printerSizeConstants.BackCornerPosition.x, printerSizeConstants.BackCornerPosition.y, num2));
            }
            stringList.Add("M18");
            return(stringList);
        }
Example #3
0
        public void SizeFromPrinterProfile(PrinterSizeProfile sizeProfile)
        {
            PrinterModelCaseType = sizeProfile.case_type;
            M3D.Model.Utils.Vector3 ext = PrinterModel.ShellModel.Ext;
            PrinterTypeAdjustments.Scale.X      = sizeProfile.shell_size.x / ext.X;
            PrinterTypeAdjustments.Scale.Y      = sizeProfile.shell_size.y / ext.Y;
            PrinterTypeAdjustments.Scale.Z      = sizeProfile.shell_size.z / ext.X;
            PrinterTransformation.Translation.Z = PrinterModel.ZOffset;
            ObjectToPrinterSpace.Translation.X  = sizeProfile.printBedSize.x / -2f;
            ObjectToPrinterSpace.Translation.Y  = sizeProfile.printBedSize.y / -2f;
            ObjectToPrinterSpace.Translation.Z  = (float)(sizeProfile.shell_size.z / -2.0 + sizeProfile.fluff_height * (double)PrinterTypeAdjustments.Scale.Z);
            GridSizeAdjustments.Scale.X         = sizeProfile.printBedSize.x / 100f;
            GridSizeAdjustments.Scale.Y         = sizeProfile.printBedSize.y / 100f;
            PrinterBedWidth  = sizeProfile.printBedSize.x;
            PrinterBedLength = sizeProfile.printBedSize.y;
            SetPrintableExts(sizeProfile.printBedSize.x, sizeProfile.printBedSize.y, 110f);
            PrinterCenter = new M3D.Model.Utils.Vector3(sizeProfile.HomeLocation.x, sizeProfile.HomeLocation.y, 0.0f);
            var num = PrinterModel.GUICaseSize / sizeProfile.shell_size.z;

            PrinterTransformation.Scale = new M3D.Model.Utils.Vector3(num, num, num);
            PrinterBoundsConst          = sizeProfile;
            CreateBoundsGeometry(ObjectToPrinterSpace);
        }
Example #4
0
        private void RaiseExtruder(IAsyncCallResult ar)
        {
            var asyncState = ar.AsyncState as PrinterObject;

            if (asyncState == null)
            {
                MainWindow.ResetToStartup();
            }

            if (ar.CallResult != CommandResult.Success)
            {
                messagebox.AddMessageToQueue("There was a problem sending commands to the printer. Please try again.");
                MainWindow.ResetToStartup();
            }
            else if (!asyncState.Info.extruder.Z_Valid)
            {
                messagebox.AddMessageToQueue("Sorry. The extruder can't move to a safe position for heating because the Z location has not be calibrated.", PopupMessageBox.MessageBoxButtons.OK);
                MainWindow.ResetToStartup();
            }
            else
            {
                var fastestPossible = asyncState.MyPrinterProfile.SpeedLimitConstants.FastestPossible;
                PrinterSizeProfile printerSizeConstants = asyncState.MyPrinterProfile.PrinterSizeConstants;
                var num1       = asyncState.Info.extruder.ishomed == Trilean.True ? 1 : 0;
                var num2       = asyncState.Info.extruder.position.pos.z;
                var stringList = new List <string>();
                if (num1 == 0)
                {
                    if (num2 > (double)printerSizeConstants.BoxTopLimitZ)
                    {
                        stringList.Add("G90");
                        stringList.Add(PrinterCompatibleString.Format("G0 Z{0} F{1}", printerSizeConstants.BoxTopLimitZ, fastestPossible));
                        num2 = printerSizeConstants.BoxTopLimitZ;
                    }
                    stringList.Add("G28");
                    stringList.Add("M114");
                }
                Manage3DInkMainWindow.PageID nextPage;
                if (CurrentDetails.current_spool.filament_location == FilamentSpool.Location.Internal)
                {
                    var boxTopLimitZ = printerSizeConstants.BoxTopLimitZ;
                    stringList.Add("G90");
                    stringList.Add(PrinterCompatibleString.Format("G0 X{0} Y{1} F{2} Z{3}", printerSizeConstants.BackCornerPosition.x, printerSizeConstants.BackCornerPosition.y, fastestPossible, boxTopLimitZ));
                    nextPage = CurrentDetails.mode != Manage3DInkMainWindow.Mode.RemoveFilament ? Manage3DInkMainWindow.PageID.Page14_InternalSpoolInstructions : Manage3DInkMainWindow.PageID.Page16_RemoveInternalSpoolInstructions;
                }
                else
                {
                    var   num3 = num2 > 15.0 ? num2 : 15f;
                    float x;
                    float y;
                    if (asyncState.IsPausedorPausing)
                    {
                        if (num3 > (double)printerSizeConstants.BoxTopLimitZ)
                        {
                            x = printerSizeConstants.BackCornerPositionBoxTop.x;
                            y = printerSizeConstants.BackCornerPositionBoxTop.y;
                        }
                        else
                        {
                            x = printerSizeConstants.BackCornerPosition.x;
                            y = printerSizeConstants.BackCornerPosition.y;
                        }
                    }
                    else
                    {
                        x = printerSizeConstants.HomeLocation.x;
                        y = printerSizeConstants.HomeLocation.y;
                    }
                    stringList.Add("G90");
                    stringList.Add(PrinterCompatibleString.Format("G0 X{0} Y{1} F{2} Z{3}", x, y, fastestPossible, num3));
                    nextPage = Manage3DInkMainWindow.PageID.Page1_HeatingNozzle;
                }
                var num4 = (int)asyncState.SendManualGCode(new M3D.Spooling.Client.AsyncCallback(MainWindow.GotoPageAfterOperation), new Manage3DInkMainWindow.PageAfterLockDetails(asyncState, nextPage, CurrentDetails), stringList.ToArray());
            }
        }
Example #5
0
 public void UpdateConfigurations(Calibration calibration, PrinterSizeProfile sizeprofile)
 {
     UpdateConfigurations(calibration, sizeprofile, false);
 }