/// <summary> /// returns 3D layer. This is only used in LayerSummary /// </summary> internal ILayer GetILayer(int layerIndex, bool symX, bool symY) { ILayer2D currentLayer = _layerTypes[layerIndex]; if (currentLayer is Layer2D) { Layer2D layer2DBox = currentLayer as Layer2D; Layer3DBox boxLayer = new Layer3DBox(0.0, layerIndex); foreach (LayerPosition layerPos in layer2DBox) { LayerPosition layerPosTemp = AdjustLayerPosition(layerPos, symX, symY); boxLayer.Add(new BoxPosition( layerPosTemp.Position + Analysis.Offset , layerPosTemp.LengthAxis , layerPosTemp.WidthAxis )); } return(boxLayer); } if (currentLayer is Layer2DCyl) { Layer2DCyl layer2DCyl = currentLayer as Layer2DCyl; Layer3DCyl cylLayer = new Layer3DCyl(0.0); foreach (Vector2D vPos in layer2DCyl) { cylLayer.Add( AdjustPosition(new Vector3D(vPos.X, vPos.Y, 0.0), symX, symY) + Analysis.Offset); } return(cylLayer); } return(null); }
public Layer3DBox GetBoxLayer(int iLayerIndex, ref bool hasInterlayer, ref double zInterlayer) { if (null == _parentAnalysis) { throw new Exception("_parentAnalysis not set."); } double interlayerThickness = (null != _parentAnalysis.InterlayerProperties) ? _parentAnalysis.InterlayerProperties.Thickness : 0.0; double packHeight = _parentAnalysis.PackProperties.Height; double zLow = _parentAnalysis.PalletProperties.Height; int i = 0; while (i <= iLayerIndex - 1) { LayerDescriptor desc = _listLayers[i]; zLow += (desc.HasInterlayer ? interlayerThickness : 0.0) + packHeight; ++i; } zInterlayer = zLow; hasInterlayer = _listLayers[iLayerIndex].HasInterlayer; zLow += hasInterlayer ? interlayerThickness : 0.0; Transform3D swapTransform = Transform3D.Identity; if (_listLayers[iLayerIndex].Swapped) { Matrix4D matRot = new Matrix4D( -1.0, 0.0, 0.0, _parentAnalysis.PalletProperties.Length , 0.0, -1.0, 0.0, _parentAnalysis.PalletProperties.Width , 0.0, 0.0, 1.0, 0.0 , 0.0, 0.0, 0.0, 1.0); swapTransform = new Transform3D(matRot); } // build BoxLayer Layer3DBox layer = new Layer3DBox(zLow + (hasInterlayer ? interlayerThickness : 0.0), 0); foreach (BoxPosition b in _layer) { layer.Add( new BoxPosition( swapTransform.transform(b.Position + zLow * Vector3D.ZAxis) , HalfAxis.Transform(b.DirectionLength, swapTransform) , HalfAxis.Transform(b.DirectionWidth, swapTransform)) ); } return(layer); }