Exemplo n.º 1
0
        private void NextStep(object sender, RoutedEventArgs e)
        {
            IAssemblingAction action = GetNextBlock(testSequence.WorkingSpace.Robot, testSequence.WorkingSpace);

            if (action != null)
            {
                testSequence.Actions.Add(action);
                testSequence.ExecuteNext();
            }
            action = PutNextBlock(testSequence.WorkingSpace.Robot, testSequence.WorkingSpace);
            if (action != null)
            {
                testSequence.Actions.Add(action);
                testSequence.ExecuteNext();
            }

            timeText.Text = testSequence.ExecutionTime.TotalSeconds.ToString();

            WorkspaceDrawer drawer = new WorkspaceDrawer(400, 400, Color.White)
            {
                WorkspaceSize = new SizeF(1000, 1000),
                FrameColor    = Color.Gray,
                ColorTable    = testTable
            };

            drawer.Draw(testSequence.WorkingSpace, new PointF(200, 200));

            UpdateImage(drawer.Drawing);
        }
Exemplo n.º 2
0
        private void DrawWorkspace(object sender, RoutedEventArgs e)
        {
            WorkspaceDrawer drawer = new WorkspaceDrawer(400, 400, Color.White)
            {
                WorkspaceSize = new SizeF(1000, 1000),
                FrameColor    = Color.Gray,
                ColorTable    = testTable
            };

            SizeF palletSize    = new SizeF(250, 125);
            SizeF cartridgeSize = new SizeF(70, 50);

            WorkingSpace workingSpace = new WorkingSpace(new Robot(), palletSize, cartridgeSize, 10.0f);

            for (int i = 0; i < 8; ++i)
            {
                workingSpace.GetPalletSlot(i).Pallet = RandPallet(5, 5, 20, 5);
            }

            for (int i = 0; i < workingSpace.CartridgesSlotsCount; ++i)
            {
                workingSpace.GetCartridgeSlot(i).Cartridge = new ColorCartridge(NextColor(), 10);
            }

            workingSpace.GetCartridgeSlot(3).Cartridge = new ColorCartridge(NextColor(), 0);

            drawer.Draw(workingSpace, new PointF(200, 200));

            UpdateImage(drawer.Drawing);
        }
Exemplo n.º 3
0
        private void AssemblyMozaic(object sender, RoutedEventArgs e)
        {
            SizeF palletSize    = new SizeF(125, 125);
            SizeF cartridgeSize = new SizeF(70, 50);

            Robot robot = new Robot()
            {
                CatchBlockTime = TimeSpan.FromSeconds(1),
                PutBlockTime   = TimeSpan.FromSeconds(1.5),
                MovementSpeed  = 5.0f
            };

            WorkingSpace workingSpace = new WorkingSpace(robot, palletSize, cartridgeSize, 10.0f);

            for (int i = 0; i < 8; ++i)
            {
                workingSpace.GetPalletSlot(i).Pallet = new Pallet(5, 5, 20, 5);
            }

            for (int i = 0; i < workingSpace.CartridgesSlotsCount; ++i)
            {
                workingSpace.GetCartridgeSlot(i).Cartridge = new ColorCartridge(NextColor(), 10);
            }

            testSequence = new AssemblingSequence()
            {
                WorkingSpace = workingSpace,
                Actions      = new List <IAssemblingAction>()
            };


            WorkspaceDrawer drawer = new WorkspaceDrawer(400, 400, Color.White)
            {
                WorkspaceSize = new SizeF(1000, 1000),
                FrameColor    = Color.Gray,
                ColorTable    = testTable
            };

            drawer.Draw(testSequence.WorkingSpace, new PointF(200, 200));

            UpdateImage(drawer.Drawing);
        }