public RTLineMoveCommand(Vector3 delta, Vector3 compensation, RTMovementOptions opts, MachineParameters config)
 {
     this.config        = config;
     this.Delta         = delta;
     this.Compenstation = compensation;
     this.Options       = opts;
     this.DirStart      = this.DirEnd = Vector3.Normalize(this.Delta);
     FindPhysicalParameters();
     Length = Delta.Length();
 }
 public RTLineMoveCommand(decimal dx, decimal dy, decimal dz, Vector3 compensation, RTMovementOptions opts, MachineParameters config)
 {
     this.config        = config;
     this.Delta         = new Vector3(dx, dy, dz);
     this.Compenstation = compensation;
     this.Options       = opts;
     this.DirStart      = this.DirEnd = Vector3.Normalize(this.Delta);
     FindPhysicalParameters();
     Length = PhysicalDelta.Length();
 }
Ejemplo n.º 3
0
 private void Setup(Vector3 delta, Vector3 compensation, bool ccw, AxisState.Plane plane, RTMovementOptions opts, MachineParameters config)
 {
     Plane        = plane;
     Delta        = delta;
     Compensation = compensation;
     CCW          = ccw;
     Config       = config;
     Options      = opts;
     DeltaProj    = VectorPlaneProj(Delta + Compensation, Plane);
     Height       = VectorPlaneNormalProj(Delta + Compensation, Plane);
 }
Ejemplo n.º 4
0
        public ReadStatusMachine(MachineParameters config, IRTSender rtSender, int updateT, int timeoutT, int maxretry)
        {
            this.maxretry = maxretry;
            this.updateT  = updateT;
            this.timeoutT = timeoutT;

            this.config   = config;
            this.rtSender = rtSender;

            updateWait = new EventWaitHandle(false, EventResetMode.AutoReset);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="DefinitionBinder"/> class.
        /// </summary>
        /// <externalUnit cref="BallotList"/>
        /// <externalUnit cref="ballots"/>
        /// <externalUnit cref="CardList"/>
        /// <externalUnit cref="cards"/>
        /// <externalUnit cref="ContestList"/>
        /// <externalUnit cref="contests"/>
        /// <externalUnit cref="ElectionParameterList"/>
        /// <externalUnit cref="electionParameters"/>
        /// <externalUnit cref="MachineOptionList"/>
        /// <externalUnit cref="machineOptions"/>
        /// <externalUnit cref="MachineParameters"/>
        /// <externalUnit cref="machineParams"/>
        /// <revision revisor="dev11" date="12/16/2008" version="1.0.0.0">
        ///     Member Created
        /// </revision>
        public DefinitionBinder()
        {
            this.ballots        = new BallotList();
            this.cards          = new CardList();
            this.faces          = new FaceList();
            this.contests       = new ContestList();
            this.machineOptions = new MachineOptionList();
            this.machineParams  = new MachineParameters();
            this.machineParams.ParameterFiles = new ParameterFileList();
            this.electionParameters           = new ElectionParameterList();

            this.faceMap = new Dictionary <string, Face>();
        }
Ejemplo n.º 6
0
 public ProgramBuilder_Excellon(ProgramBuilder builder,
                                IMachine machine,
                                IMillManager toolManager,
                                MachineParameters config,
                                IRTSender rtSender,
                                IModbusSender modbusSender)
 {
     this.builder      = builder;
     this.machine      = machine;
     this.toolManager  = toolManager;
     this.config       = config;
     this.rtSender     = rtSender;
     this.modbusSender = modbusSender;
 }
Ejemplo n.º 7
0
 private CNCState(MachineParameters config,
                  AxisState axisState,
                  DrillingState drillingState,
                  SyncToolState syncToolState,
                  IReadOnlyDictionary <int, IToolState> ts,
                  VarsState vs)
 {
     AxisState     = axisState;
     toolStates    = ts.ToDictionary(entry => entry.Key, entry => entry.Value);
     DrillingState = drillingState;
     SyncToolState = syncToolState;
     VarsState     = vs;
     this.config   = config;
 }
Ejemplo n.º 8
0
        public RTArcMoveCommand(Vector3 delta, Vector3 compensation, decimal r, bool ccw, AxisState.Plane plane,
                                RTMovementOptions opts, MachineParameters config)
        {
            Setup(delta, compensation, ccw, plane, opts, config);

            R      = Math.Abs(r);
            bigArc = (r < 0);
            decimal d   = DeltaProj.Length();
            decimal hcl = (decimal)Math.Sqrt((double)(R * R - d * d / 4));

            if (ccw && !bigArc || !ccw && bigArc)
            {
                hcl = -hcl;
            }
            startToCenterProj = DeltaProj / 2 + Vector2.Normalize(DeltaProj.Right()) * hcl;
            endToCenterProj   = startToCenterProj - DeltaProj;

            FinalSetup();
        }
Ejemplo n.º 9
0
        // next button
        private void button3_Click(object sender, EventArgs e)
        {
            Printerinfo       pnt = new Printerinfo();
            MachineParameters MPS;

            pnt.Name = textBox1.Text;
            if (listBox1.Items.Count > 0)
            {
                pnt.Materials = new List <string>(listBox1.Items.Count);
                for (int i = 0; i < listBox1.Items.Count; i++)
                {
                    pnt.Materials.Add(listBox1.Items[i].ToString());
                }
                double[] volume = new double[3];
                volume[0]  = Convert.ToInt32(textBox2.Text);
                volume[1]  = Convert.ToInt32(textBox5.Text);
                volume[2]  = Convert.ToInt32(textBox6.Text);
                pnt.Volume = volume.ToList <double>();
                MPS        = new MachineParameters
                {
                    AMType            = comboBox2.Text,
                    MinFeatureSize    = Convert.ToDouble(textBox3.Text),
                    MinLayerThickness = Convert.ToDouble(textBox4.Text)
                };
                pnt.BasicInfo = MPS;
                pnts_new.printer.Add(pnt);
                textBox1.Text  = "";
                textBox2.Text  = "";
                textBox5.Text  = "";
                textBox6.Text  = "";
                comboBox1.Text = "";
                comboBox2.Text = "";
                textBox3.Text  = "";
                textBox4.Text  = "";
                listBox1.Items.Clear();
                textBox1.Focus();
            }
            else
            {
                MessageBox.Show("please fill the empty space");
            }
        }
Ejemplo n.º 10
0
        public void SerializeMachineParametersTest()
        {
            var machineParameters =
                MachineParameters.FromXml <MachineParameters>(
                    this.GetMachineParametersText());

            Assert.IsNotNull(machineParameters);
            Assert.AreEqual(
                5,
                machineParameters.ParameterFiles.Count,
                "Wrong number of parameter files found.");

            string machineParamXml =
                MachineParameters.Serialize(machineParameters);

            Assert.AreEqual(
                this.GetMachineParametersText(),
                machineParamXml,
                machineParamXml);
        }
Ejemplo n.º 11
0
        public RTArcMoveCommand(Vector3 delta, Vector3 compensation, Vector3 startToCenter, bool ccw, AxisState.Plane plane,
                                RTMovementOptions opts, MachineParameters config)
        {
            Setup(delta, compensation, ccw, plane, opts, config);

            startToCenterProj = VectorPlaneProj(startToCenter, Plane);
            endToCenterProj   = startToCenterProj - DeltaProj;
            decimal nd = Vector2.Cross(DeltaProj, startToCenterProj);

            if (nd > 0 && CCW || nd < 0 && !CCW)
            {
                bigArc = false;
            }
            else
            {
                bigArc = true;
            }
            R = startToCenter.Length();

            FinalSetup();
        }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            var         localAddr = IPAddress.Parse("0.0.0.0");
            int         port      = 8888;
            TcpListener tcpServer = new TcpListener(localAddr, port);

            tcpServer.Start();

            var outputStream = new MemoryStream();

            var config                = new MachineParameters();
            var rtSender              = new EmulationRTSender(outputStream);
            var modbusSender          = new EmulationModbusSender(outputStream);
            var spindleCommandFactory = new N700ESpindleToolFactory();

            bool run = true;

            do
            {
                TcpClient     tcpClient     = tcpServer.AcceptTcpClient();
                NetworkStream stream        = tcpClient.GetStream();
                var           machineServer = new GCodeServer.GCodeServer(rtSender, modbusSender, spindleCommandFactory, config, stream, stream);
                try
                {
                    run = machineServer.Run();
                }
                catch (System.Exception e)
                {
                    Console.WriteLine("Exception: {0}", e);
                }

                machineServer.Dispose();
                stream.Close();
                tcpClient.Close();
            } while (run);
            rtSender.Dispose();
            tcpServer.Stop();
        }
        public ProgramBuilder(GCodeMachine.GCodeMachine machine,
                              IStateSyncManager stateSyncManager,
                              IRTSender rtSender,
                              IModbusSender modbusSender,
                              IMillManager toolManager,
                              MachineParameters config,
                              IReadOnlyDictionary <int, IDriver> tool_drivers)
        {
            this.stateSyncManager = stateSyncManager;
            this.machine          = machine;
            this.rtSender         = rtSender;
            this.modbusSender     = modbusSender;
            this.toolManager      = toolManager;
            this.config           = config;

            moveFeedLimiter = new MoveFeedLimiter(this.config);
            optimizer       = new MoveOptimizer(this.config);
            timeCalculator  = new ExpectedTimeCalculator();
            axisStateStack  = new Stack <AxisState.Parameters>();
            toolsPending    = new List <int>();

            this.tool_drivers = tool_drivers;
        }
Ejemplo n.º 14
0
 public CNCState(MachineParameters config)
 {
     AxisState = new AxisState
     {
         Feed = config.fastfeed / 60m,
     };
     DrillingState = new DrillingState();
     SyncToolState = new SyncToolState();
     toolStates    = new Dictionary <int, IToolState>();
     VarsState     = new VarsState();
     foreach (var item in config.tools)
     {
         int id     = item.Key;
         var driver = item.Value;
         if (driver is N700E_Tool)
         {
             toolStates[id] = new SpindleState();
         }
         else if (driver is GPIO_Tool)
         {
             toolStates[id] = new BinaryState();
         }
         else if (driver is RawModbus_Tool)
         {
             toolStates[id] = new BinaryState();
         }
         else if (driver is Dummy_Tool)
         {
             toolStates[id] = null;
         }
         else
         {
             throw new ArgumentOutOfRangeException();
         }
     }
 }
 public MoveOptimizer(MachineParameters config)
 {
     this.config = config;
 }
 public MoveFeedLimiter(MachineParameters config)
 {
     this.config = config;
 }