Merge pull request #5135 from larsbrubaker/main

improving sheet and array rebuild inclusion
This commit is contained in:
Lars Brubaker 2021-09-30 13:19:36 -07:00 committed by GitHub
commit 85ec11bc9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 33 deletions

View file

@ -96,7 +96,21 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
var updateItems = SheetObject3D.SortAndLockUpdateItems(this, (item) =>
{
return !(item.Parent is ArrayObject3D && item is OperationSourceObject3D);
// WIP
if (item.Parent == this)
{
// only process our children that are not the source object
return !(item is OperationSourceObject3D);
}
else if (item.Parent is OperationSourceContainerObject3D)
{
// If we find another source container
// Only process its children that are the source container (they will be replicated and modified correctly by the source container)
return item is OperationSourceObject3D;
}
// process everything else
return true;
});
var runningInterval = SheetObject3D.SendInvalidateInRebuildOrder(updateItems, InvalidateType.Properties);

View file

@ -83,10 +83,10 @@ namespace MatterHackers.MatterControl.DesignTools
public DoubleOrExpression CalculationHeight { get; set; } = .1;
[DisplayName("Expand")]
[Slider(1, 30, Easing.EaseType.Quadratic, snapDistance: .5)]
[Slider(0, 30, Easing.EaseType.Quadratic, snapDistance: .5)]
public DoubleOrExpression BaseSize { get; set; } = 3;
[Slider(1, 20, Easing.EaseType.Quadratic, snapDistance: .1)]
[Slider(0, 10, Easing.EaseType.Quadratic, snapDistance: .1)]
public DoubleOrExpression InfillAmount { get; set; } = 3;
[DisplayName("Height")]
@ -360,21 +360,6 @@ namespace MatterHackers.MatterControl.DesignTools
return boundingCircle;
}
private static PolyTree GetPolyTree(Polygons basePolygons)
{
// create a bounding polygon to clip against
Polygon boundingPoly = GetBoundingPolygon(basePolygons);
var polyTreeForTrace = new PolyTree();
var clipper = new Clipper();
clipper.AddPaths(basePolygons, PolyType.ptSubject, true);
clipper.AddPath(boundingPoly, PolyType.ptClip, true);
clipper.Execute(ClipType.ctIntersection, polyTreeForTrace);
return polyTreeForTrace;
}
public void GenerateBase(Polygons polygonShape, double bottomWithoutBase)
{
if (polygonShape != null
@ -393,11 +378,7 @@ namespace MatterHackers.MatterControl.DesignTools
break;
case BaseTypes.Outline:
PolyTree polyTreeForBase = GetPolyTree(polygonShape);
foreach (PolyNode polyToOffset in polyTreeForBase.Childs)
{
polysToOffset.Add(polyToOffset.Contour);
}
polysToOffset.AddRange(polygonShape);
break;
}

View file

@ -148,7 +148,7 @@ namespace MatterHackers.MatterControl.DesignTools
public static List<UpdateItem> SortAndLockUpdateItems(IObject3D root, Func<IObject3D, bool> includeObject)
{
var requiredUpdateItems = new Dictionary<IObject3D, UpdateItem>();
foreach (var child in root.Children)
foreach (var child in root.Descendants())
{
if (includeObject(child))
{
@ -249,7 +249,7 @@ namespace MatterHackers.MatterControl.DesignTools
}
var depth2 = inDepth;
if (HasParametersWithActiveFunctions(inItem))
if (HasExpressionWithString(inItem, "=", true))
{
var itemToAdd = inItem;
while (itemToAdd != null
@ -471,14 +471,14 @@ namespace MatterHackers.MatterControl.DesignTools
// Check if the sheet is the first sheet parent of this item (if not it will not change it's data).
if (FindFirstSheet(itemToCheck) == sheet)
{
return HasParametersWithActiveFunctions(itemToCheck);
return HasExpressionWithString(itemToCheck, "=", true);
}
}
return false;
}
public static bool HasParametersWithActiveFunctions(IObject3D itemToCheck)
public static bool HasExpressionWithString(IObject3D itemToCheck, string checkForString, bool startsWith)
{
foreach (var item in itemToCheck.DescendantsAndSelf())
{
@ -489,10 +489,17 @@ namespace MatterHackers.MatterControl.DesignTools
if (propertyValue is IDirectOrExpression directOrExpression)
{
if (directOrExpression.Expression.StartsWith("="))
if (startsWith)
{
// WIP: check if the value has actually changed, this will update every object on any cell change
return true;
if (directOrExpression.Expression.StartsWith(checkForString))
{
// WIP: check if the value has actually changed, this will update every object on any cell change
return true;
}
}
else
{
return directOrExpression.Expression.Contains(checkForString);
}
}
}

View file

@ -872,7 +872,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
public string PrintJobName { get; private set; } = null;
public bool PrintWasCanceled { get; set; } = false;
public bool PrintWasCanceled { get; private set; } = false;
public double RatioIntoCurrentLayerSeconds
{

@ -1 +1 @@
Subproject commit 84a364a7f26fc1a24ef2d616294465c4e52781cc
Subproject commit 49be2b6a99486f12ef036bd35596036ab5e3fe1b

@ -1 +1 @@
Subproject commit e1312ca8960b1cbec7bfe0b0f85770d824866983
Subproject commit e728d466796ab765de25e51f09e3107d42014168