Making Object3D classes consistent
issue: MatterHackers/MCCentral#3702 Consider adding 'Object3D' suffix to Object3D types or use consistent format
This commit is contained in:
parent
10516c56b6
commit
e9e55f874e
36 changed files with 275 additions and 238 deletions
|
|
@ -300,7 +300,7 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
new SceneSelectionOperation()
|
||||
{
|
||||
OperationType = typeof(Group3D),
|
||||
OperationType = typeof(GroupObject3D),
|
||||
|
||||
TitleResolver = () => "Group".Localize(),
|
||||
Action = (scene) =>
|
||||
|
|
@ -308,7 +308,7 @@ namespace MatterHackers.MatterControl
|
|||
var selectedItem = scene.SelectedItem;
|
||||
scene.SelectedItem = null;
|
||||
|
||||
var newGroup = new Group3D();
|
||||
var newGroup = new GroupObject3D();
|
||||
// When grouping items, move them to be centered on their bounding box
|
||||
newGroup.Children.Modify((gChildren) =>
|
||||
{
|
||||
|
|
@ -333,7 +333,7 @@ namespace MatterHackers.MatterControl
|
|||
scene.SelectedItem = newGroup;
|
||||
},
|
||||
IsEnabled = (scene) => scene.HasSelection
|
||||
&& scene.SelectedItem is SelectionGroup
|
||||
&& scene.SelectedItem is SelectionGroupObject3D
|
||||
&& scene.SelectedItem.Children.Count > 1,
|
||||
Icon = AggContext.StaticData.LoadIcon("group.png", 16, 16).SetPreMultiply(),
|
||||
},
|
||||
|
|
@ -362,17 +362,17 @@ namespace MatterHackers.MatterControl
|
|||
new SceneSelectionSeparator(),
|
||||
new SceneSelectionOperation()
|
||||
{
|
||||
OperationType = typeof(Align3D),
|
||||
OperationType = typeof(AlignObject3D),
|
||||
TitleResolver = () => "Align".Localize(),
|
||||
Action = (scene) =>
|
||||
{
|
||||
var selectedItem = scene.SelectedItem;
|
||||
var align = new Align3D();
|
||||
var align = new AlignObject3D();
|
||||
align.AddSelectionAsChildren(scene, selectedItem);
|
||||
align.Invalidate(new InvalidateArgs(align, InvalidateType.Properties, null));
|
||||
},
|
||||
Icon = AggContext.StaticData.LoadIcon("align_left.png", 16, 16, theme.InvertIcons).SetPreMultiply(),
|
||||
IsEnabled = (scene) => scene.SelectedItem is SelectionGroup,
|
||||
IsEnabled = (scene) => scene.SelectedItem is SelectionGroupObject3D,
|
||||
},
|
||||
new SceneSelectionOperation()
|
||||
{
|
||||
|
|
@ -408,7 +408,7 @@ namespace MatterHackers.MatterControl
|
|||
TitleResolver = () => "Combine".Localize(),
|
||||
Action = (scene) => new CombineObject3D().WrapSelectedItemAndSelect(scene),
|
||||
Icon = AggContext.StaticData.LoadIcon("combine.png").SetPreMultiply(),
|
||||
IsEnabled = (scene) => scene.SelectedItem is SelectionGroup,
|
||||
IsEnabled = (scene) => scene.SelectedItem is SelectionGroupObject3D,
|
||||
},
|
||||
new SceneSelectionOperation()
|
||||
{
|
||||
|
|
@ -416,7 +416,7 @@ namespace MatterHackers.MatterControl
|
|||
TitleResolver = () => "Subtract".Localize(),
|
||||
Action = (scene) => new SubtractObject3D().WrapSelectedItemAndSelect(scene),
|
||||
Icon = AggContext.StaticData.LoadIcon("subtract.png").SetPreMultiply(),
|
||||
IsEnabled = (scene) => scene.SelectedItem is SelectionGroup,
|
||||
IsEnabled = (scene) => scene.SelectedItem is SelectionGroupObject3D,
|
||||
},
|
||||
new SceneSelectionOperation()
|
||||
{
|
||||
|
|
@ -424,7 +424,7 @@ namespace MatterHackers.MatterControl
|
|||
TitleResolver = () => "Intersect".Localize(),
|
||||
Action = (scene) => new IntersectionObject3D().WrapSelectedItemAndSelect(scene),
|
||||
Icon = AggContext.StaticData.LoadIcon("intersect.png"),
|
||||
IsEnabled = (scene) => scene.SelectedItem is SelectionGroup,
|
||||
IsEnabled = (scene) => scene.SelectedItem is SelectionGroupObject3D,
|
||||
},
|
||||
new SceneSelectionOperation()
|
||||
{
|
||||
|
|
@ -432,47 +432,47 @@ namespace MatterHackers.MatterControl
|
|||
TitleResolver = () => "Subtract & Replace".Localize(),
|
||||
Action = (scene) => new SubtractAndReplaceObject3D().WrapSelectedItemAndSelect(scene),
|
||||
Icon = AggContext.StaticData.LoadIcon("subtract_and_replace.png").SetPreMultiply(),
|
||||
IsEnabled = (scene) => scene.SelectedItem is SelectionGroup,
|
||||
IsEnabled = (scene) => scene.SelectedItem is SelectionGroupObject3D,
|
||||
},
|
||||
new SceneSelectionSeparator(),
|
||||
new SceneSelectionOperation()
|
||||
{
|
||||
OperationType = typeof(ArrayLinear3D),
|
||||
OperationType = typeof(ArrayLinearObject3D),
|
||||
TitleResolver = () => "Linear Array".Localize(),
|
||||
Action = (scene) =>
|
||||
{
|
||||
var array = new ArrayLinear3D();
|
||||
var array = new ArrayLinearObject3D();
|
||||
array.AddSelectionAsChildren(scene, scene.SelectedItem);
|
||||
array.Invalidate(new InvalidateArgs(array, InvalidateType.Properties, null));
|
||||
},
|
||||
Icon = AggContext.StaticData.LoadIcon("array_linear.png").SetPreMultiply(),
|
||||
IsEnabled = (scene) => scene.HasSelection && !(scene.SelectedItem is SelectionGroup),
|
||||
IsEnabled = (scene) => scene.HasSelection && !(scene.SelectedItem is SelectionGroupObject3D),
|
||||
},
|
||||
new SceneSelectionOperation()
|
||||
{
|
||||
OperationType = typeof(ArrayRadial3D),
|
||||
OperationType = typeof(ArrayRadialObject3D),
|
||||
TitleResolver = () => "Radial Array".Localize(),
|
||||
Action = (scene) =>
|
||||
{
|
||||
var array = new ArrayRadial3D();
|
||||
var array = new ArrayRadialObject3D();
|
||||
array.AddSelectionAsChildren(scene, scene.SelectedItem);
|
||||
array.Invalidate(new InvalidateArgs(array, InvalidateType.Properties, null));
|
||||
},
|
||||
Icon = AggContext.StaticData.LoadIcon("array_radial.png").SetPreMultiply(),
|
||||
IsEnabled = (scene) => scene.HasSelection && !(scene.SelectedItem is SelectionGroup),
|
||||
IsEnabled = (scene) => scene.HasSelection && !(scene.SelectedItem is SelectionGroupObject3D),
|
||||
},
|
||||
new SceneSelectionOperation()
|
||||
{
|
||||
OperationType = typeof(ArrayAdvanced3D),
|
||||
OperationType = typeof(ArrayAdvancedObject3D),
|
||||
TitleResolver = () => "Advanced Array".Localize(),
|
||||
Action = (scene) =>
|
||||
{
|
||||
var array = new ArrayAdvanced3D();
|
||||
var array = new ArrayAdvancedObject3D();
|
||||
array.AddSelectionAsChildren(scene, scene.SelectedItem);
|
||||
array.Invalidate(new InvalidateArgs(array, InvalidateType.Properties, null));
|
||||
},
|
||||
Icon = AggContext.StaticData.LoadIcon("array_advanced.png").SetPreMultiply(),
|
||||
IsEnabled = (scene) => scene.HasSelection && !(scene.SelectedItem is SelectionGroup),
|
||||
IsEnabled = (scene) => scene.HasSelection && !(scene.SelectedItem is SelectionGroupObject3D),
|
||||
},
|
||||
new SceneSelectionSeparator(),
|
||||
new SceneSelectionOperation()
|
||||
|
|
@ -501,20 +501,20 @@ namespace MatterHackers.MatterControl
|
|||
},
|
||||
new SceneSelectionOperation()
|
||||
{
|
||||
OperationType = typeof(FitToBounds3D),
|
||||
OperationType = typeof(FitToBoundsObject3D),
|
||||
TitleResolver = () => "Fit to Bounds".Localize(),
|
||||
Action = (scene) =>
|
||||
{
|
||||
var selectedItem = scene.SelectedItem;
|
||||
scene.SelectedItem = null;
|
||||
var fit = FitToBounds3D.Create(selectedItem.Clone());
|
||||
var fit = FitToBoundsObject3D.Create(selectedItem.Clone());
|
||||
fit.MakeNameNonColliding();
|
||||
|
||||
scene.UndoBuffer.AddAndDo(new ReplaceCommand(new List<IObject3D> { selectedItem }, new List<IObject3D> { fit }));
|
||||
scene.SelectedItem = fit;
|
||||
},
|
||||
Icon = AggContext.StaticData.LoadIcon("fit.png", 16, 16, theme.InvertIcons),
|
||||
IsEnabled = (scene) => scene.HasSelection && !(scene.SelectedItem is SelectionGroup),
|
||||
IsEnabled = (scene) => scene.HasSelection && !(scene.SelectedItem is SelectionGroupObject3D),
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -531,9 +531,9 @@ namespace MatterHackers.MatterControl
|
|||
// TODO: Use custom selection group icon if reusing group icon seems incorrect
|
||||
//
|
||||
// Explicitly register SelectionGroup icon
|
||||
if (operationIconsByType.TryGetValue(typeof(Group3D), out ImageBuffer groupIcon))
|
||||
if (operationIconsByType.TryGetValue(typeof(GroupObject3D), out ImageBuffer groupIcon))
|
||||
{
|
||||
operationIconsByType.Add(typeof(SelectionGroup), groupIcon);
|
||||
operationIconsByType.Add(typeof(SelectionGroupObject3D), groupIcon);
|
||||
}
|
||||
|
||||
this.Thumbnails.OperationIcons = operationIconsByType;
|
||||
|
|
@ -696,7 +696,7 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
if (sceneItem is IObject3D imageObject)
|
||||
{
|
||||
var path = new ImageToPath();
|
||||
var path = new ImageToPathObject3D();
|
||||
sceneItem.WrapWith(path, scene);
|
||||
path.Invalidate(new InvalidateArgs(path, InvalidateType.Properties, null));
|
||||
}
|
||||
|
|
@ -713,7 +713,7 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
if (sceneItem is IPathObject imageObject)
|
||||
{
|
||||
var extrude = new LinearExtrude();
|
||||
var extrude = new LinearExtrudeObject3D();
|
||||
sceneItem.WrapWith(extrude, scene);
|
||||
extrude.Invalidate(new InvalidateArgs(extrude, InvalidateType.Properties, null));
|
||||
}
|
||||
|
|
@ -730,7 +730,7 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
if (sceneItem is IPathObject imageObject)
|
||||
{
|
||||
var smoothPath = new SmoothPath();
|
||||
var smoothPath = new SmoothPathObject3D();
|
||||
sceneItem.WrapWith(smoothPath, scene);
|
||||
smoothPath.Invalidate(new InvalidateArgs(smoothPath, InvalidateType.Properties, null));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,16 +169,16 @@ namespace MatterHackers.MatterControl
|
|||
});
|
||||
}
|
||||
|
||||
public InsertionGroup AddToPlate(IEnumerable<ILibraryItem> selectedLibraryItems)
|
||||
public InsertionGroupObject3D AddToPlate(IEnumerable<ILibraryItem> selectedLibraryItems)
|
||||
{
|
||||
InsertionGroup insertionGroup = null;
|
||||
InsertionGroupObject3D insertionGroup = null;
|
||||
|
||||
var context = ApplicationController.Instance.DragDropData;
|
||||
var scene = context.SceneContext.Scene;
|
||||
scene.Children.Modify(list =>
|
||||
{
|
||||
list.Add(
|
||||
insertionGroup = new InsertionGroup(
|
||||
insertionGroup = new InsertionGroupObject3D(
|
||||
selectedLibraryItems,
|
||||
context.View3DWidget,
|
||||
scene,
|
||||
|
|
|
|||
124
DesignTools/Operations/Align2D.cs
Normal file
124
DesignTools/Operations/Align2D.cs
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
Copyright (c) 2018, Lars Brubaker, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using MatterHackers.Agg.Transform;
|
||||
using MatterHackers.Agg.VertexSource;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||
{
|
||||
public class Align2D : VertexSourceApplyTransform
|
||||
{
|
||||
public Align2D()
|
||||
{
|
||||
}
|
||||
|
||||
public Align2D(IVertexSource objectToAlign, Side2D boundingFacesToAlign, IVertexSource objectToAlignTo, Side2D boundingFacesToAlignTo, double offsetX = 0, double offsetY = 0, string name = "")
|
||||
: this(objectToAlign, boundingFacesToAlign, GetPositionToAlignTo(objectToAlignTo, boundingFacesToAlignTo, new Vector2(offsetX, offsetY)), name)
|
||||
{
|
||||
if (objectToAlign == objectToAlignTo)
|
||||
{
|
||||
throw new Exception("You cannot align an object to itself.");
|
||||
}
|
||||
}
|
||||
|
||||
public Align2D(IVertexSource objectToAlign, Side2D boundingFacesToAlign, double positionToAlignToX = 0, double positionToAlignToY = 0, string name = "")
|
||||
: this(objectToAlign, boundingFacesToAlign, new Vector2(positionToAlignToX, positionToAlignToY), name)
|
||||
{
|
||||
}
|
||||
|
||||
public Align2D(IVertexSource objectToAlign, Side2D boundingFacesToAlign, Vector2 positionToAlignTo, double offsetX, double offsetY, string name = "")
|
||||
: this(objectToAlign, boundingFacesToAlign, positionToAlignTo + new Vector2(offsetX, offsetY), name)
|
||||
{
|
||||
}
|
||||
|
||||
public Align2D(IVertexSource item, Side2D boundingFacesToAlign, Vector2 positionToAlignTo, string name = "")
|
||||
{
|
||||
var bounds = item.GetBounds();
|
||||
|
||||
if (IsSet(boundingFacesToAlign, Side2D.Left, Side2D.Right))
|
||||
{
|
||||
positionToAlignTo.X = positionToAlignTo.X - bounds.Left;
|
||||
}
|
||||
if (IsSet(boundingFacesToAlign, Side2D.Right, Side2D.Left))
|
||||
{
|
||||
positionToAlignTo.X = positionToAlignTo.X - bounds.Left - (bounds.Right - bounds.Left);
|
||||
}
|
||||
if (IsSet(boundingFacesToAlign, Side2D.Bottom, Side2D.Top))
|
||||
{
|
||||
positionToAlignTo.Y = positionToAlignTo.Y - bounds.Bottom;
|
||||
}
|
||||
if (IsSet(boundingFacesToAlign, Side2D.Top, Side2D.Bottom))
|
||||
{
|
||||
positionToAlignTo.Y = positionToAlignTo.Y - bounds.Bottom - (bounds.Top - bounds.Bottom);
|
||||
}
|
||||
|
||||
Transform = Affine.NewTranslation(positionToAlignTo);
|
||||
VertexSource = item;
|
||||
}
|
||||
|
||||
public static Vector2 GetPositionToAlignTo(IVertexSource objectToAlignTo, Side2D boundingFacesToAlignTo, Vector2 extraOffset)
|
||||
{
|
||||
Vector2 positionToAlignTo = new Vector2();
|
||||
if (IsSet(boundingFacesToAlignTo, Side2D.Left, Side2D.Right))
|
||||
{
|
||||
positionToAlignTo.X = objectToAlignTo.GetBounds().Left;
|
||||
}
|
||||
if (IsSet(boundingFacesToAlignTo, Side2D.Right, Side2D.Left))
|
||||
{
|
||||
positionToAlignTo.X = objectToAlignTo.GetBounds().Right;
|
||||
}
|
||||
if (IsSet(boundingFacesToAlignTo, Side2D.Bottom, Side2D.Top))
|
||||
{
|
||||
positionToAlignTo.Y = objectToAlignTo.GetBounds().Bottom;
|
||||
}
|
||||
if (IsSet(boundingFacesToAlignTo, Side2D.Top, Side2D.Bottom))
|
||||
{
|
||||
positionToAlignTo.Y = objectToAlignTo.GetBounds().Top;
|
||||
}
|
||||
|
||||
return positionToAlignTo + extraOffset;
|
||||
}
|
||||
|
||||
private static bool IsSet(Side2D variableToCheck, Side2D faceToCheckFor, Side2D faceToAssertNot)
|
||||
{
|
||||
if ((variableToCheck & faceToCheckFor) != 0)
|
||||
{
|
||||
if ((variableToCheck & faceToAssertNot) != 0)
|
||||
{
|
||||
throw new Exception("You cannot have both " + faceToCheckFor.ToString() + " and " + faceToAssertNot.ToString() + " set when calling Align. The are mutually exclusive.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -31,9 +31,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using MatterHackers.Agg.Transform;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Agg.VertexSource;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.VectorMath;
|
||||
using Newtonsoft.Json;
|
||||
|
|
@ -89,105 +87,17 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
Top = 0x20,
|
||||
};
|
||||
|
||||
public class Align2D : VertexSourceApplyTransform
|
||||
{
|
||||
public Align2D()
|
||||
{
|
||||
}
|
||||
|
||||
public Align2D(IVertexSource objectToAlign, Side2D boundingFacesToAlign, IVertexSource objectToAlignTo, Side2D boundingFacesToAlignTo, double offsetX = 0, double offsetY = 0, string name = "")
|
||||
: this(objectToAlign, boundingFacesToAlign, GetPositionToAlignTo(objectToAlignTo, boundingFacesToAlignTo, new Vector2(offsetX, offsetY)), name)
|
||||
{
|
||||
if (objectToAlign == objectToAlignTo)
|
||||
{
|
||||
throw new Exception("You cannot align an object to itself.");
|
||||
}
|
||||
}
|
||||
|
||||
public Align2D(IVertexSource objectToAlign, Side2D boundingFacesToAlign, double positionToAlignToX = 0, double positionToAlignToY = 0, string name = "")
|
||||
: this(objectToAlign, boundingFacesToAlign, new Vector2(positionToAlignToX, positionToAlignToY), name)
|
||||
{
|
||||
}
|
||||
|
||||
public Align2D(IVertexSource objectToAlign, Side2D boundingFacesToAlign, Vector2 positionToAlignTo, double offsetX, double offsetY, string name = "")
|
||||
: this(objectToAlign, boundingFacesToAlign, positionToAlignTo + new Vector2(offsetX, offsetY), name)
|
||||
{
|
||||
}
|
||||
|
||||
public Align2D(IVertexSource item, Side2D boundingFacesToAlign, Vector2 positionToAlignTo, string name = "")
|
||||
{
|
||||
var bounds = item.GetBounds();
|
||||
|
||||
if (IsSet(boundingFacesToAlign, Side2D.Left, Side2D.Right))
|
||||
{
|
||||
positionToAlignTo.X = positionToAlignTo.X - bounds.Left;
|
||||
}
|
||||
if (IsSet(boundingFacesToAlign, Side2D.Right, Side2D.Left))
|
||||
{
|
||||
positionToAlignTo.X = positionToAlignTo.X - bounds.Left - (bounds.Right - bounds.Left);
|
||||
}
|
||||
if (IsSet(boundingFacesToAlign, Side2D.Bottom, Side2D.Top))
|
||||
{
|
||||
positionToAlignTo.Y = positionToAlignTo.Y - bounds.Bottom;
|
||||
}
|
||||
if (IsSet(boundingFacesToAlign, Side2D.Top, Side2D.Bottom))
|
||||
{
|
||||
positionToAlignTo.Y = positionToAlignTo.Y - bounds.Bottom - (bounds.Top - bounds.Bottom);
|
||||
}
|
||||
|
||||
Transform = Affine.NewTranslation(positionToAlignTo);
|
||||
VertexSource = item;
|
||||
}
|
||||
|
||||
public static Vector2 GetPositionToAlignTo(IVertexSource objectToAlignTo, Side2D boundingFacesToAlignTo, Vector2 extraOffset)
|
||||
{
|
||||
Vector2 positionToAlignTo = new Vector2();
|
||||
if (IsSet(boundingFacesToAlignTo, Side2D.Left, Side2D.Right))
|
||||
{
|
||||
positionToAlignTo.X = objectToAlignTo.GetBounds().Left;
|
||||
}
|
||||
if (IsSet(boundingFacesToAlignTo, Side2D.Right, Side2D.Left))
|
||||
{
|
||||
positionToAlignTo.X = objectToAlignTo.GetBounds().Right;
|
||||
}
|
||||
if (IsSet(boundingFacesToAlignTo, Side2D.Bottom, Side2D.Top))
|
||||
{
|
||||
positionToAlignTo.Y = objectToAlignTo.GetBounds().Bottom;
|
||||
}
|
||||
if (IsSet(boundingFacesToAlignTo, Side2D.Top, Side2D.Bottom))
|
||||
{
|
||||
positionToAlignTo.Y = objectToAlignTo.GetBounds().Top;
|
||||
}
|
||||
|
||||
return positionToAlignTo + extraOffset;
|
||||
}
|
||||
|
||||
private static bool IsSet(Side2D variableToCheck, Side2D faceToCheckFor, Side2D faceToAssertNot)
|
||||
{
|
||||
if ((variableToCheck & faceToCheckFor) != 0)
|
||||
{
|
||||
if ((variableToCheck & faceToAssertNot) != 0)
|
||||
{
|
||||
throw new Exception("You cannot have both " + faceToCheckFor.ToString() + " and " + faceToAssertNot.ToString() + " set when calling Align. The are mutually exclusive.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class Align3D : Object3D, IPropertyGridModifier
|
||||
public class AlignObject3D : Object3D, IPropertyGridModifier
|
||||
{
|
||||
// We need to serialize this so we can remove the arrange and get back to the objects before arranging
|
||||
public List<Aabb> OriginalChildrenBounds = new List<Aabb>();
|
||||
|
||||
public Align3D()
|
||||
public AlignObject3D()
|
||||
{
|
||||
Name = "Align";
|
||||
}
|
||||
|
||||
public Align3D(IObject3D objectToAlign, FaceAlign boundingFacesToAlign, IObject3D objectToAlignTo, FaceAlign boundingFacesToAlignTo, double offsetX = 0, double offsetY = 0, double offsetZ = 0, string name = "")
|
||||
public AlignObject3D(IObject3D objectToAlign, FaceAlign boundingFacesToAlign, IObject3D objectToAlignTo, FaceAlign boundingFacesToAlignTo, double offsetX = 0, double offsetY = 0, double offsetZ = 0, string name = "")
|
||||
: this(objectToAlign, boundingFacesToAlign, GetPositionToAlignTo(objectToAlignTo, boundingFacesToAlignTo, new Vector3(offsetX, offsetY, offsetZ)), name)
|
||||
{
|
||||
if (objectToAlign == objectToAlignTo)
|
||||
|
|
@ -196,17 +106,17 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
}
|
||||
}
|
||||
|
||||
public Align3D(IObject3D objectToAlign, FaceAlign boundingFacesToAlign, double positionToAlignToX = 0, double positionToAlignToY = 0, double positionToAlignToZ = 0, string name = "")
|
||||
public AlignObject3D(IObject3D objectToAlign, FaceAlign boundingFacesToAlign, double positionToAlignToX = 0, double positionToAlignToY = 0, double positionToAlignToZ = 0, string name = "")
|
||||
: this(objectToAlign, boundingFacesToAlign, new Vector3(positionToAlignToX, positionToAlignToY, positionToAlignToZ), name)
|
||||
{
|
||||
}
|
||||
|
||||
public Align3D(IObject3D objectToAlign, FaceAlign boundingFacesToAlign, Vector3 positionToAlignTo, double offsetX, double offsetY, double offsetZ, string name = "")
|
||||
public AlignObject3D(IObject3D objectToAlign, FaceAlign boundingFacesToAlign, Vector3 positionToAlignTo, double offsetX, double offsetY, double offsetZ, string name = "")
|
||||
: this(objectToAlign, boundingFacesToAlign, positionToAlignTo + new Vector3(offsetX, offsetY, offsetZ), name)
|
||||
{
|
||||
}
|
||||
|
||||
public Align3D(IObject3D item, FaceAlign boundingFacesToAlign, Vector3 positionToAlignTo, string name = "")
|
||||
public AlignObject3D(IObject3D item, FaceAlign boundingFacesToAlign, Vector3 positionToAlignTo, string name = "")
|
||||
{
|
||||
AxisAlignedBoundingBox bounds = item.GetAxisAlignedBoundingBox();
|
||||
|
||||
|
|
@ -35,9 +35,9 @@ using System.Linq;
|
|||
|
||||
namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||
{
|
||||
public class ArrayAdvanced3D : Object3D
|
||||
public class ArrayAdvancedObject3D : Object3D
|
||||
{
|
||||
public ArrayAdvanced3D()
|
||||
public ArrayAdvancedObject3D()
|
||||
{
|
||||
Name = "Advanced Array".Localize();
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
public override void Apply(UndoBuffer undoBuffer)
|
||||
{
|
||||
OperationSource.Apply(this);
|
||||
OperationSourceObject3D.Apply(this);
|
||||
|
||||
base.Apply(undoBuffer);
|
||||
}
|
||||
|
|
@ -120,7 +120,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
public override void Remove(UndoBuffer undoBuffer)
|
||||
{
|
||||
OperationSource.Remove(this);
|
||||
OperationSourceObject3D.Remove(this);
|
||||
|
||||
base.Remove(undoBuffer);
|
||||
}
|
||||
|
|
@ -37,9 +37,9 @@ using System.Linq;
|
|||
|
||||
namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||
{
|
||||
public class ArrayLinear3D : Object3D
|
||||
public class ArrayLinearObject3D : Object3D
|
||||
{
|
||||
public ArrayLinear3D()
|
||||
public ArrayLinearObject3D()
|
||||
{
|
||||
Name = "Linear Array".Localize();
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
public override void Apply(UndoBuffer undoBuffer)
|
||||
{
|
||||
OperationSource.Apply(this);
|
||||
OperationSourceObject3D.Apply(this);
|
||||
|
||||
base.Apply(undoBuffer);
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
{
|
||||
this.DebugDepth("Rebuild");
|
||||
|
||||
var sourceContainer = OperationSource.GetOrCreateSourceContainer(this);
|
||||
var sourceContainer = OperationSourceObject3D.GetOrCreateSourceContainer(this);
|
||||
|
||||
this.Children.Modify(list =>
|
||||
{
|
||||
|
|
@ -108,7 +108,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
public override void Remove(UndoBuffer undoBuffer)
|
||||
{
|
||||
OperationSource.Remove(this);
|
||||
OperationSourceObject3D.Remove(this);
|
||||
|
||||
base.Remove(undoBuffer);
|
||||
}
|
||||
|
|
@ -38,9 +38,9 @@ using System.Linq;
|
|||
|
||||
namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||
{
|
||||
public class ArrayRadial3D : Object3D
|
||||
public class ArrayRadialObject3D : Object3D
|
||||
{
|
||||
public ArrayRadial3D()
|
||||
public ArrayRadialObject3D()
|
||||
{
|
||||
Name = "Radial Array".Localize();
|
||||
}
|
||||
|
|
@ -66,7 +66,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
public override void Apply(UndoBuffer undoBuffer)
|
||||
{
|
||||
OperationSource.Apply(this);
|
||||
OperationSourceObject3D.Apply(this);
|
||||
|
||||
base.Apply(undoBuffer);
|
||||
}
|
||||
|
|
@ -106,7 +106,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
Axis.Origin = aabb.Center - new Vector3(30, 0, 0);
|
||||
}
|
||||
|
||||
var sourceContainer = OperationSource.GetOrCreateSourceContainer(this);
|
||||
var sourceContainer = OperationSourceObject3D.GetOrCreateSourceContainer(this);
|
||||
this.Children.Modify(list =>
|
||||
{
|
||||
list.Clear();
|
||||
|
|
@ -140,7 +140,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
public override void Remove(UndoBuffer undoBuffer)
|
||||
{
|
||||
OperationSource.Remove(this);
|
||||
OperationSourceObject3D.Remove(this);
|
||||
|
||||
base.Remove(undoBuffer);
|
||||
}
|
||||
|
|
@ -46,7 +46,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
public enum MaintainRatio { None, X_Y, X_Y_Z }
|
||||
|
||||
public class FitToBounds3D : Object3D, IEditorDraw, IPropertyGridModifier
|
||||
public class FitToBoundsObject3D : Object3D, IEditorDraw, IPropertyGridModifier
|
||||
{
|
||||
[Description("Set the shape the part will be fit into.")]
|
||||
public FitType FitType { get; set; } = FitType.Box;
|
||||
|
|
@ -69,7 +69,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
[JsonIgnore]
|
||||
public IObject3D ItemToScale => Children.First().Children.First();
|
||||
|
||||
public FitToBounds3D()
|
||||
public FitToBoundsObject3D()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -138,9 +138,9 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
}
|
||||
}
|
||||
|
||||
public static FitToBounds3D Create(IObject3D itemToFit)
|
||||
public static FitToBoundsObject3D Create(IObject3D itemToFit)
|
||||
{
|
||||
FitToBounds3D fitToBounds = new FitToBounds3D();
|
||||
FitToBoundsObject3D fitToBounds = new FitToBoundsObject3D();
|
||||
var aabb = itemToFit.GetAxisAlignedBoundingBox();
|
||||
|
||||
fitToBounds.Width = aabb.XSize;
|
||||
|
|
@ -32,9 +32,9 @@ using MatterHackers.Localizations;
|
|||
|
||||
namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||
{
|
||||
public class Group3D : Object3D
|
||||
public class GroupObject3D : Object3D
|
||||
{
|
||||
public Group3D()
|
||||
public GroupObject3D()
|
||||
{
|
||||
Name = "Group".Localize();
|
||||
}
|
||||
|
|
@ -50,14 +50,14 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
using Polygon = List<IntPoint>;
|
||||
using Polygons = List<List<IntPoint>>;
|
||||
|
||||
public class ImageToPath : Object3D, IPathObject, IEditorDraw
|
||||
public class ImageToPathObject3D : Object3D, IPathObject, IEditorDraw
|
||||
{
|
||||
private ThresholdFunctions _featureDetector = ThresholdFunctions.Silhouette;
|
||||
|
||||
private ImageBuffer _histogramRawCache = null;
|
||||
private ImageBuffer _histogramDisplayCache = null;
|
||||
|
||||
public ImageToPath()
|
||||
public ImageToPathObject3D()
|
||||
{
|
||||
Name = "Image to Path".Localize();
|
||||
}
|
||||
|
|
@ -236,7 +236,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
public void DrawEditor(object sender, DrawEventArgs e)
|
||||
{
|
||||
ImageToPath.DrawPath(this);
|
||||
ImageToPathObject3D.DrawPath(this);
|
||||
}
|
||||
|
||||
public void GenerateMarchingSquaresAndLines(Action<double, string> progressReporter, ImageBuffer image, IThresholdFunction thresholdFunction)
|
||||
|
|
@ -42,7 +42,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
public class LinearExtrude : Object3D
|
||||
public class LinearExtrudeObject3D : Object3D
|
||||
{
|
||||
public double Height { get; set; } = 5;
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
Invalidate(new InvalidateArgs(this, InvalidateType.Content));
|
||||
}
|
||||
|
||||
public LinearExtrude()
|
||||
public LinearExtrudeObject3D()
|
||||
{
|
||||
Name = "Linear Extrude".Localize();
|
||||
}
|
||||
|
|
@ -225,7 +225,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
{
|
||||
List<IObject3D> itemsToReplace;
|
||||
|
||||
if (selectedItem is SelectionGroup)
|
||||
if (selectedItem is SelectionGroupObject3D)
|
||||
{
|
||||
itemsToReplace = selectedItem.Children.ToList();
|
||||
foreach (var child in itemsToReplace)
|
||||
|
|
|
|||
|
|
@ -35,14 +35,14 @@ using System.Linq;
|
|||
|
||||
namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||
{
|
||||
public class OperationSource : Object3D
|
||||
public class OperationSourceObject3D : Object3D
|
||||
{
|
||||
public OperationSource()
|
||||
public OperationSourceObject3D()
|
||||
{
|
||||
Name = "Source".Localize();
|
||||
}
|
||||
|
||||
public OperationSource(IEnumerable<IObject3D> children)
|
||||
public OperationSourceObject3D(IEnumerable<IObject3D> children)
|
||||
: this()
|
||||
{
|
||||
Visible = false;
|
||||
|
|
@ -63,10 +63,10 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
IObject3D sourceContainer;
|
||||
using (parent.RebuildLock())
|
||||
{
|
||||
sourceContainer = parent.Children.FirstOrDefault(c => c is OperationSource);
|
||||
sourceContainer = parent.Children.FirstOrDefault(c => c is OperationSourceObject3D);
|
||||
if (sourceContainer == null)
|
||||
{
|
||||
sourceContainer = new OperationSource();
|
||||
sourceContainer = new OperationSourceObject3D();
|
||||
|
||||
// Move first child to sourceContainer
|
||||
var firstChild = parent.Children.First();
|
||||
|
|
@ -89,7 +89,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
// The idea is we leave everything but the source and that is the applied operation
|
||||
parent.Children.Modify(list =>
|
||||
{
|
||||
var sourceItem = list.FirstOrDefault(c => c is OperationSource);
|
||||
var sourceItem = list.FirstOrDefault(c => c is OperationSourceObject3D);
|
||||
if (sourceItem != null)
|
||||
{
|
||||
list.Remove(sourceItem);
|
||||
|
|
@ -117,7 +117,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
{
|
||||
parent.Children.Modify(list =>
|
||||
{
|
||||
var sourceItem = list.FirstOrDefault(c => c is OperationSource);
|
||||
var sourceItem = list.FirstOrDefault(c => c is OperationSourceObject3D);
|
||||
if (sourceItem != null)
|
||||
{
|
||||
IObject3D firstChild = sourceItem.Children.First();
|
||||
|
|
@ -44,11 +44,11 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
using Polygon = List<IntPoint>;
|
||||
using Polygons = List<List<IntPoint>>;
|
||||
|
||||
public class SmoothPath : Object3D, IPathObject, IEditorDraw
|
||||
public class SmoothPathObject3D : Object3D, IPathObject, IEditorDraw
|
||||
{
|
||||
public IVertexSource VertexSource { get; set; } = new VertexStorage();
|
||||
|
||||
public SmoothPath()
|
||||
public SmoothPathObject3D()
|
||||
{
|
||||
Name = "Smooth Path".Localize();
|
||||
}
|
||||
|
|
@ -148,7 +148,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
public void DrawEditor(object sender, DrawEventArgs e)
|
||||
{
|
||||
ImageToPath.DrawPath(this);
|
||||
ImageToPathObject3D.DrawPath(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -32,6 +32,7 @@ using System.Linq;
|
|||
using System.Threading;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.DesignTools.Operations;
|
||||
using MatterHackers.MatterControl.PartPreviewWindow.View3D;
|
||||
using MatterHackers.PolygonMesh;
|
||||
|
|
@ -46,6 +47,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
public PinchObject3D()
|
||||
{
|
||||
Name = "Pinch".Localize();
|
||||
}
|
||||
|
||||
private void Rebuild(UndoBuffer undoBuffer)
|
||||
|
|
|
|||
|
|
@ -32,18 +32,18 @@ using MatterHackers.VectorMath;
|
|||
|
||||
namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||
{
|
||||
public class Rotate : Object3D
|
||||
public class RotateObject3D : Object3D
|
||||
{
|
||||
public Rotate()
|
||||
public RotateObject3D()
|
||||
{
|
||||
}
|
||||
|
||||
public Rotate(IObject3D item, double x = 0, double y = 0, double z = 0, string name = "")
|
||||
public RotateObject3D(IObject3D item, double x = 0, double y = 0, double z = 0, string name = "")
|
||||
: this(item, new Vector3(x, y, z), name)
|
||||
{
|
||||
}
|
||||
|
||||
public Rotate(IObject3D item, Vector3 translation, string name = "")
|
||||
public RotateObject3D(IObject3D item, Vector3 translation, string name = "")
|
||||
{
|
||||
Matrix *= Matrix4X4.CreateRotation(translation);
|
||||
Children.Add(item.Clone());
|
||||
|
|
@ -32,18 +32,18 @@ using MatterHackers.VectorMath;
|
|||
|
||||
namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||
{
|
||||
public class Scale : Object3D
|
||||
public class ScaleObject3D : Object3D
|
||||
{
|
||||
public Scale()
|
||||
public ScaleObject3D()
|
||||
{
|
||||
}
|
||||
|
||||
public Scale(IObject3D item, double x = 0, double y = 0, double z = 0, string name = "")
|
||||
public ScaleObject3D(IObject3D item, double x = 0, double y = 0, double z = 0, string name = "")
|
||||
: this(item, new Vector3(x, y, z), name)
|
||||
{
|
||||
}
|
||||
|
||||
public Scale(IObject3D item, Vector3 translation, string name = "")
|
||||
public ScaleObject3D(IObject3D item, Vector3 translation, string name = "")
|
||||
{
|
||||
Matrix *= Matrix4X4.CreateScale(translation);
|
||||
Children.Add(item.Clone());
|
||||
|
|
@ -34,24 +34,24 @@ using MatterHackers.VectorMath;
|
|||
|
||||
namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||
{
|
||||
public class SetCenter : Object3D
|
||||
public class SetCenterObject3D : Object3D
|
||||
{
|
||||
public SetCenter()
|
||||
public SetCenterObject3D()
|
||||
{
|
||||
}
|
||||
|
||||
public SetCenter(IObject3D item, Vector3 position)
|
||||
public SetCenterObject3D(IObject3D item, Vector3 position)
|
||||
{
|
||||
Matrix = Matrix4X4.CreateTranslation(position - item.GetCenter());
|
||||
Children.Add(item.Clone());
|
||||
}
|
||||
|
||||
public SetCenter(IObject3D item, double x, double y, double z)
|
||||
public SetCenterObject3D(IObject3D item, double x, double y, double z)
|
||||
: this(item, new Vector3(x, y, z))
|
||||
{
|
||||
}
|
||||
|
||||
public SetCenter(IObject3D item, Vector3 offset, bool onX = true, bool onY = true, bool onZ = true)
|
||||
public SetCenterObject3D(IObject3D item, Vector3 offset, bool onX = true, bool onY = true, bool onZ = true)
|
||||
{
|
||||
var center = item.GetAxisAlignedBoundingBox(Matrix4X4.Identity).Center;
|
||||
|
||||
|
|
@ -32,18 +32,18 @@ using MatterHackers.VectorMath;
|
|||
|
||||
namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||
{
|
||||
public class Translate : Object3D
|
||||
public class TranslateObject3D : Object3D
|
||||
{
|
||||
public Translate()
|
||||
public TranslateObject3D()
|
||||
{
|
||||
}
|
||||
|
||||
public Translate(IObject3D item, double x = 0, double y = 0, double z = 0)
|
||||
public TranslateObject3D(IObject3D item, double x = 0, double y = 0, double z = 0)
|
||||
: this(item, new Vector3(x, y, z))
|
||||
{
|
||||
}
|
||||
|
||||
public Translate(IObject3D item, Vector3 translation)
|
||||
public TranslateObject3D(IObject3D item, Vector3 translation)
|
||||
{
|
||||
Matrix *= Matrix4X4.CreateTranslation(translation);
|
||||
Children.Add(item.Clone());
|
||||
|
|
@ -39,7 +39,7 @@ using MatterHackers.VectorMath;
|
|||
|
||||
namespace MatterHackers.MatterControl.Library
|
||||
{
|
||||
public class InsertionGroup : Object3D
|
||||
public class InsertionGroupObject3D : Object3D
|
||||
{
|
||||
public event EventHandler ContentLoaded;
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
public Task LoadingItemsTask { get; }
|
||||
|
||||
static InsertionGroup()
|
||||
static InsertionGroupObject3D()
|
||||
{
|
||||
// Create the placeholder mesh and position it at z0
|
||||
placeHolderMesh = PlatonicSolids.CreateCube(20, 20, 20);
|
||||
|
|
@ -58,7 +58,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
}
|
||||
|
||||
// TODO: Figure out how best to collapse the InsertionGroup after the load task completes
|
||||
public InsertionGroup(IEnumerable<ILibraryItem> items, View3DWidget view3DWidget, InteractiveScene scene, Vector2 bedCenter, Func<bool> dragOperationActive, bool trackSourceFiles = false)
|
||||
public InsertionGroupObject3D(IEnumerable<ILibraryItem> items, View3DWidget view3DWidget, InteractiveScene scene, Vector2 bedCenter, Func<bool> dragOperationActive, bool trackSourceFiles = false)
|
||||
{
|
||||
if(items == null)
|
||||
{
|
||||
|
|
@ -401,7 +401,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
|
||||
var sceneChildren = scene.Children.ToList();
|
||||
|
||||
var injector = new InsertionGroup(new[] { itemModel }, activeContext.View3DWidget, scene, bedCenter, () => false);
|
||||
var injector = new InsertionGroupObject3D(new[] { itemModel }, activeContext.View3DWidget, scene, bedCenter, () => false);
|
||||
injector.ContentLoaded += (s, args) =>
|
||||
{
|
||||
// Get the bounds of the loaded InsertionGroup with all of its content
|
||||
|
|
|
|||
|
|
@ -92,16 +92,27 @@
|
|||
<Compile Include="DesignTools\Attributes\ShowUpdateButtonAttribute.cs" />
|
||||
<Compile Include="DesignTools\EditableTypes\DirectionAxis.cs" />
|
||||
<Compile Include="DesignTools\EditableTypes\DirectionVector.cs" />
|
||||
<Compile Include="DesignTools\Operations\Group3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\Align2D.cs" />
|
||||
<Compile Include="DesignTools\Operations\AlignObject3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\ArrayAdvancedObject3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\ArrayLinearObject3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\ArrayRadialObject3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\FitToBoundsObject3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\GroupObject3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\Image\AlphaThresholdFunction.cs" />
|
||||
<Compile Include="DesignTools\Operations\Image\HueThresholdFunction.cs" />
|
||||
<Compile Include="DesignTools\Operations\Image\ImageToPath.cs" />
|
||||
<Compile Include="DesignTools\Operations\Image\ImageToPathObject3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\Image\IThresholdFunction.cs" />
|
||||
<Compile Include="DesignTools\Operations\Image\LinearExtrude.cs" />
|
||||
<Compile Include="DesignTools\Operations\Image\LinearExtrudeObject3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\Image\MapOnMaxIntensity.cs" />
|
||||
<Compile Include="DesignTools\Operations\Image\SilhouetteThresholdFunction.cs" />
|
||||
<Compile Include="DesignTools\Operations\OperationSource.cs" />
|
||||
<Compile Include="DesignTools\Operations\OperationSourceObject3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\Path\SmoothPathObject3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\PinchObject3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\RotateObject3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\ScaleObject3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\SetCenterObject3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\TranslateObject3D.cs" />
|
||||
<Compile Include="DesignTools\Primitives\ComponentObject3D.cs" />
|
||||
<Compile Include="DesignTools\Primitives\CubeObject3D.cs" />
|
||||
<Compile Include="DesignTools\Primitives\HalfCylinderObject3D.cs" />
|
||||
|
|
@ -110,6 +121,7 @@
|
|||
<Compile Include="Library\Providers\MatterControl\LibraryCollectionContainer.cs" />
|
||||
<Compile Include="Library\Providers\MatterControl\PartHistoryContainer.cs" />
|
||||
<Compile Include="Library\Providers\MatterControl\RootHistoryContainer.cs" />
|
||||
<Compile Include="Library\Widgets\InsertionGroupObject3D.cs" />
|
||||
<Compile Include="PartPreviewWindow\GCodeDetails\BoolOption.cs" />
|
||||
<Compile Include="PartPreviewWindow\GCodeDetails\GCodeLayerDetailsView.cs" />
|
||||
<Compile Include="PartPreviewWindow\GCodeDetails\GCodeOptionsPanel.cs" />
|
||||
|
|
@ -122,6 +134,7 @@
|
|||
<Compile Include="PartPreviewWindow\StartPage\StartTabPage.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\Actions\CombineObject3D.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\Actions\IntersectionObject3D.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\Actions\ModifiedMeshObject3D.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\Actions\SubtractAndReplaceObject3D.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\Actions\SubtractObject3D.cs" />
|
||||
<Compile Include="PrinterControls\ControlWidgets\CalibrationControls.cs" />
|
||||
|
|
@ -150,16 +163,8 @@
|
|||
<Compile Include="DesignTools\Interfaces\IEditorDraw.cs" />
|
||||
<Compile Include="DesignTools\Interfaces\IPropertyGridModifier.cs" />
|
||||
<Compile Include="DesignTools\Lithophane.cs" />
|
||||
<Compile Include="DesignTools\Operations\Align3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\ArrayAdvanced3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\ArrayLinear3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\ArrayRadial3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\CurveObject3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\FitToBounds3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\Object3DExtensions.cs" />
|
||||
<Compile Include="DesignTools\Operations\Rotate.cs" />
|
||||
<Compile Include="DesignTools\Operations\Scale.cs" />
|
||||
<Compile Include="DesignTools\Operations\Path\SmoothPath.cs" />
|
||||
<Compile Include="DesignTools\Primitives\BaseObject3D.cs" />
|
||||
<Compile Include="DesignTools\Primitives\ImageObject3D.cs" />
|
||||
<Compile Include="DesignTools\Primitives\RingObject3D.cs" />
|
||||
|
|
@ -172,8 +177,6 @@
|
|||
<Compile Include="DesignTools\Primitives\TorusObject3D.cs" />
|
||||
<Compile Include="DesignTools\PublicPropertyEditor.cs" />
|
||||
<Compile Include="DesignTools\Primitives\ConeObject3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\SetCenter.cs" />
|
||||
<Compile Include="DesignTools\Operations\Translate.cs" />
|
||||
<Compile Include="DesignTools\Attributes\SortableAttribute.cs" />
|
||||
<Compile Include="DesignTools\Attributes\UnlockLinkAttribute.cs" />
|
||||
<Compile Include="Library\Providers\FileSystem\McxContainer.cs" />
|
||||
|
|
@ -224,7 +227,6 @@
|
|||
<Compile Include="Library\Providers\MatterControl\PrintHistoryItem.cs" />
|
||||
<Compile Include="Library\Providers\WritableContainer.cs" />
|
||||
<Compile Include="Library\Widgets\ExpandCheckboxButton.cs" />
|
||||
<Compile Include="Library\Widgets\InsertionGroup.cs" />
|
||||
<Compile Include="PartPreviewWindow\NewTabButton.cs" />
|
||||
<Compile Include="PartPreviewWindow\PartTabPage.cs" />
|
||||
<Compile Include="PartPreviewWindow\StartPage\ExploreItem.cs" />
|
||||
|
|
@ -238,7 +240,6 @@
|
|||
<Compile Include="PartPreviewWindow\SectionWidget.cs" />
|
||||
<Compile Include="PartPreviewWindow\SliceLayerSelector.cs" />
|
||||
<Compile Include="PartPreviewWindow\Toolbar.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\Actions\MeshWrapper.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\PrinterBar\CancelButton.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\PrinterBar\PauseResumeButton.cs" />
|
||||
<Compile Include="Library\ReadOnlyStreamItem.cs" />
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
private static TreeNode AddTree(ObjectView item, TreeNode parent, ThemeConfig theme)
|
||||
{
|
||||
// Suppress MeshWrapper and OperationSource nodes in tree
|
||||
bool shouldCollapseToParent = item.Source is MeshWrapper || item.Source is OperationSource;
|
||||
bool shouldCollapseToParent = item.Source is ModifiedMeshObject3D || item.Source is OperationSourceObject3D;
|
||||
var contextNode = (shouldCollapseToParent && parent != null) ? parent : AddItem(item, parent, theme);
|
||||
|
||||
contextNode.SuspendLayout();
|
||||
|
|
@ -72,7 +72,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
private static TreeNode AddItem(ObjectView item, TreeNode parentNode, ThemeConfig theme)
|
||||
{
|
||||
if(item.Source is InsertionGroup insertionGroup)
|
||||
if(item.Source is InsertionGroupObject3D insertionGroup)
|
||||
{
|
||||
return new TreeNode()
|
||||
{
|
||||
|
|
@ -125,7 +125,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
switch (item)
|
||||
{
|
||||
case FitToBounds3D fitToBounds3D:
|
||||
case FitToBoundsObject3D fitToBounds3D:
|
||||
return new ObjectView()
|
||||
{
|
||||
Children = new IObject3D[] { fitToBounds3D.ItemToScale },
|
||||
|
|
@ -133,27 +133,27 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
Source = item
|
||||
};
|
||||
|
||||
case ArrayLinear3D arrayLinear3D:
|
||||
case ArrayLinearObject3D arrayLinear3D:
|
||||
return new ObjectView()
|
||||
{
|
||||
Children = item.Children.OfType<OperationSource>().ToList(),
|
||||
Children = item.Children.OfType<OperationSourceObject3D>().ToList(),
|
||||
Name = $"{arrayLinear3D.Name} ({arrayLinear3D.Count})",
|
||||
Source = item
|
||||
};
|
||||
|
||||
case ArrayAdvanced3D arrayAdvanced3D:
|
||||
case ArrayAdvancedObject3D arrayAdvanced3D:
|
||||
return new ObjectView()
|
||||
{
|
||||
Children = item.Children.OfType<OperationSource>().ToList(),
|
||||
Children = item.Children.OfType<OperationSourceObject3D>().ToList(),
|
||||
Name = $"{arrayAdvanced3D.Name} ({arrayAdvanced3D.Count})",
|
||||
Source = item
|
||||
};
|
||||
|
||||
// TODO: array operations should only expose OperationSource
|
||||
case ArrayRadial3D arrayRadial3D:
|
||||
case ArrayRadialObject3D arrayRadial3D:
|
||||
return new ObjectView()
|
||||
{
|
||||
Children = item.Children.OfType<OperationSource>().ToList(),
|
||||
Children = item.Children.OfType<OperationSourceObject3D>().ToList(),
|
||||
Name = $"{arrayRadial3D.Name} ({arrayRadial3D.Count})",
|
||||
Source = item
|
||||
};
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
using (wrapper.RebuildLock())
|
||||
{
|
||||
var remove = wrapper.Parent;
|
||||
while (remove is MeshWrapper)
|
||||
while (remove is ModifiedMeshObject3D)
|
||||
{
|
||||
var hold = remove;
|
||||
remove.Remove(null);
|
||||
|
|
@ -202,11 +202,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
if (!child.DescendantsAndSelf().Where((c) => c.OwnerID == this.ID).Any())
|
||||
{
|
||||
// wrap the child
|
||||
child.Parent.Children.Modify((list) =>
|
||||
child.Parent.Children.Modify((System.Action<List<IObject3D>>)((List<IObject3D> list) =>
|
||||
{
|
||||
list.Remove(child);
|
||||
list.Add(new MeshWrapper(child, this.ID));
|
||||
});
|
||||
list.Add((IObject3D)new ModifiedMeshObject3D(child, this.ID));
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,9 +38,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
/// The goal of MeshWrapper is to provide a mutated version of a source item by some operation. To do so we wrap and clone all
|
||||
/// properties of the source item and reset the source matrix to Identity, given that it now exists on the wrapping parent.
|
||||
/// </summary>
|
||||
public class MeshWrapper : Object3D
|
||||
public class ModifiedMeshObject3D : Object3D
|
||||
{
|
||||
public MeshWrapper()
|
||||
public ModifiedMeshObject3D()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
base.OnInvalidate(invalidateType);
|
||||
}
|
||||
|
||||
public MeshWrapper(IObject3D child, string ownerId)
|
||||
public ModifiedMeshObject3D(IObject3D child, string ownerId)
|
||||
{
|
||||
Children.Add(child);
|
||||
|
||||
|
|
@ -519,7 +519,7 @@ namespace MatterHackers.MeshVisualizer
|
|||
var selectedItem = scene.SelectedItem;
|
||||
bool isSelected = selectedItem != null
|
||||
&& (selectedItem.DescendantsAndSelf().Any((i) => i == item)
|
||||
|| selectedItem.Parents<MeshWrapper>().Any((mw) => mw == item));
|
||||
|| selectedItem.Parents<ModifiedMeshObject3D>().Any((mw) => mw == item));
|
||||
|
||||
if (isSelected && scene.DrawSelection)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
var selectedItems = new List<IObject3D>();
|
||||
if (selectedItem != null)
|
||||
{
|
||||
if (selectedItem is SelectionGroup)
|
||||
if (selectedItem is SelectionGroupObject3D)
|
||||
{
|
||||
selectedItems = selectedItem.Children.ToList();
|
||||
}
|
||||
|
|
@ -183,7 +183,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
if (sourceItem != null)
|
||||
{
|
||||
if (sourceItem is SelectionGroup)
|
||||
if (sourceItem is SelectionGroupObject3D)
|
||||
{
|
||||
// the selection is a group of objects that need to be copied
|
||||
var copyList = sourceItem.Children.ToList();
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
public ChangeColor(IObject3D selectedItem, Color color)
|
||||
{
|
||||
this.color = color;
|
||||
if (selectedItem is SelectionGroup)
|
||||
if (selectedItem is SelectionGroupObject3D)
|
||||
{
|
||||
SetData(selectedItem.Children.ToList());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
this.scene = scene;
|
||||
|
||||
if (deletingItem is SelectionGroup)
|
||||
if (deletingItem is SelectionGroupObject3D)
|
||||
{
|
||||
var childrenToAdd = deletingItem.Children;
|
||||
// push whatever happened to the selection into the objects before saving them
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public MakeSupport(IObject3D selectedItem)
|
||||
{
|
||||
if (selectedItem is SelectionGroup)
|
||||
if (selectedItem is SelectionGroupObject3D)
|
||||
{
|
||||
SetData(selectedItem.Children.ToList());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public TransformCommand(IObject3D transformedObject, Matrix4X4 undoTransform, Matrix4X4 redoTransform)
|
||||
{
|
||||
if (transformedObject is SelectionGroup)
|
||||
if (transformedObject is SelectionGroupObject3D)
|
||||
{
|
||||
// move the group transform into the items
|
||||
foreach (var child in transformedObject.Children)
|
||||
|
|
|
|||
|
|
@ -383,7 +383,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public bool DragOperationActive { get; private set; }
|
||||
|
||||
public InsertionGroup DragDropObject { get; private set; }
|
||||
public InsertionGroupObject3D DragDropObject { get; private set; }
|
||||
|
||||
public ILibraryAssetStream SceneReplacement { get; private set; }
|
||||
|
||||
|
|
@ -458,7 +458,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
// Set the hitplane to the bed plane
|
||||
CurrentSelectInfo.HitPlane = bedPlane;
|
||||
|
||||
var insertionGroup = new InsertionGroup(
|
||||
var insertionGroup = new InsertionGroupObject3D(
|
||||
items,
|
||||
this,
|
||||
Scene,
|
||||
|
|
@ -1118,7 +1118,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
if (hitObject != null)
|
||||
{
|
||||
if (Scene.SelectedItem == hitObject
|
||||
&& !(Scene.SelectedItem is SelectionGroup))
|
||||
&& !(Scene.SelectedItem is SelectionGroupObject3D))
|
||||
{
|
||||
Scene.SelectedItem = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit f7fd7d6188ea93d03dd9c42045a9da8e073a4bc9
|
||||
Subproject commit 5f061f7ce5892cfbb0982c09fc777ec8e3dbd1fe
|
||||
|
|
@ -563,10 +563,10 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
// wait for the object to be added
|
||||
testRunner.WaitFor(() => scene.Children.Count == preAddCount + 1);
|
||||
// wait for the object to be done loading
|
||||
var insertionGroup = scene.Children.LastOrDefault() as InsertionGroup;
|
||||
var insertionGroup = scene.Children.LastOrDefault() as InsertionGroupObject3D;
|
||||
if (insertionGroup != null)
|
||||
{
|
||||
testRunner.WaitFor(() => scene.Children.LastOrDefault() as InsertionGroup != null, 10);
|
||||
testRunner.WaitFor(() => scene.Children.LastOrDefault() as InsertionGroupObject3D != null, 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,9 +82,9 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
Height = BaseHeight
|
||||
};
|
||||
textObject.Invalidate(new InvalidateArgs(textObject, InvalidateType.Properties, null));
|
||||
IObject3D letterObject = new Rotate(textObject, -MathHelper.Tau / 4);
|
||||
letterObject = new Align3D(letterObject, FaceAlign.Bottom | FaceAlign.Front, brailleLetter, FaceAlign.Top | FaceAlign.Front, 0, 0, 3.5);
|
||||
letterObject = new SetCenter(letterObject, brailleLetter.GetCenter(), true, false, false);
|
||||
IObject3D letterObject = new RotateObject3D(textObject, -MathHelper.Tau / 4);
|
||||
letterObject = new AlignObject3D(letterObject, FaceAlign.Bottom | FaceAlign.Front, brailleLetter, FaceAlign.Top | FaceAlign.Front, 0, 0, 3.5);
|
||||
letterObject = new SetCenterObject3D(letterObject, brailleLetter.GetCenter(), true, false, false);
|
||||
this.Children.Add(letterObject);
|
||||
|
||||
var basePath = new RoundedRect(0, 0, 22, 34, 3)
|
||||
|
|
@ -98,13 +98,13 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
Matrix = Matrix4X4.CreateRotationX(MathHelper.Tau / 4)
|
||||
};
|
||||
|
||||
basePlate = new Align3D(basePlate, FaceAlign.Bottom | FaceAlign.Back, brailleLetter, FaceAlign.Bottom | FaceAlign.Back);
|
||||
basePlate = new SetCenter(basePlate, brailleLetter.GetCenter(), true, false, false);
|
||||
basePlate = new AlignObject3D(basePlate, FaceAlign.Bottom | FaceAlign.Back, brailleLetter, FaceAlign.Bottom | FaceAlign.Back);
|
||||
basePlate = new SetCenterObject3D(basePlate, brailleLetter.GetCenter(), true, false, false);
|
||||
this.Children.Add(basePlate);
|
||||
|
||||
IObject3D underline = new CubeObject3D(basePlate.XSize(), .2, 1);
|
||||
underline = new Align3D(underline, FaceAlign.Bottom, brailleLetter, FaceAlign.Top);
|
||||
underline = new Align3D(underline, FaceAlign.Back | FaceAlign.Left, basePlate, FaceAlign.Front | FaceAlign.Left, 0, .01);
|
||||
underline = new AlignObject3D(underline, FaceAlign.Bottom, brailleLetter, FaceAlign.Top);
|
||||
underline = new AlignObject3D(underline, FaceAlign.Back | FaceAlign.Left, basePlate, FaceAlign.Front | FaceAlign.Left, 0, .01);
|
||||
this.Children.Add(underline);
|
||||
|
||||
if (aabb.ZSize > 0)
|
||||
|
|
|
|||
|
|
@ -195,8 +195,8 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
Mesh = VertexSourceToMesh.Extrude(basePath, BaseHeight)
|
||||
};
|
||||
|
||||
basePlate = new Align3D(basePlate, FaceAlign.Top, textObject, FaceAlign.Bottom, 0, 0, .01);
|
||||
basePlate = new Align3D(basePlate, FaceAlign.Left | FaceAlign.Front,
|
||||
basePlate = new AlignObject3D(basePlate, FaceAlign.Top, textObject, FaceAlign.Bottom, 0, 0, .01);
|
||||
basePlate = new AlignObject3D(basePlate, FaceAlign.Left | FaceAlign.Front,
|
||||
size.Left - padding/2,
|
||||
size.Bottom - padding/2);
|
||||
this.Children.Add(basePlate);
|
||||
|
|
@ -235,7 +235,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
Matrix = Matrix4X4.CreateRotationX(MathHelper.Tau / 4)
|
||||
};
|
||||
|
||||
chainHook = new Align3D(chainHook, FaceAlign.Left | FaceAlign.Bottom | FaceAlign.Back, basePlate, FaceAlign.Right | FaceAlign.Bottom | FaceAlign.Back, -.01);
|
||||
chainHook = new AlignObject3D(chainHook, FaceAlign.Left | FaceAlign.Bottom | FaceAlign.Back, basePlate, FaceAlign.Right | FaceAlign.Bottom | FaceAlign.Back, -.01);
|
||||
|
||||
this.Children.Add(chainHook);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue