White space
working on a csg visualization function.
This commit is contained in:
parent
dfd61756a3
commit
31a64df4ee
2 changed files with 62 additions and 19 deletions
|
|
@ -26,6 +26,7 @@ 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.
|
||||
*/
|
||||
//#define DoBooleanTest
|
||||
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Transform;
|
||||
|
|
@ -35,7 +36,6 @@ using MatterHackers.Localizations;
|
|||
using MatterHackers.MatterControl.CustomWidgets;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.PrinterCommunication;
|
||||
using MatterHackers.MatterControl.PrintLibrary;
|
||||
using MatterHackers.MatterControl.PrintLibrary.Provider;
|
||||
using MatterHackers.MatterControl.PrintQueue;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
|
|
@ -49,7 +49,6 @@ using MatterHackers.VectorMath;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
|
@ -451,8 +450,51 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
};
|
||||
|
||||
SetDefaultView();
|
||||
|
||||
#if DoBooleanTest
|
||||
DrawBefore += CreateBooleanTestGeometry;
|
||||
DrawAfter += RemoveBooleanTestGeometry;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if DoBooleanTest
|
||||
MeshGroup booleanGroup;
|
||||
ScaleRotateTranslate groupTransform;
|
||||
Vector3 offset = new Vector3();
|
||||
Vector3 direction = new Vector3(1.1, 1.2, 1.3);
|
||||
Vector3 centering = new Vector3(100, 100, 20);
|
||||
private void CreateBooleanTestGeometry(GuiWidget drawingWidget, DrawEventArgs e)
|
||||
{
|
||||
Mesh boxA = PlatonicSolids.CreateCube(40, 40, 40);
|
||||
boxA.Translate(centering);
|
||||
Mesh boxB = PlatonicSolids.CreateCube(40, 40, 40);
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (Math.Abs(direction[i] + offset[i]) > 10)
|
||||
{
|
||||
direction[i] = -direction[i];
|
||||
}
|
||||
}
|
||||
offset += direction;
|
||||
|
||||
boxB.Translate(offset + centering);
|
||||
|
||||
booleanGroup = new MeshGroup();
|
||||
booleanGroup.Meshes.Add(PolygonMesh.Csg.CsgOperations.Union(boxA, boxB));
|
||||
meshViewerWidget.MeshGroups.Add(booleanGroup);
|
||||
|
||||
groupTransform = ScaleRotateTranslate.Identity();
|
||||
meshViewerWidget.MeshGroupTransforms.Add(groupTransform);
|
||||
}
|
||||
|
||||
private void RemoveBooleanTestGeometry(GuiWidget drawingWidget, DrawEventArgs e)
|
||||
{
|
||||
meshViewerWidget.MeshGroups.Remove(booleanGroup);
|
||||
meshViewerWidget.MeshGroupTransforms.Remove(groupTransform);
|
||||
}
|
||||
#endif
|
||||
|
||||
public override void SetDefaultView()
|
||||
{
|
||||
meshViewerWidget.TrackballTumbleWidget.ZeroVelocity();
|
||||
|
|
@ -468,6 +510,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
public enum OpenMode { Viewing, Editing }
|
||||
|
||||
public enum WindowMode { Embeded, StandAlone };
|
||||
|
||||
private enum TraceInfoOpperation { DONT_COPY, DO_COPY };
|
||||
|
||||
public bool DisplayAllValueData { get; set; }
|
||||
|
|
@ -520,6 +563,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public WindowMode windowType { get; set; }
|
||||
private bool DoAddFileAfterCreatingEditData { get; set; }
|
||||
|
||||
public override void OnClosed(EventArgs e)
|
||||
{
|
||||
if (unregisterEvents != null)
|
||||
|
|
@ -612,8 +656,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
DrawStuffForSelectedPart(graphics2D);
|
||||
}
|
||||
|
||||
ViewControls3DButtons? activeButtonBeforeMouseOverride = null;
|
||||
ViewControls3DButtons? activeButtonBeforeKeyOverride = null;
|
||||
private ViewControls3DButtons? activeButtonBeforeMouseOverride = null;
|
||||
private ViewControls3DButtons? activeButtonBeforeKeyOverride = null;
|
||||
|
||||
public override void OnKeyDown(KeyEventArgs keyEvent)
|
||||
{
|
||||
|
|
@ -1189,7 +1233,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
Vector2 bedCenter = new Vector2();
|
||||
MeshViewerWidget.CenterPartAfterLoad doCentering = MeshViewerWidget.CenterPartAfterLoad.DONT;
|
||||
|
||||
if(ActiveSliceSettings.Instance != null
|
||||
if (ActiveSliceSettings.Instance != null
|
||||
&& ActiveSliceSettings.Instance.CenterOnBed())
|
||||
{
|
||||
doCentering = MeshViewerWidget.CenterPartAfterLoad.DO;
|
||||
|
|
@ -1904,7 +1948,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
else // we have already save it and the library should pick it up
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
saveSucceded = true;
|
||||
|
|
@ -1920,7 +1963,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
StyledMessageBox.ShowMessageBox(null, "Oops! Unable to save changes.", "Unable to save");
|
||||
});
|
||||
}
|
||||
catch(Exception e)
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Print(e.Message);
|
||||
GuiWidget.BreakInDebugger();
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit de782673c48f4770ed2410664e40f79635c28844
|
||||
Subproject commit 8e58507af02ed542ac36ea8cd957b68728e09416
|
||||
Loading…
Add table
Add a link
Reference in a new issue