public static Dictionary <string, object> CreateFlakeboardStripesProperties(FlakeboardStripesProperties props) { List <FS_Rectangle> allLines = CreateFlakeboardRectangles(props); var instanceProps = ByPointInstanceProperties.CreateList( allLines.Select(l => l.Length).ToList(), allLines.Select(l => l.Width).ToList(), props.FlakeboardType, allLines.Select(l => l.CenterPosition).ToList(), props.FlakeboardRotation); return(ByPointInstanceProperties.AsDictionary(instanceProps)); }
public static Dictionary <string, object> CreateFlakeboardPlates(FlakeboardPlatesProperties props) { var spaceFiller = new FS_WithLines( new FL_FixedPartSize_VariableEnding(props.PlateLength) { AlternateVariablePosition = true, MinVariableSize = props.MinimumPlateLength }, new FL_FixedPartSize_VariableEnding(props.PlateWidth)); var lines = spaceFiller.Fill(props.Space).ToList(); var flattendedRectangles = lines.SelectMany(r => r).ToList(); //Adjust centerPositions by distance to border flattendedRectangles.ForEach(r => { r.CenterPosition.Y += props.DistanceToBorder; r.CenterPosition.X += props.DistanceToBorder; }); var positions = flattendedRectangles.Select(r => r.CenterPosition).ToList(); positions.ForEach(p => p.Z += props.ZOffset); var allInstanceProperties = ByPointInstanceProperties.CreateList( flattendedRectangles.Select(r => r.Length).ToList(), flattendedRectangles.Select(r => r.Width).ToList(), props.FlakeboardType, positions, props.PlateRotation); return(ByPointInstanceProperties.AsDictionary(allInstanceProperties)); }
public static Dictionary <string, object> CreateFloorPlates(FloorPlateProperties props) { //Berechne Offset-Positionen für jeden Space/WhiteLine //TODO: Siehe Beschreibung var positions = new List <Tuple <FamilyType, double> >(); var currentDistance = 0.0; if (props.FirstLineIsWhite) { positions.Add(new Tuple <FamilyType, double>(props.WhitePlates, 0.0)); currentDistance += props.WhitePlateWidth + props.GapWidthToNormalPlate; } for (int k = props.FirstLineIsWhite ? 1 : 0; k < props.DistancesBetweenWhiteLines.Count; k++) { positions.Add(new Tuple <FamilyType, double>(props.NormalPlates, currentDistance)); currentDistance += props.DistancesBetweenWhiteLines[k] + props.GapWidthToNormalPlate; positions.Add(new Tuple <FamilyType, double>(props.WhitePlates, currentDistance)); currentDistance += props.WhitePlateWidth + props.GapWidthToNormalPlate; } //Last normal width positions.Add(new Tuple <FamilyType, double>(props.NormalPlates, currentDistance)); //Vorgehen: Erstelle Liste von Listen mit SFRectangles + Typ (Weiß/normal) var rectangleTypes = new List <Tuple <List <FS_Rectangle>, FamilyType> >(); //TODO: Create Rectangles int i = 0; foreach (var pos in positions) { if (pos.Item1 == props.WhitePlates) { var lineGenerator = new FL_FixedPartSize_VariableEnding(props.WhitePlateLength); var lengths = lineGenerator.FillLine(new FL_Line() { Length = props.Space.Length }); var rectangles = FL_Utils.LineLengthsAsRectangles( lengths, props.WhitePlateWidth, props.LineDirection.X > 0 ? FS_XYDirection.XDirection : FS_XYDirection.YDirection, pos.Item2, props.BorderThickness); rectangleTypes.Add(new Tuple <List <FS_Rectangle>, FamilyType>(rectangles.ToList(), props.WhitePlates)); } else { var spaceGenerator = new FS_WithLines( new FL_FixedPartSize_VariableEnding(props.NormalPlateLength), new FL_FixedPartSize_VariableEnding(props.NormalPlateWidth)); //var nextSpaceBegin = positions.Count > (i + 1) ? positions[i + 1].Item2 : props.Space.LengthAccrossLines; var rectangles = spaceGenerator.Fill(props.Space).SelectMany(l => l).ToList(); rectangleTypes.Add(new Tuple <List <FS_Rectangle>, FamilyType>(rectangles.ToList(), props.NormalPlates)); } i++; } var instanceProps = ByPointInstanceProperties.CreateList( rectangleTypes.Select(l => l.Item1.Select(r => r.Length)).SelectMany(r1 => r1).ToList(), rectangleTypes.Select(l => l.Item1.Select(r => r.Width)).SelectMany(r1 => r1).ToList(), rectangleTypes.Select(l => l.Item2).ToList(), rectangleTypes.Select(l => l.Item1.Select(r => r.CenterPosition)).SelectMany(r1 => r1).ToList(), props.PlateRotation ); return(ByPointInstanceProperties.AsDictionary(instanceProps)); }