コード例 #1
0
        /// <summary>
        /// Takes manual input parameters for a motor print with movement command and outputs the command to the serial port.
        /// </summary>
        /// <param name="xDistance"></param>
        /// <param name="yDistance"></param>
        /// <param name="zDistance"></param>
        /// <param name="eDispensePerDistance"></param>
        public void ProcessManualMotorPrintWithMovementCommand(double xDistance, double yDistance, double zDistance, double eDispensePerDistance)
        {
            MotorizedPrintheadTypeModel motorizedPrintheadTypeModel = (MotorizedPrintheadTypeModel)_printerModel.FindPrinthead(_realTimeStatusDataModel.ActivePrintheadModel.Name).PrintheadTypeModel;
            double    emmPerStep         = motorizedPrintheadTypeModel.MmPerStep;
            double    xmmPerStep         = (xDistance != 0) ? _printerModel.AxisModelList[0].MmPerStep : double.MaxValue;
            double    ymmPerStep         = (yDistance != 0) ? _printerModel.AxisModelList[1].MmPerStep : double.MaxValue;
            AxisModel zAxisModel         = _printerModel.FindAxis(_realTimeStatusDataModel.ZRealTimeStatusAxisModel.Name);
            double    zmmPerStep         = (zDistance != 0) ? _printerModel.FindAxis(zAxisModel.Name).MmPerStep : double.MaxValue;
            bool      zDirectionInverted = (zAxisModel != null) ? zAxisModel.IsDirectionInverted : false;

            double unused      = 0;
            string printString = GCodeLinesConverter.GCodeLinesListToString(
                WriteG00.WriteMotorizedContinuousPrint(emmPerStep, xmmPerStep, ymmPerStep, zmmPerStep,
                                                       eDispensePerDistance, xDistance, yDistance, zDistance,
                                                       _printerModel.AxisModelList[0].IsDirectionInverted, _printerModel.AxisModelList[1].IsDirectionInverted, zDirectionInverted, motorizedPrintheadTypeModel.IsDirectionInverted,
                                                       ref unused, ref unused, ref unused, ref unused,
                                                       null));

            _serialCommunicationOutgoingMessagesModel.QueueNextProspectiveOutgoingMessage(printString);
        }
コード例 #2
0
        /// <summary>
        /// Record the parameters from a Set Motorized Printhead command.
        /// </summary>
        /// <param name="printheadName"></param>
        /// <param name="maxSpeed"></param>
        /// <param name="acceleration"></param>
        public void RecordSetMotorizedPrinthead(string printheadName, double maxSpeed, double acceleration)
        {
            _activePrintheadType = PrintheadType.Motorized;

            MotorizedPrintheadTypeModel motorizedPrintheadTypeModel = (MotorizedPrintheadTypeModel)_printerModel.FindPrinthead(printheadName).PrintheadTypeModel;
            double mmPerStep = motorizedPrintheadTypeModel.MmPerStep;

            //Max speed is read as steps / s and acceleration is read as steps / s2.
            //These parameters are converted to this program's convention of mm / s and mm / s2.
            double convertedMaxSpeed     = maxSpeed * mmPerStep;
            double convertedAcceleration = acceleration * mmPerStep;

            _activePrintheadModel = new RealTimeStatusMotorizedPrintheadModel(printheadName, convertedMaxSpeed, convertedAcceleration);

            //Notify other classes.
            OnRecordSetMotorizedPrintheadExecuted(printheadName);
        }