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); }
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); }
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); }