public void LoadPallet() { Core.Resources.Mesh mesh = Common.Meshes.Get("cube"); palletLoad = Load.Create(mesh, LoadLength, LoadHeight - euroPalletInfo.height, LoadWidth); palletLoad.Color = LoadColor; palletLoad.UserDeletable = false; palletLoad.OnSelecting += palletLoad_OnSelecting; palletLoad.Yaw = Trigonometry.PI(Trigonometry.Angle2Rad(Angle)); Group(palletLoad, new Vector3(0, (LoadHeight / 2) + 0.001f, 0)); }
private void TrackStopPoint_OnEnter(ActionPoint sender, Load load) { track.Route.Motor.Stop(); if (Tasks.Count > 0) { var currentTask = Tasks[0]; if (currentTask.TCarCycle == TCycle.Load) { IRouteStatus sourceConveyor = (IRouteStatus)currentTask.Source.Attached.Parent; sourceConveyor.TransportSection.Route.NextRoute = conveyor.TransportSection.Route; if (currentTask.Source.LocalPosition.Z == conveyor.StartFixPoint.LocalPosition.X) { conveyor.LocalYaw = Trigonometry.PI(Trigonometry.Angle2Rad(270.0f)); } else { conveyor.LocalYaw = Trigonometry.PI(Trigonometry.Angle2Rad(90.0f)); } conveyor.ThisRouteStatus.Available = RouteStatuses.Available; currentTask.Source.FixPointRouteStatus.Available = RouteStatuses.Available; currentTask.TCarCycle = TCycle.Unload; } else { if (currentTask.Destination.LocalPosition.Z == conveyor.EndFixPoint.LocalPosition.X) { if (conveyor.TransportSection.Route.Loads.Count > 0) { var loadDistance = conveyor.TransportSection.Route.Loads.First().Distance; conveyor.LocalYaw = Trigonometry.PI(Trigonometry.Angle2Rad(270.0f)); conveyor.TransportSection.Route.Loads.First().Distance = conveyor.TransportSection.Route.Length - loadDistance; } } else if (currentTask.Destination.LocalPosition.Z == conveyor.StartFixPoint.LocalPosition.X) { if (conveyor.TransportSection.Route.Loads.Count > 0) { var loadDistance = conveyor.TransportSection.Route.Loads.First().Distance; conveyor.LocalYaw = Trigonometry.PI(Trigonometry.Angle2Rad(90.0f)); conveyor.TransportSection.Route.Loads.First().Distance = conveyor.TransportSection.Route.Length - loadDistance; } } IRouteStatus destinationConveyor = (IRouteStatus)currentTask.Destination.Attached.Parent; conveyor.TransportSection.Route.NextRoute = destinationConveyor.TransportSection.Route; if (currentTask.Destination.FixPointRouteStatus.Available == RouteStatuses.Available) { conveyor.ThisRouteStatus.Available = RouteStatuses.Request; } } } }
private void AddFixPoints(string[] fixPointList, LoadDirection direction, float leftPosition, float rightPosition) { var color = direction == LoadDirection.Source ? Color.Red : Color.Blue; var fixPointType = direction == LoadDirection.Source ? FixPoint.Types.Start : FixPoint.Types.End; foreach (var fixPoint in fixPointList) { var localYaw = Trigonometry.PI(Trigonometry.Angle2Rad(90.0f)); var fixPointArray = fixPoint.Split(':'); var side = fixPointArray[0]; var name = fixPointArray.Length > 2 ? fixPointArray[2] : ""; var trackSide = string.Equals("R", side) ? rightPosition : leftPosition; if (string.Equals("R", side) && direction == LoadDirection.Source) { localYaw = Trigonometry.PI(Trigonometry.Angle2Rad(270.0f)); } if (string.Equals("L", side) && direction == LoadDirection.Destination) { localYaw = Trigonometry.PI(Trigonometry.Angle2Rad(270.0f)); } var trackPosition = TCarLength / 2 - 0.05f; // Default value to be replaced by TryParse var isFloat = float.TryParse(fixPointArray[1], System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.CreateSpecificCulture("en-GB"), out trackPosition); if (isFloat) { // Find out which fixpoint is the furthest furthestFixPoint = furthestFixPoint < trackPosition ? trackPosition : furthestFixPoint; DematicFixPoint fp = new DematicFixPoint(color, fixPointType, this); fp.Name = name; if (direction == LoadDirection.Source) { fp.OnSnapped += new FixPoint.SnappedEvent(SourceFixPoint_OnSnapped); fp.OnUnSnapped += new FixPoint.UnSnappedEvent(SourceFixPoint_OnUnSnapped); } else { fp.OnSnapped += new FixPoint.SnappedEvent(DestinationFixPoint_OnSnapped); fp.OnUnSnapped += new FixPoint.UnSnappedEvent(DestinationFixPoint_OnUnSnapped); } Add(fp); fp.LocalPosition = new Vector3(-trackPosition, 0, trackSide); fp.LocalYaw = localYaw; // Label Text3D label = new Text3D(Color.Yellow, 0.08f, 0.1f, new Font(FontFamily.GenericSansSerif, 1.0f)); label.Text = name; Add(label); label.LocalPosition = new Vector3(-trackPosition + 0.08f, 0, trackSide - 0.02f); label.Pitch = Trigonometry.PI(Trigonometry.Angle2Rad(90.0f)); } } }
public override void Reset() { base.Reset(); busy = false; Tasks.Clear(); track.Route.Motor.Forward(); track.Route.Motor.Stop(); trackStopPoint.Distance = 0; trackLoad.Distance = 0; conveyor.LocalPosition = new Vector3(0, 0, 0); // Move the platform to the default position (instant, not using timers) conveyor.TransportSection.Route.ClearLoads(); conveyor.ThisRouteStatus.Available = RouteStatuses.Available; conveyor.TransportSection.Route.NextRoute = null; conveyor.LocalYaw = Trigonometry.PI(Trigonometry.Angle2Rad(90.0f)); conveyor.Reset(); }
private void StackTray() { var createdloads = 1; var loadYaw = Trigonometry.PI(Trigonometry.Angle2Rad(Angle)); IEmulationController controller = Core.Assemblies.Assembly.Items.Values.ToList().FirstOrDefault(x => x is IEmulationController) as IEmulationController; Tray load; while (createdloads < trayInfo.TrayStacks) { if (controller != null) { load = controller.GetTray(null, 0, TrayStatus.Empty); } else { TrayInfo info = new TrayInfo { length = Length, height = Height, width = Width, color = Color, InStack = true, Status = TrayStatus.Empty, filename = Mesh, TrayStacks = 1, }; load = new Tray(info); } load.Deletable = false; load.Yaw = loadYaw; load.OnSelecting += trayLoad_OnSelecting; var stackY = (Height + 0.005f) * createdloads; // create empty space between loads Group(load, new Vector3(0, stackY, 0)); createdloads++; stackedTrays.Add(load); } }
private void StackPallet() { var createdloads = 1; var loadYaw = Trigonometry.PI(Trigonometry.Angle2Rad(Angle)); IEmulationController controller = Core.Assemblies.Assembly.Items.Values.ToList().FirstOrDefault(x => x is IEmulationController) as IEmulationController; EuroPallet load; while (createdloads < palletStacks) { if (controller != null) { load = controller.GetEuroPallet(null, 0, PalletStatus.Empty); } else { EuroPalletInfo info = new EuroPalletInfo { length = Length, height = Height, width = Width, color = Color.Peru, InStack = true, Status = PalletStatus.Empty, filename = Mesh, }; load = new EuroPallet(info); } //EuroPallet load = new EuroPallet(info); load.UserDeletable = false; load.Yaw = loadYaw; load.OnSelecting += palletLoad_OnSelecting; var stackY = (Height + 0.005f) * createdloads; // create empty space between loads Group(load, new Vector3(0, stackY, 0)); createdloads++; stackedPallets.Add(load); } }
public TCar(TCarInfo info) : base(info) { tCarInfo = info; info.height = info.height * 2; // assembley is placed at height/2 so that it comes out at height ?!!?? Core.Environment.Scene.OnLoaded += Scene_OnLoaded; var offCentre = TCarWidth / 2 - TCarWidth; // Left track used to move the load track = new StraightTransportSection(Color.Gray, TCarLength, 0.05f, 0.05f); Add(track); track.Route.Motor.Speed = 1; // m/s ? track.LocalPosition = new Vector3(-TCarLength / 2, -0.05f, offCentre); // Load Vehicle trackLoad = Core.Loads.Load.CreateBox(0.1f, 0.1f, 0.1f, Color.BlueViolet); trackLoad.Embedded = true; trackLoad.Deletable = false; track.Route.Add(trackLoad); trackLoad.OnPositionChanged += TrackLoad_OnPositionChanged; trackLoad.Stop(); trackLoad.Visible = false; // Right track (visual only) trackRight = new Cube(Color.Gray, TCarLength, 0.05f, 0.05f); Add(trackRight); trackRight.LocalPosition = new Vector3(-TCarLength / 2, -0.05f, -offCentre); // Action point for lift rail trackStopPoint = track.Route.InsertActionPoint(0); trackStopPoint.Color = Color.Black; trackStopPoint.Visible = false; trackStopPoint.OnEnter += TrackStopPoint_OnEnter; // Conveyor PalletStraightInfo straightInfo = new PalletStraightInfo { ConveyorType = PalletConveyorType.Roller, thickness = 0.05f, spacing = 0.1f, width = ConveyorWidth, length = TCarWidth, speed = 0.3f, color = tCarInfo.color, }; conveyor = new PalletStraight(straightInfo); conveyor.LineReleasePhotocell.OnPhotocellStatusChanged += LineReleasePhotocell_OnPhotocellStatusChanged; conveyor.ThisRouteStatus.OnRouteStatusChanged += ThisRouteStatus_OnRouteStatusChanged; conveyor.Entering.Name = "EnterPoint"; conveyor.Leaving.Name = "ExitPoint"; conveyor.StartFixPoint.Visible = false; conveyor.EndFixPoint.Visible = false; Add(conveyor); conveyor.LocalPosition = new Vector3(-conveyor.Width / 2, 0, 0); conveyor.LocalYaw = Trigonometry.PI(Trigonometry.Angle2Rad(90.0f)); SetupFixPoints(); Tasks.CollectionChanged += Tasks_CollectionChanged; Reset(); }