Merge pull request #2142 from larsbrubaker/design_tools
Taking out center on bed for design tools.
This commit is contained in:
commit
dce488ccc8
11 changed files with 16 additions and 69 deletions
|
|
@ -111,8 +111,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
if (stringEvent.Data == SettingsKey.bed_size
|
||||
|| stringEvent.Data == SettingsKey.print_center
|
||||
|| stringEvent.Data == SettingsKey.build_height
|
||||
|| stringEvent.Data == SettingsKey.bed_shape
|
||||
|| stringEvent.Data == SettingsKey.center_part_on_bed)
|
||||
|| stringEvent.Data == SettingsKey.bed_shape)
|
||||
{
|
||||
needToRecreateBed = true;
|
||||
}
|
||||
|
|
@ -132,23 +131,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.print_center),
|
||||
ActiveSliceSettings.Instance.GetValue<BedShape>(SettingsKey.bed_shape));
|
||||
PutOemImageOnBed();
|
||||
|
||||
Vector2 bedCenter = ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.print_center);
|
||||
if(ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.center_part_on_bed)
|
||||
&& !InEditMode)
|
||||
{
|
||||
#if false
|
||||
if (meshViewerWidget.MeshGroups.Count > 0)
|
||||
{
|
||||
var bounds = meshViewerWidget.MeshGroups[0].GetAxisAlignedBoundingBox();
|
||||
Vector3 boundsCenter = (bounds.maxXYZ + bounds.minXYZ) / 2;
|
||||
for (int i = 0; i < meshViewerWidget.MeshGroups.Count; i++)
|
||||
{
|
||||
meshViewerWidget.MeshGroupTransforms[i] = Matrix4X4.CreateTranslation(-boundsCenter + new Vector3(0, 0, bounds.ZSize / 2) + new Vector3(bedCenter));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1732,15 +1732,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
meshViewerWidget.LoadDone += new EventHandler(meshViewerWidget_LoadDone);
|
||||
|
||||
Vector2 bedCenter = new Vector2();
|
||||
MeshViewerWidget.CenterPartAfterLoad doCentering = MeshViewerWidget.CenterPartAfterLoad.DONT;
|
||||
|
||||
if (ActiveSliceSettings.Instance?.GetValue<bool>(SettingsKey.center_part_on_bed) == true)
|
||||
{
|
||||
doCentering = MeshViewerWidget.CenterPartAfterLoad.DO;
|
||||
bedCenter = ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.print_center);
|
||||
}
|
||||
|
||||
await meshViewerWidget.LoadItemIntoScene(newPrintItem.FileLocation, doCentering, bedCenter, newPrintItem.Name);
|
||||
await meshViewerWidget.LoadItemIntoScene(newPrintItem.FileLocation, bedCenter, newPrintItem.Name);
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
|
|
@ -2238,24 +2231,19 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
private bool PartsAreInPrintVolume()
|
||||
{
|
||||
if (ActiveSliceSettings.Instance?.GetValue<bool>(SettingsKey.center_part_on_bed) == false)
|
||||
AxisAlignedBoundingBox allBounds = AxisAlignedBoundingBox.Empty;
|
||||
foreach (var aabb in Scene.Children.Select(item => item.GetAxisAlignedBoundingBox(Matrix4X4.Identity)))
|
||||
{
|
||||
AxisAlignedBoundingBox allBounds = AxisAlignedBoundingBox.Empty;
|
||||
foreach(var aabb in Scene.Children.Select(item => item.GetAxisAlignedBoundingBox(Matrix4X4.Identity)))
|
||||
{
|
||||
allBounds += aabb;
|
||||
}
|
||||
|
||||
bool onBed = allBounds.minXYZ.z > -.001 && allBounds.minXYZ.z < .001; // really close to the bed
|
||||
RectangleDouble bedRect = new RectangleDouble(0, 0, ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size).x, ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size).y);
|
||||
bedRect.Offset(ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.print_center) - ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size) / 2);
|
||||
|
||||
bool inBounds = bedRect.Contains(new Vector2(allBounds.minXYZ)) && bedRect.Contains(new Vector2(allBounds.maxXYZ));
|
||||
|
||||
return onBed && inBounds;
|
||||
allBounds += aabb;
|
||||
}
|
||||
|
||||
return true;
|
||||
bool onBed = allBounds.minXYZ.z > -.001 && allBounds.minXYZ.z < .001; // really close to the bed
|
||||
RectangleDouble bedRect = new RectangleDouble(0, 0, ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size).x, ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size).y);
|
||||
bedRect.Offset(ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.print_center) - ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size) / 2);
|
||||
|
||||
bool inBounds = bedRect.Contains(new Vector2(allBounds.minXYZ)) && bedRect.Contains(new Vector2(allBounds.maxXYZ));
|
||||
|
||||
return onBed && inBounds;
|
||||
}
|
||||
|
||||
private void OpenExportWindow()
|
||||
|
|
|
|||
|
|
@ -132,8 +132,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
if (stringEvent.Data == SettingsKey.bed_size
|
||||
|| stringEvent.Data == SettingsKey.print_center
|
||||
|| stringEvent.Data == SettingsKey.build_height
|
||||
|| stringEvent.Data == SettingsKey.bed_shape
|
||||
|| stringEvent.Data == SettingsKey.center_part_on_bed)
|
||||
|| stringEvent.Data == SettingsKey.bed_shape)
|
||||
{
|
||||
viewerVolume = new Vector3(ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size), ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.build_height));
|
||||
bedShape = ActiveSliceSettings.Instance.GetValue<BedShape>(SettingsKey.bed_shape);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
public const string bottom_clip_amount = nameof(bottom_clip_amount);
|
||||
public const string build_height = nameof(build_height);
|
||||
public const string cancel_gcode = nameof(cancel_gcode);
|
||||
public const string center_part_on_bed = nameof(center_part_on_bed);
|
||||
public const string com_port = nameof(com_port);
|
||||
public const string connect_gcode = nameof(connect_gcode);
|
||||
public const string created_date = nameof(created_date);
|
||||
|
|
|
|||
|
|
@ -116,7 +116,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
new MappedToBoolString("support_material_create_internal_support", "generateInternalSupport"),
|
||||
new MappedToBoolString("support_material_create_perimeter", "generateSupportPerimeter"),
|
||||
new MappedToBoolString("wipe", "wipeAfterRetraction"),
|
||||
new MappedToBoolString(SettingsKey.center_part_on_bed, "centerObjectInXy"),
|
||||
new MappedToBoolString(SettingsKey.expand_thin_walls, "expandThinWalls"),
|
||||
new MappedToBoolString(SettingsKey.merge_overlapping_lines, "MergeOverlappingLines"),
|
||||
new MappedToBoolString(SettingsKey.fill_thin_gaps, "fillThinGaps"),
|
||||
|
|
|
|||
|
|
@ -387,16 +387,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
Slic3rEngineMappings.WriteSliceSettingsFile(configFilePath);
|
||||
|
||||
// if we have centering turend on and are printing a model loaded up from meshes (not gcode)
|
||||
if(ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.center_part_on_bed))
|
||||
{
|
||||
// figure out the center position of this file
|
||||
Vector2 bedCenter = ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.print_center);
|
||||
commandArgs = $"--print-center {bedCenter.x:0.##},{bedCenter.y:0.##} --load \"{configFilePath}\" --output \"{gcodeFilePath}\" \"{fileToSlice}\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
commandArgs = $"--load \"{configFilePath}\" --output \"{gcodeFilePath}\" \"{fileToSlice}\"";
|
||||
}
|
||||
commandArgs = $"--load \"{configFilePath}\" --output \"{gcodeFilePath}\" \"{fileToSlice}\"";
|
||||
break;
|
||||
|
||||
case SlicingEngineTypes.CuraEngine:
|
||||
|
|
|
|||
|
|
@ -192,7 +192,6 @@ Advanced
|
|||
notes
|
||||
Output Options
|
||||
File Settings
|
||||
center_part_on_bed
|
||||
output_only_first_layer
|
||||
g0
|
||||
Sequential Printing
|
||||
|
|
|
|||
|
|
@ -114,14 +114,6 @@
|
|||
"DefaultValue": "",
|
||||
"RebuildGCodeOnChange": false
|
||||
},
|
||||
{
|
||||
"SlicerConfigName": "center_part_on_bed",
|
||||
"PresentationName": "Center On Bed",
|
||||
"HelpText": "Centers the print on the bed, regardless of where it is moved in Edit Mode. Disable to allow printing a model anywhere on the bed.",
|
||||
"DataEditType": "CHECK_BOX",
|
||||
"DefaultValue": "1",
|
||||
"ReloadUiWhenChanged": true
|
||||
},
|
||||
{
|
||||
"SlicerConfigName": "complete_objects",
|
||||
"PresentationName": "Complete Individual Objects",
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit e6c58f96410fa6ba97dfb06cf0a3ba53a6de5afb
|
||||
Subproject commit 50adb1675cd4ce234f02f78907f1dcc1cecaa52a
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 0e9a2ba0fdc368d260fe20b1d832ba7383466f06
|
||||
Subproject commit 9844c2334b9ea23e9df83c94ac59bb002f4a2a84
|
||||
|
|
@ -108,8 +108,6 @@ namespace MatterHackers.PolygonMesh.UnitTests
|
|||
// Set the static data to point to the directory of MatterControl
|
||||
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
|
||||
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
|
||||
|
||||
ActiveSliceSettings.Instance?.SetValue(SettingsKey.center_part_on_bed, "0");
|
||||
#endif
|
||||
var view3DWidget = new View3DWidget(
|
||||
null,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue