commit
19774e3d4e
7 changed files with 109 additions and 46 deletions
|
|
@ -367,6 +367,10 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
private RectangleDouble _meshAllowedBounds;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The bounds that a mesh can be placed at and the gcode it creates will be within the bed
|
/// The bounds that a mesh can be placed at and the gcode it creates will be within the bed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -375,38 +379,48 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var firstLayerExtrusionWidth = GetDouble(SettingsKey.first_layer_extrusion_width);
|
if (_meshAllowedBounds.Width == 0)
|
||||||
var bedBounds = BedBounds;
|
|
||||||
var totalOffset = 0.0;
|
|
||||||
|
|
||||||
if (GetBool(SettingsKey.create_raft))
|
|
||||||
{
|
|
||||||
// The slicing engine creates a raft 3x the extrusion width
|
|
||||||
firstLayerExtrusionWidth *= 3;
|
|
||||||
totalOffset += firstLayerExtrusionWidth;
|
|
||||||
totalOffset += GetDouble(SettingsKey.raft_extra_distance_around_part);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetBool(SettingsKey.create_skirt))
|
|
||||||
{
|
{
|
||||||
totalOffset += GetValue<double>(SettingsKey.skirt_distance);
|
CacluateMeshAllowedBounds();
|
||||||
totalOffset += (GetDouble(SettingsKey.skirts) + .5) * firstLayerExtrusionWidth;
|
|
||||||
// for every 400mm of min skirt length add another skirt loops
|
|
||||||
totalOffset += GetDouble(SettingsKey.min_skirt_length) / (20 * 20);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetBool(SettingsKey.create_brim)
|
return _meshAllowedBounds;
|
||||||
&& !GetBool(SettingsKey.create_raft))
|
|
||||||
{
|
|
||||||
totalOffset += GetValue<double>(SettingsKey.brims) * GetDouble(SettingsKey.first_layer_extrusion_width);
|
|
||||||
}
|
|
||||||
|
|
||||||
bedBounds.Inflate(-totalOffset);
|
|
||||||
|
|
||||||
return bedBounds;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CacluateMeshAllowedBounds()
|
||||||
|
{
|
||||||
|
var firstLayerExtrusionWidth = GetDouble(SettingsKey.first_layer_extrusion_width);
|
||||||
|
var bedBounds = BedBounds;
|
||||||
|
var totalOffset = 0.0;
|
||||||
|
|
||||||
|
if (GetBool(SettingsKey.create_raft))
|
||||||
|
{
|
||||||
|
// The slicing engine creates a raft 3x the extrusion width
|
||||||
|
firstLayerExtrusionWidth *= 3;
|
||||||
|
totalOffset += firstLayerExtrusionWidth;
|
||||||
|
totalOffset += GetDouble(SettingsKey.raft_extra_distance_around_part);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetBool(SettingsKey.create_skirt))
|
||||||
|
{
|
||||||
|
totalOffset += GetValue<double>(SettingsKey.skirt_distance);
|
||||||
|
totalOffset += (GetDouble(SettingsKey.skirts) + .5) * firstLayerExtrusionWidth;
|
||||||
|
// for every 400mm of min skirt length add another skirt loops
|
||||||
|
totalOffset += GetDouble(SettingsKey.min_skirt_length) / (20 * 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetBool(SettingsKey.create_brim)
|
||||||
|
&& !GetBool(SettingsKey.create_raft))
|
||||||
|
{
|
||||||
|
totalOffset += GetValue<double>(SettingsKey.brims) * GetDouble(SettingsKey.first_layer_extrusion_width);
|
||||||
|
}
|
||||||
|
|
||||||
|
bedBounds.Inflate(-totalOffset);
|
||||||
|
|
||||||
|
_meshAllowedBounds = bedBounds;
|
||||||
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public IEnumerable<PrinterSettingsLayer> DefaultLayerCascade
|
public IEnumerable<PrinterSettingsLayer> DefaultLayerCascade
|
||||||
{
|
{
|
||||||
|
|
@ -1028,6 +1042,22 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
this.ResetHotendBounds();
|
this.ResetHotendBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (slicerConfigName == SettingsKey.first_layer_extrusion_width
|
||||||
|
|| slicerConfigName == SettingsKey.create_raft
|
||||||
|
|| slicerConfigName == SettingsKey.raft_extra_distance_around_part
|
||||||
|
|| slicerConfigName == SettingsKey.create_skirt
|
||||||
|
|| slicerConfigName == SettingsKey.skirt_distance
|
||||||
|
|| slicerConfigName == SettingsKey.skirts
|
||||||
|
|| slicerConfigName == SettingsKey.min_skirt_length
|
||||||
|
|| slicerConfigName == SettingsKey.create_brim
|
||||||
|
|| slicerConfigName == SettingsKey.print_center
|
||||||
|
|| slicerConfigName == SettingsKey.bed_size
|
||||||
|
|| slicerConfigName == SettingsKey.bed_shape)
|
||||||
|
{
|
||||||
|
// cleare this so it will be recaculated
|
||||||
|
_meshAllowedBounds = new RectangleDouble();
|
||||||
|
}
|
||||||
|
|
||||||
SettingChanged?.Invoke(this, new StringEventArgs(slicerConfigName));
|
SettingChanged?.Invoke(this, new StringEventArgs(slicerConfigName));
|
||||||
AnyPrinterSettingChanged?.Invoke(this, new StringEventArgs(slicerConfigName));
|
AnyPrinterSettingChanged?.Invoke(this, new StringEventArgs(slicerConfigName));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -762,7 +762,12 @@ namespace MatterHackers.MatterControl
|
||||||
await this.MainView.CreateNewDesignTab(false);
|
await this.MainView.CreateNewDesignTab(false);
|
||||||
|
|
||||||
var workspace = this.Workspaces.Last();
|
var workspace = this.Workspaces.Last();
|
||||||
workspace.SceneContext.AddToPlate(selectedLibraryItems);
|
var insertionGroup = workspace.SceneContext.AddToPlate(selectedLibraryItems);
|
||||||
|
|
||||||
|
// wait for the insertion to finish
|
||||||
|
await insertionGroup.LoadingItemsTask;
|
||||||
|
// then clear the undo buffer so we don't ask to save and undoing does not remove the starting part
|
||||||
|
workspace.SceneContext.Scene.UndoBuffer.ClearHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void BlinkTab(ITab tab)
|
internal void BlinkTab(ITab tab)
|
||||||
|
|
|
||||||
|
|
@ -72,13 +72,20 @@ namespace MatterHackers.MatterControl
|
||||||
|
|
||||||
private RunningInterval checkForSceneLayer;
|
private RunningInterval checkForSceneLayer;
|
||||||
private object locker = new object();
|
private object locker = new object();
|
||||||
|
private ulong undoBufferHashCode = 0;
|
||||||
|
|
||||||
private PrinterSettingsLayer GetSceneLayer()
|
private PrinterSettingsLayer GetSceneLayer()
|
||||||
{
|
{
|
||||||
var scene = Bed?.Scene;
|
var scene = Bed?.Scene;
|
||||||
if (scene != null)
|
if (scene != null)
|
||||||
{
|
{
|
||||||
var foundPartSettings = false;
|
if (sceneOverrides != null
|
||||||
|
&& undoBufferHashCode == scene.UndoBuffer.GetLongHashCode())
|
||||||
|
{
|
||||||
|
return sceneOverrides;
|
||||||
|
}
|
||||||
|
|
||||||
|
var foundPartSettings = false;
|
||||||
var newSceneOverrides = new PrinterSettingsLayer();
|
var newSceneOverrides = new PrinterSettingsLayer();
|
||||||
// accumulate all the scene overrides ordered by their names, which is the order they will be in the design tree
|
// accumulate all the scene overrides ordered by their names, which is the order they will be in the design tree
|
||||||
foreach (var partSettingsObject in scene.DescendantsAndSelf().Where(c => c is PartSettingsObject3D && c.Parent?.WorldPrintable() == true).OrderBy(i => i.Name))
|
foreach (var partSettingsObject in scene.DescendantsAndSelf().Where(c => c is PartSettingsObject3D && c.Parent?.WorldPrintable() == true).OrderBy(i => i.Name))
|
||||||
|
|
@ -155,6 +162,7 @@ namespace MatterHackers.MatterControl
|
||||||
}
|
}
|
||||||
|
|
||||||
// return the current set
|
// return the current set
|
||||||
|
undoBufferHashCode = scene.UndoBuffer.GetLongHashCode();
|
||||||
return sceneOverrides;
|
return sceneOverrides;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ namespace MatterHackers.MatterControl
|
||||||
}
|
}
|
||||||
|
|
||||||
var worldMatrix = item.WorldMatrix();
|
var worldMatrix = item.WorldMatrix();
|
||||||
// probably need , true (require precision)
|
// probably need, true (require precision)
|
||||||
var aabb = item.Mesh.GetAxisAlignedBoundingBox(worldMatrix);
|
var aabb = item.Mesh.GetAxisAlignedBoundingBox(worldMatrix);
|
||||||
|
|
||||||
var bed = printerConfig.Bed;
|
var bed = printerConfig.Bed;
|
||||||
|
|
|
||||||
|
|
@ -170,6 +170,9 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||||
{
|
{
|
||||||
Action = () =>
|
Action = () =>
|
||||||
{
|
{
|
||||||
|
var startingOverrides = new PrinterSettingsLayer(Overrides);
|
||||||
|
var editOverrides = new PrinterSettingsLayer(Overrides);
|
||||||
|
|
||||||
var settingsContext = new SettingsContext(containingPrinter, null, NamedSettingsLayers.All);
|
var settingsContext = new SettingsContext(containingPrinter, null, NamedSettingsLayers.All);
|
||||||
foreach (var setting in containingPrinter.Settings.UserLayer.ToList())
|
foreach (var setting in containingPrinter.Settings.UserLayer.ToList())
|
||||||
{
|
{
|
||||||
|
|
@ -180,21 +183,30 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||||
&& SliceSettingsLayouts.ContainesKey(SliceSettingsLayouts.SliceSettings(), setting.Key)
|
&& SliceSettingsLayouts.ContainesKey(SliceSettingsLayouts.SliceSettings(), setting.Key)
|
||||||
&& SliceSettingsTabView.CheckIfShouldBeShown(PrinterSettings.SettingsData[setting.Key], settingsContext))
|
&& SliceSettingsTabView.CheckIfShouldBeShown(PrinterSettings.SettingsData[setting.Key], settingsContext))
|
||||||
{
|
{
|
||||||
Overrides[setting.Key] = setting.Value;
|
editOverrides[setting.Key] = setting.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var setting in Overrides.ToList())
|
foreach (var setting in editOverrides.ToList())
|
||||||
{
|
{
|
||||||
if (!SliceSettingsLayouts.ContainesKey(SliceSettingsLayouts.SliceSettings(), setting.Key)
|
if (!SliceSettingsLayouts.ContainesKey(SliceSettingsLayouts.SliceSettings(), setting.Key)
|
||||||
|| !SliceSettingsTabView.CheckIfShouldBeShown(PrinterSettings.SettingsData[setting.Key], settingsContext))
|
|| !SliceSettingsTabView.CheckIfShouldBeShown(PrinterSettings.SettingsData[setting.Key], settingsContext))
|
||||||
{
|
{
|
||||||
Overrides.Remove(setting.Key);
|
editOverrides.Remove(setting.Key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var scene = this.ContainingScene();
|
||||||
UpdateSettingsDisplay();
|
scene.UndoBuffer.AddAndDo(new UndoRedoActions(() =>
|
||||||
|
{
|
||||||
|
Overrides = new PrinterSettingsLayer(startingOverrides);
|
||||||
|
UpdateSettingsDisplay();
|
||||||
|
},
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
Overrides = new PrinterSettingsLayer(editOverrides);
|
||||||
|
UpdateSettingsDisplay();
|
||||||
|
}));
|
||||||
},
|
},
|
||||||
Name = "Add User Overrides".Localize(),
|
Name = "Add User Overrides".Localize(),
|
||||||
HelpText = "Copy in all current user overides".Localize()
|
HelpText = "Copy in all current user overides".Localize()
|
||||||
|
|
@ -207,7 +219,9 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||||
Action = () =>
|
Action = () =>
|
||||||
{
|
{
|
||||||
var settings = new PrinterSettings();
|
var settings = new PrinterSettings();
|
||||||
settings.GetSceneLayer = () => Overrides;
|
var startingOverrides = new PrinterSettingsLayer(Overrides);
|
||||||
|
var editOverrides = new PrinterSettingsLayer(Overrides);
|
||||||
|
settings.GetSceneLayer = () => editOverrides;
|
||||||
var printer = new PrinterConfig(settings);
|
var printer = new PrinterConfig(settings);
|
||||||
if (containingPrinter != null)
|
if (containingPrinter != null)
|
||||||
{
|
{
|
||||||
|
|
@ -216,9 +230,9 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||||
|
|
||||||
// set this after the PrinterConfig is constructed to change it to overrides
|
// set this after the PrinterConfig is constructed to change it to overrides
|
||||||
// set this after the PrinterConfig is constructed to change it to overrides
|
// set this after the PrinterConfig is constructed to change it to overrides
|
||||||
settings.GetSceneLayer = () => Overrides;
|
settings.GetSceneLayer = () => editOverrides;
|
||||||
|
|
||||||
var presetsContext = new PresetsContext(null, Overrides)
|
var presetsContext = new PresetsContext(null, editOverrides)
|
||||||
{
|
{
|
||||||
LayerType = NamedSettingsLayers.Scene,
|
LayerType = NamedSettingsLayers.Scene,
|
||||||
};
|
};
|
||||||
|
|
@ -227,9 +241,21 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||||
editPartSettingsPresetsPage.Closed += (s, e2) =>
|
editPartSettingsPresetsPage.Closed += (s, e2) =>
|
||||||
{
|
{
|
||||||
ApplicationController.Instance.AcitveSlicePresetsPage = null;
|
ApplicationController.Instance.AcitveSlicePresetsPage = null;
|
||||||
UpdateSettingsDisplay();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
// push the new settings into this object
|
||||||
|
var scene = this.ContainingScene();
|
||||||
|
scene.UndoBuffer.AddAndDo(new UndoRedoActions(() =>
|
||||||
|
{
|
||||||
|
Overrides = new PrinterSettingsLayer(startingOverrides);
|
||||||
|
UpdateSettingsDisplay();
|
||||||
|
},
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
Overrides = new PrinterSettingsLayer(editOverrides);
|
||||||
|
UpdateSettingsDisplay();
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
ApplicationController.Instance.AcitveSlicePresetsPage = editPartSettingsPresetsPage;
|
ApplicationController.Instance.AcitveSlicePresetsPage = editPartSettingsPresetsPage;
|
||||||
DialogWindow.Show(editPartSettingsPresetsPage);
|
DialogWindow.Show(editPartSettingsPresetsPage);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -155,12 +155,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
||||||
{
|
{
|
||||||
foreach (var keep in keepObjects.Select((r) => (obj3D: r, matrix: r.WorldMatrix())).ToList())
|
foreach (var keep in keepObjects.Select((r) => (obj3D: r, matrix: r.WorldMatrix())).ToList())
|
||||||
{
|
{
|
||||||
progressStatus.Status = "Copy Remove";
|
|
||||||
reporter?.Report(progressStatus);
|
|
||||||
|
|
||||||
progressStatus.Status = "Copy Keep";
|
|
||||||
reporter?.Report(progressStatus);
|
|
||||||
|
|
||||||
progressStatus.Status = "Do CSG";
|
progressStatus.Status = "Do CSG";
|
||||||
reporter?.Report(progressStatus);
|
reporter?.Report(progressStatus);
|
||||||
var result = BooleanProcessing.Do(keep.obj3D.Mesh,
|
var result = BooleanProcessing.Do(keep.obj3D.Mesh,
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit ba0221a7cfee2aeceb8980ed2113d107b42709c0
|
Subproject commit 09c9c93a84e57821ec65c17114acb629ac5320af
|
||||||
Loading…
Add table
Add a link
Reference in a new issue