Fixing null errors in expressions
Changed to requiring = at start of equation
This commit is contained in:
parent
28bd0a1071
commit
3d068ef868
15 changed files with 252 additions and 144 deletions
|
|
@ -207,17 +207,43 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
base.OnDraw(graphics2D);
|
||||
}
|
||||
|
||||
public void AddWidthDepthControls(Func<double> getWidth,
|
||||
Action<double> setWidth,
|
||||
Func<double> getDepth,
|
||||
Action<double> setDepth,
|
||||
Func<double> getHeight,
|
||||
Action<double> setHeight)
|
||||
public void AddWidthDepthControls(IObject3D item, DoubleOrExpression width, DoubleOrExpression depth, DoubleOrExpression height)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
Func<double> getWidth = () => width.Value(item);
|
||||
Action<double> setWidth = (newWidth) => width.Expression = newWidth.ToString();
|
||||
Func<double> getDepth = () => depth.Value(item);
|
||||
Action<double> setDepth = (newDepth) => depth.Expression = newDepth.ToString();
|
||||
Func<double> getHeight = () => height.Value(item);
|
||||
Action<double> setHeight = (newHeight) => height.Expression = newHeight.ToString();
|
||||
|
||||
if (width != null
|
||||
&& !width.IsEquation
|
||||
&& depth != null
|
||||
&& !depth.IsEquation)
|
||||
{
|
||||
Object3DControls.Add(new ScaleWidthDepthCornerControl(this, getWidth, setWidth, getDepth, setDepth, getHeight, setHeight, i));
|
||||
Object3DControls.Add(new ScaleWidthDepthEdgeControl(this, getWidth, setWidth, getDepth, setDepth, getHeight, setHeight, i));
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Object3DControls.Add(new ScaleWidthDepthCornerControl(this, getWidth, setWidth, getDepth, setDepth, getHeight, setHeight, i));
|
||||
Object3DControls.Add(new ScaleWidthDepthEdgeControl(this, getWidth, setWidth, getDepth, setDepth, getHeight, setHeight, i));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if the width is set and a constant
|
||||
if (width != null && !width.IsEquation)
|
||||
{
|
||||
// add width side controls
|
||||
Object3DControls.Add(new ScaleWidthDepthEdgeControl(this, getWidth, setWidth, null, null, getHeight, setHeight, 1));
|
||||
Object3DControls.Add(new ScaleWidthDepthEdgeControl(this, getWidth, setWidth, null, null, getHeight, setHeight, 3));
|
||||
}
|
||||
|
||||
// if the depth is set and a constant
|
||||
if (depth != null && !depth.IsEquation)
|
||||
{
|
||||
// add depth side controls
|
||||
Object3DControls.Add(new ScaleWidthDepthEdgeControl(this, null, null, getDepth, setDepth, getHeight, setHeight, 0));
|
||||
Object3DControls.Add(new ScaleWidthDepthEdgeControl(this, null, null, getDepth, setDepth, getHeight, setHeight, 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue