public ILayer2D BuildLayer(Packable packable, Vector2D dimContainer, LayerDesc layerDesc, Vector2D actualDimensions, double minSpace) { ILayer2D layer = null; LayerPattern pattern = null; if (packable.IsBrick) { LayerDescBox layerDescBox = layerDesc as LayerDescBox; // instantiate layer layer = new Layer2D(packable.OuterDimensions, dimContainer, layerDescBox.PatternName, layerDescBox.AxisOrtho, layerDesc.Swapped) { ForcedSpace = minSpace }; // get layer pattern pattern = LayerPatternBox.GetByName(layerDesc.PatternName); } else if (packable.IsCylinder) { CylinderProperties cylProperties = packable as CylinderProperties; layer = new Layer2DCyl(cylProperties.RadiusOuter, cylProperties.Height, dimContainer, layerDesc.Swapped); // get layer pattern pattern = LayerPatternCyl.GetByName(layerDesc.PatternName); } else { throw new EngineException(string.Format("Unexpected packable {0} (Type = {1})", packable.Name, packable.GetType().ToString())); } pattern.GenerateLayer( layer , layer.Swapped ? actualDimensions.Y : actualDimensions.X , layer.Swapped ? actualDimensions.X : actualDimensions.Y ); return(layer); }
public Layer2D BuildLayer(Vector3D dimBox, Vector2D dimContainer, LayerDesc layerDesc, Vector2D actualDimensions) { // instantiate layer Layer2D layer = new Layer2D(dimBox, dimContainer, layerDesc.AxisOrtho, false); // get layer pattern LayerPattern pattern = LayerPattern.GetByName(layerDesc.PatternName); // build layer pattern.GenerateLayer(layer, actualDimensions.X, actualDimensions.Y); return(layer); }
public Layer2D BuildLayer(Vector3D dimBox, Vector2D dimContainer, LayerDesc layerDesc) { // instantiate layer Layer2D layer = new Layer2D(dimBox, dimContainer, layerDesc.AxisOrtho, false); // get layer pattern LayerPattern pattern = LayerPattern.GetByName(layerDesc.PatternName); // dimensions double actualLength = 0.0, actualWidth = 0.0; if (!pattern.GetLayerDimensionsChecked(layer, out actualLength, out actualWidth)) { return(null); } pattern.GenerateLayer(layer, actualLength, actualWidth); return(layer); }
public bool GetDimensions(List <LayerDesc> layers, Vector3D dimBox, Vector2D dimContainer, out Vector2D actualDimensions) { actualDimensions = new Vector2D(); foreach (LayerDesc layerDesc in layers) { // instantiate layer Layer2D layer = new Layer2D(dimBox, dimContainer, layerDesc.AxisOrtho, false); // get layer pattern LayerPattern pattern = LayerPattern.GetByName(layerDesc.PatternName); // dimensions double actualLength = 0.0, actualWidth = 0.0; if (!pattern.GetLayerDimensionsChecked(layer, out actualLength, out actualWidth)) { return(false); } actualDimensions.X = Math.Max(actualDimensions.X, actualLength); actualDimensions.Y = Math.Max(actualDimensions.Y, actualWidth); } return(true); }
private static bool GetBoxPositions(Vector3D dimContent, Vector2D dimContainer, LayerPattern pattern, bool swapped, double forcedSpace , out List <BoxPosition> boxPositions) { boxPositions = null; // instantiate layer var layer = new Layer2DBrickImp(new Vector3D(dimContent.X, dimContent.Y, 0.0), Vector3D.Zero, dimContainer, pattern.Name, HalfAxis.HAxis.AXIS_Z_P, swapped) { ForcedSpace = forcedSpace }; if (!pattern.GetLayerDimensionsChecked(layer, out double actualLength, out double actualWidth)) { return(false); } pattern.GenerateLayer(layer, actualLength, actualWidth); boxPositions = layer.Positions; return(true); }
private static bool GetCount(Vector3D dimContent, double length, double width, LayerPattern pattern, bool swapped, double forcedSpace , ref int iCount, ref Vector2D actualDimensions) { // instantiate layer var layer = new Layer2DBrickImp(new Vector3D(dimContent.X, dimContent.Y, 0.0), Vector3D.Zero, new Vector2D(length, width), pattern.Name, HalfAxis.HAxis.AXIS_Z_P, swapped) { ForcedSpace = forcedSpace }; if (!pattern.GetLayerDimensionsChecked(layer, out double actualLength, out double actualWidth)) { return(false); } pattern.GenerateLayer(layer, actualLength, actualWidth); iCount = layer.Count; actualDimensions = new Vector2D(actualLength, actualWidth); return(true); }