private static (ExtruderLayers, NewSupport) CreateLayerData(ConfigSettings config, List <Polygons> totalLayerOutlines, List <Polygons> supportOutlines, long grabDistance_um) { int numLayers = totalLayerOutlines.Count; var layerData = new ExtruderLayers(); var supportData = new ExtruderLayers(); layerData.Layers = new List <SliceLayer>(); for (int layerIndex = 0; layerIndex < numLayers; layerIndex++) { SliceLayer layer = new SliceLayer(); layer.AllOutlines = totalLayerOutlines[layerIndex]; layerData.Layers.Add(layer); if (layerIndex < supportOutlines.Count) { SliceLayer supportLayer = new SliceLayer(); supportLayer.AllOutlines = supportOutlines[layerIndex]; supportData.Layers.Add(supportLayer); } } var newSupport = new NewSupport(config, new List <ExtruderLayers>() { layerData }, supportData, grabDistance_um); return(layerData, newSupport); }
public (Mesh mesh, Polygons polygons) Cut(IObject3D item) { var mesh = new Mesh(item.Mesh.Vertices, item.Mesh.Faces); var itemMatrix = item.WorldMatrix(this); mesh.Transform(itemMatrix); // calculate and add the PWN face from the loops var cutPlane = new Plane(Vector3.UnitZ, new Vector3(0, 0, SliceHeight)); var slice = SliceLayer.CreateSlice(mesh, cutPlane); // copy every face that is on or below the cut plane // cut the faces at the cut plane mesh.Split(new Plane(Vector3.UnitZ, SliceHeight), cutMargin, cleanAndMerge: false); // remove every face above the cut plane RemoveFacesAboveCut(mesh); slice.Vertices().TriangulateFaces(null, mesh, SliceHeight); mesh.Transform(itemMatrix.Inverted); return(mesh, slice); }
// [Test] public void GetSliceLoop() { var cube = MeshHelper.CreatePlane(10, 10); var cutPlane = new Plane(Vector3.UnitX, new Vector3(3, 0, 0)); var slice = new SliceLayer(cutPlane); slice.CreateSlice(cube); // Assert.AreEqual(1, slice.ClosedPolygons.Count); }
private static ExtruderLayers CreateLayerData(List <Polygons> totalLayerOutlines) { int numLayers = totalLayerOutlines.Count; ExtruderLayers layerData = new ExtruderLayers(); layerData.Layers = new List <SliceLayer>(); for (int layerIndex = 0; layerIndex < numLayers; layerIndex++) { SliceLayer layer = new SliceLayer(); layer.AllOutlines = totalLayerOutlines[layerIndex]; layerData.Layers.Add(layer); } return(layerData); }
private static double GetAngleForData(string islandToFillString, string layerSupportingIslandString, string debugName) { Polygons islandToFill = PolygonsHelper.CreateFromString(islandToFillString); SliceLayer prevLayer = new SliceLayer(); prevLayer.Islands = new List <LayerIsland>(); LayerIsland part = new LayerIsland(); part.IslandOutline = PolygonsHelper.CreateFromString(layerSupportingIslandString); prevLayer.Islands.Add(part); prevLayer.Islands[0].BoundingBox.Calculate(prevLayer.Islands[0].IslandOutline); double bridgeAngle; bool foundBridgeAngle = prevLayer.BridgeAngle(islandToFill, out bridgeAngle, debugName); return(bridgeAngle); }
private static SliceVolumeStorage CreateLayerData(Polygons inset0Outline, int numLayers) { SliceVolumeStorage layerData = new SliceVolumeStorage(); layerData.layers = new List <SliceLayer>(); for (int i = 0; i < numLayers; i++) { SliceLayer layer = new SliceLayer(); layer.parts = new List <SliceLayerPart>(); SliceLayerPart part = new SliceLayerPart(); part.Insets = new List <Polygons>(); part.Insets.Add(inset0Outline); part.BoundingBox = new Aabb(inset0Outline); layer.parts.Add(part); layerData.layers.Add(layer); } return(layerData); }
private static double GetAngleForData(string outlineString, string partOutlineString, string debugName) { Polygons outline = PolygonsHelper.CreateFromString(outlineString); SliceLayer prevLayer = new SliceLayer(); prevLayer.parts = new List <SliceLayerPart>(); SliceLayerPart part = new SliceLayerPart(); part.TotalOutline = PolygonsHelper.CreateFromString(partOutlineString); prevLayer.parts.Add(part); prevLayer.parts[0].BoundingBox.Calculate(prevLayer.parts[0].TotalOutline); double bridgeAngle; Bridge.BridgeAngle(outline, prevLayer, out bridgeAngle, debugName); return(bridgeAngle); }
private static ExtruderLayers CreateLayerData(Polygons inset0Outline, int numLayers) { ExtruderLayers layerData = new ExtruderLayers(); layerData.Layers = new List <SliceLayer>(); for (int i = 0; i < numLayers; i++) { SliceLayer layer = new SliceLayer(); layer.Islands = new List <LayerIsland>(); LayerIsland part = new LayerIsland(); part.InsetToolPaths = new List <Polygons>(); part.InsetToolPaths.Add(inset0Outline); part.BoundingBox = new Aabb(inset0Outline); layer.Islands.Add(part); layerData.Layers.Add(layer); } return(layerData); }
private static double GetAngleForData(string islandToFillString, string layerSupportingIslandString, string debugName) { Polygons islandToFill = CLPolygonsExtensions.CreateFromString(islandToFillString); var prevLayer = new SliceLayer { Islands = new List <LayerIsland>() }; var part = new LayerIsland { IslandOutline = CLPolygonsExtensions.CreateFromString(layerSupportingIslandString) }; prevLayer.Islands.Add(part); prevLayer.Islands[0].BoundingBox.Calculate(prevLayer.Islands[0].IslandOutline); prevLayer.BridgeAngle(islandToFill, 0, out double bridgeAngle, null, debugName); return(bridgeAngle); }
private static ExtruderLayers CreateLayerData(Polygons inset0Outline, int numLayers) { ExtruderLayers layerData = new ExtruderLayers(); layerData.Layers = new List<SliceLayer>(); for (int i = 0; i < numLayers; i++) { SliceLayer layer = new SliceLayer(); layer.Islands = new List<LayerIsland>(); LayerIsland part = new LayerIsland(); part.InsetToolPaths = new List<Polygons>(); part.InsetToolPaths.Add(inset0Outline); part.BoundingBox = new Aabb(inset0Outline); layer.Islands.Add(part); layerData.Layers.Add(layer); } return layerData; }
private static double GetAngleForData(string islandToFillString, string layerSupportingIslandString, string debugName) { Polygons islandToFill = PolygonsHelper.CreateFromString(islandToFillString); SliceLayer prevLayer = new SliceLayer(); prevLayer.Islands = new List<LayerIsland>(); LayerIsland part = new LayerIsland(); part.IslandOutline = PolygonsHelper.CreateFromString(layerSupportingIslandString); prevLayer.Islands.Add(part); prevLayer.Islands[0].BoundingBox.Calculate(prevLayer.Islands[0].IslandOutline); double bridgeAngle; bool foundBridgeAngle = prevLayer.BridgeAngle(islandToFill, out bridgeAngle, debugName); return bridgeAngle; }
private static SliceVolumeStorage CreateLayerData(Polygons inset0Outline, int numLayers) { SliceVolumeStorage layerData = new SliceVolumeStorage(); layerData.layers = new List<SliceLayer>(); for (int i = 0; i < numLayers; i++) { SliceLayer layer = new SliceLayer(); layer.parts = new List<SliceLayerPart>(); SliceLayerPart part = new SliceLayerPart(); part.Insets = new List<Polygons>(); part.Insets.Add(inset0Outline); part.BoundingBox = new Aabb(inset0Outline); layer.parts.Add(part); layerData.layers.Add(layer); } return layerData; }
private static double GetAngleForData(string outlineString, string partOutlineString, string debugName) { Polygons outline = PolygonsHelper.CreateFromString(outlineString); SliceLayer prevLayer = new SliceLayer(); prevLayer.Islands = new List<LayerIsland>(); LayerIsland part = new LayerIsland(); part.IslandOutline = PolygonsHelper.CreateFromString(partOutlineString); prevLayer.Islands.Add(part); prevLayer.Islands[0].BoundingBox.Calculate(prevLayer.Islands[0].IslandOutline); double bridgeAngle; prevLayer.BridgeAngle(outline, out bridgeAngle, debugName); return bridgeAngle; }
private static double GetAngleForData(string outlineString, string partOutlineString, string debugName) { Polygons outline = PolygonsHelper.CreateFromString(outlineString); SliceLayer prevLayer = new SliceLayer(); prevLayer.parts = new List<SliceLayerPart>(); SliceLayerPart part = new SliceLayerPart(); part.TotalOutline = PolygonsHelper.CreateFromString(partOutlineString); prevLayer.parts.Add(part); prevLayer.parts[0].BoundingBox.Calculate(prevLayer.parts[0].TotalOutline); double bridgeAngle; Bridge.BridgeAngle(outline, prevLayer, out bridgeAngle, debugName); return bridgeAngle; }