public static BasePalletData GetPalletControllerPalletData() { BasePalletData PalletData = new BasePalletData(); IPalletController controller = Core.Assemblies.Assembly.Items.Values.ToList().FirstOrDefault(x => x is IPalletController) as IPalletController; if (controller != null) { PalletData = controller.GetPalletData(); } else if (!SentPalletPalletDataMessage) { SentPalletPalletDataMessage = true; Log.Write("Did not find valid controller on model to create specific PalletData, add valid Pallet controller to model"); } return(PalletData); }
public static EuroPallet FeedEuroPallet(ITransportSection transportSection, float distance, BasePalletData palletData, PalletStatus palletStatus) { EuroPallet PalletLoad; IEmulationController controller = Core.Assemblies.Assembly.Items.Values.ToList().FirstOrDefault(x => x is IEmulationController) as IEmulationController; if (controller != null) { PalletLoad = controller.GetEuroPallet(transportSection.Route, 0, palletStatus); if (PalletLoad != null) //It is not necesary to implement this just return null Pallet load from the controller and a standard load will be created { return(PalletLoad); } } try { EuroPalletInfo palletInfo = new EuroPalletInfo(); palletInfo.color = Color.Peru; palletInfo.Status = palletStatus; palletInfo.filename = EuroPallet.Mesh; //LoadHeight includes the height of the pallet (145mm) palletInfo.LoadHeight = 2.2f; palletInfo.LoadWidth = 0.9f; palletInfo.LoadLength = 1.3f; //Set the dimensions of a EuroPallet (This is the standard size) palletInfo.length = 1.2f; palletInfo.width = 0.8f; palletInfo.height = 0.14f; // Actual size is 0.144f but reduced so visible space can be added in stack (0.005f space) EuroPallet palletLoad = new EuroPallet(palletInfo); //palletLoad.Part = (RigidLoadPart)new PalletPart(0.008f, palletInfo.color, palletInfo.length, palletInfo.height, palletInfo.width, true, palletInfo.density, Pallet_Load.Size(PalletType.EuroPallet), palletInfo.rigid); palletLoad.Pallet_Data = palletData; palletLoad.Pallet_Data.Weight = 60.0f; transportSection.Route.Add(palletLoad, distance); Load.Items.Add(palletLoad); string SSCCBarcode = GetSSCCBarcode(); if (SSCCBarcode != "") { palletLoad.SSCCBarcode = SSCCBarcode; palletLoad.Identification = SSCCBarcode; } return(palletLoad); } catch (Exception se) { Core.Environment.Log.Write(se); Core.Environment.Scene.Pause(); return(null); } }