diff --git a/MatterControlLib/DesignTools/Operations/Path/InflatePathObject3D.cs b/MatterControlLib/DesignTools/Operations/Path/InflatePathObject3D.cs index 5baa95458..b1993c07d 100644 --- a/MatterControlLib/DesignTools/Operations/Path/InflatePathObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/Path/InflatePathObject3D.cs @@ -120,16 +120,16 @@ namespace MatterHackers.MatterControl.DesignTools.Operations VertexStorage = path.Offset(Inflate.Value(this), GetJoinType(Style)); } - internal static JoinType GetJoinType(ExpandStyles style) + public static JoinType GetJoinType(ExpandStyles style) { - ClipperLib.JoinType joinType = ClipperLib.JoinType.jtMiter; + ClipperLib.JoinType joinType = JoinType.jtMiter; switch (style) { case ExpandStyles.Flat: - joinType = ClipperLib.JoinType.jtSquare; + joinType = JoinType.jtSquare; break; case ExpandStyles.Round: - joinType = ClipperLib.JoinType.jtRound; + joinType = JoinType.jtRound; break; } diff --git a/MatterControlLib/DesignTools/Primitives/BaseObject3D.cs b/MatterControlLib/DesignTools/Primitives/BaseObject3D.cs index 0e5e1467f..f6e02974c 100644 --- a/MatterControlLib/DesignTools/Primitives/BaseObject3D.cs +++ b/MatterControlLib/DesignTools/Primitives/BaseObject3D.cs @@ -39,6 +39,7 @@ using MatterHackers.Agg.VertexSource; using MatterHackers.DataConverters2D; using MatterHackers.DataConverters3D; using MatterHackers.Localizations; +using MatterHackers.MatterControl.DesignTools.Operations; using MatterHackers.MatterControl.PartPreviewWindow; using MatterHackers.PolygonMesh.Csg; using MatterHackers.PolygonMesh.Processors; @@ -90,6 +91,9 @@ namespace MatterHackers.MatterControl.DesignTools [Slider(0, 10, Easing.EaseType.Quadratic, snapDistance: .1)] public DoubleOrExpression InfillAmount { get; set; } = 3; + [EnumDisplay(Mode = EnumDisplayAttribute.PresentationMode.Buttons)] + public ExpandStyles Style { get; set; } = ExpandStyles.Round; + [DisplayName("Height")] [Slider(1, 50, Easing.EaseType.Quadratic, useSnappingGrid: true)] public DoubleOrExpression ExtrusionHeight { get; set; } = 5; @@ -368,18 +372,19 @@ namespace MatterHackers.MatterControl.DesignTools var infillAmount = InfillAmount.Value(this); var baseSize = BaseSize.Value(this); var extrusionHeight = ExtrusionHeight.Value(this); + var joinType = InflatePathObject3D.GetJoinType(Style); if (BaseType == BaseTypes.Outline && infillAmount > 0) { - basePolygons = polysToOffset.Offset((baseSize + infillAmount) * scalingForClipper); - basePolygons = basePolygons.Offset(-infillAmount * scalingForClipper); + basePolygons = polysToOffset.Offset((baseSize + infillAmount) * scalingForClipper, joinType); + basePolygons = basePolygons.Offset(-infillAmount * scalingForClipper, joinType); } else { - basePolygons = polysToOffset.Offset(baseSize * scalingForClipper); + basePolygons = polysToOffset.Offset(baseSize * scalingForClipper, joinType); } - basePolygons = ClipperLib.Clipper.CleanPolygons(basePolygons, 10); + basePolygons = Clipper.CleanPolygons(basePolygons, 10); VertexStorage rawVectorShape = basePolygons.PolygonToPathStorage(); var vectorShape = new VertexSourceApplyTransform(rawVectorShape, Affine.NewScaling(1.0 / scalingForClipper)); @@ -414,6 +419,7 @@ namespace MatterHackers.MatterControl.DesignTools changeSet.Add(nameof(InfillAmount), BaseType == BaseTypes.Outline); changeSet.Add(nameof(Centering), BaseType == BaseTypes.Circle); changeSet.Add(nameof(ExtrusionHeight), BaseType != BaseTypes.None); + changeSet.Add(nameof(Style), BaseType != BaseTypes.Circle); var vertexSource = GetVertexSource(); var meshSource = this.Descendants().Where((i) => i.Mesh != null); diff --git a/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractPathObject3D.cs b/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractPathObject3D.cs index c91076011..c61347e36 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractPathObject3D.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractPathObject3D.cs @@ -123,14 +123,17 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D } // set the mesh to show the path - var extrudeMesh = this.GetVertexSource().Extrude(Constants.PathPolygonsHeight); - if(extrudeMesh.Vertices.Count() > 5) + if (this.GetVertexSource() != null) { - this.Mesh = extrudeMesh; - } - else - { - this.Mesh = null; + var extrudeMesh = this.GetVertexSource().Extrude(Constants.PathPolygonsHeight); + if (extrudeMesh.Vertices.Count() > 5) + { + this.Mesh = extrudeMesh; + } + else + { + this.Mesh = null; + } } UiThread.RunOnIdle(() => diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 0fee6ab0d..c2b8646bf 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 0fee6ab0d2d61107717114258b06182815bc11d7 +Subproject commit c2b8646bf496a0ecf99338e513cf96cb6fdeed17