Beispiel #1
0
    public void Start()
    {
        // Machine Settings panel
        CC.Settings.OnNewSettings     += Settings_OnNewSettings;
        CC.Settings.OnSettingModified += Settings_OnSettingModified;

        layerRangeMin = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "LayerRangeMinInputField",
                                                               () => { return(CC.Settings.LayerRangeMin); },
                                                               (intValue) => { CC.Settings.LayerRangeMin = intValue; }, 1, 999999);

        layerRangeMax = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "LayerRangeMaxInputField",
                                                               () => { return(CC.Settings.LayerRangeMax); },
                                                               (intValue) => { CC.Settings.LayerRangeMax = intValue; }, 1, 999999999 + 1);

        startLayers = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "StartLayersInputField",
                                                             () => { return(CC.Settings.StartLayers); },
                                                             (intValue) => { CC.Settings.StartLayers = intValue; }, 0, 100);

        startLayerHeight = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "StartLayerHeightInputField",
                                                                    () => { return((float)CC.Settings.StartLayerHeightMM); },
                                                                    (floatValue) => { CC.Settings.StartLayerHeightMM = Math.Round(floatValue, 5); }, 0.01f, 10.0f);
        startLayerHeightRow = startLayerHeight.transform.parent.gameObject;

        is_expanded = true;
        update_visibility();
    }
Beispiel #2
0
        // internal api

        public InputField RegisterFloatInput(string inputName, string toolParamName, Interval1d validRange, string formatString = null)
        {
            InputField input = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, inputName,
                                                                        () => { return((float)ActiveParameterSet.GetValueDouble(toolParamName)); },
                                                                        (floatValue) => { ActiveParameterSet.SetValue <double>(toolParamName, floatValue); update_values_from_tool(); },
                                                                        (float)validRange.a, (float)validRange.b);

            TabOrder.Add(input);

            float_params.Add(new FloatInputParam()
            {
                widget = input, paramName = toolParamName, formatString = formatString
            });

            return(input);
        }
Beispiel #3
0
        public void Start()
        {
            CC.Settings.OnNewSettings     += Settings_OnNewSettings;
            CC.Settings.OnSettingModified += Settings_OnSettingModified;

            enableBridging = UnityUIUtil.FindToggleAndConnectToSource(this.gameObject, "EnableBridgingToggle",
                                                                      () => { return(CC.Settings.EnableBridging); },
                                                                      (boolValue) => { CC.Settings.EnableBridging = boolValue; });

            maxDistance = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "MaxBridgeDistInputField",
                                                                   () => { return((float)CC.Settings.MaxBridgeDistanceMM); },
                                                                   (floatValue) => { CC.Settings.MaxBridgeDistanceMM = Math.Round(floatValue, 2); }, 0.01f, 500.00f);
            maxDistanceRow = maxDistance.transform.parent.gameObject;

            is_expanded = true;
            update_visibility();
        }
Beispiel #4
0
    public void Start()
    {
        // Machine Settings panel
        CC.Settings.OnNewSettings     += Settings_OnNewSettings;
        CC.Settings.OnSettingModified += Settings_OnSettingModified;

        nozzleWidth = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "NozzleWidthInputField",
                                                               () => { return((float)CC.Settings.NozzleDiameterMM); },
                                                               (floatValue) => { CC.Settings.NozzleDiameterMM = Math.Round(floatValue, 5); }, 0.05f, 50.0f);

        filamentDiam = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "FilamentDiamInputField",
                                                                () => { return((float)CC.Settings.FilamentDiameterMM); },
                                                                (floatValue) => { CC.Settings.FilamentDiameterMM = Math.Round(floatValue, 5); }, 0.05f, 10.0f);

        nozzleTemp = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "ExtruderTempInputField",
                                                            () => { return(CC.Settings.ExtruderTempC); },
                                                            (intValue) => { CC.Settings.ExtruderTempC = intValue; }, 10, 500);

        bedTemp = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "BedTempInputField",
                                                         () => { return(CC.Settings.BedTempC); },
                                                         (intValue) => { CC.Settings.BedTempC = intValue; }, 0, 100);
        bedTempGO = bedTemp.gameObject.transform.parent.gameObject;
        bedTempGO.SetVisible(CC.Settings.HasHeatedBed);

        printSpeed = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "PrintSpeedInputField",
                                                            () => { return(CC.Settings.PrintSpeedMMS); },
                                                            (intValue) => { CC.Settings.PrintSpeedMMS = intValue; }, 10, 1000);

        travelSpeed = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "TravelSpeedInputField",
                                                             () => { return(CC.Settings.TravelSpeedMMS); },
                                                             (intValue) => { CC.Settings.TravelSpeedMMS = intValue; }, 10, 1000);

        fanSpeed = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "FanSpeedInput",
                                                          () => { return(CC.Settings.FanSpeedX); },
                                                          (intValue) => { CC.Settings.FanSpeedX = intValue; }, 0, 100);

        bedSizeX = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "BedSizeXInputField",
                                                          () => { return(CC.Settings.BedSizeXMM); },
                                                          (intValue) => { CC.Settings.BedSizeXMM = intValue; }, 10, 10000);
        bedSizeY = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "BedSizeYInputField",
                                                          () => { return(CC.Settings.BedSizeYMM); },
                                                          (intValue) => { CC.Settings.BedSizeYMM = intValue; }, 10, 10000);
        bedSizeZ = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "BedSizeZInputField",
                                                          () => { return(CC.Settings.BedSizeZMM); },
                                                          (intValue) => { CC.Settings.BedSizeZMM = intValue; }, 10, 10000);
    }
Beispiel #5
0
        public void Start()
        {
            CC.Settings.OnNewSettings     += Settings_OnNewSettings;
            CC.Settings.OnSettingModified += Settings_OnSettingModified;

            generateSupport = UnityUIUtil.FindToggleAndConnectToSource(this.gameObject, "GenerateSupportToggle",
                                                                       () => { return(CC.Settings.GenerateSupport); },
                                                                       (boolValue) => { CC.Settings.GenerateSupport = boolValue; });

            overhangAngle = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "OverhangAngleInputField",
                                                                     () => { return((float)CC.Settings.OverhangAngleDeg); },
                                                                     (floatValue) => { CC.Settings.OverhangAngleDeg = Math.Round(floatValue, 2); }, 0.01f, 89.99f);
            overhangAngleRow = overhangAngle.transform.parent.gameObject;

            supportMinZTips = UnityUIUtil.FindToggleAndConnectToSource(this.gameObject, "SupportTipsToggle",
                                                                       () => { return(CC.Settings.SupportMinZTips); },
                                                                       (boolValue) => { CC.Settings.SupportMinZTips = boolValue; });
            supportMinZTipsRow = supportMinZTips.transform.parent.gameObject;

            supportSpacing = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "SupportSpacingInputField",
                                                                      () => { return((float)CC.Settings.SupportStepX); },
                                                                      (floatValue) => { CC.Settings.SupportStepX = Math.Round(floatValue, 5); }, 1.0f, 9999.0f);
            supportSpacingRow = supportSpacing.transform.parent.gameObject;

            supportShell = UnityUIUtil.FindToggleAndConnectToSource(this.gameObject, "SupportShellToggle",
                                                                    () => { return(CC.Settings.EnableSupportShell); },
                                                                    (boolValue) => { CC.Settings.EnableSupportShell = boolValue; });
            supportShellRow = supportShell.transform.parent.gameObject;

            supportReleaseOpt = UnityUIUtil.FindToggleAndConnectToSource(this.gameObject, "SupportReleaseOptToggle",
                                                                         () => { return(CC.Settings.EnableSupportReleaseOpt); },
                                                                         (boolValue) => { CC.Settings.EnableSupportReleaseOpt = boolValue; });

            supportGap = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "SupportGapInputField",
                                                                  () => { return((float)CC.Settings.SupportSolidSpace); },
                                                                  (floatValue) => { CC.Settings.SupportSolidSpace = Math.Round(floatValue, 5); }, 0.0f, 100.0f);
            supportGapRow = supportGap.transform.parent.gameObject;

            is_expanded = true;
            update_visibility();
        }
    public void Start()
    {
        // Machine Settings panel
        CC.ObjSettings.OnNewSettings     += Settings_OnNewSettings;
        CC.ObjSettings.OnSettingModified += Settings_OnSettingModified;

        objectType = UnityUIUtil.FindDropDownAndAddHandlers(Panel, "ObjectTypeDropDown",
                                                            () => { return(CC.ObjSettings.ObjectTypeInt); },
                                                            (intValue) => { CC.ObjSettings.ObjectTypeInt = intValue; },
                                                            (int)PrintMeshSettings.ObjectTypes.Solid, (int)PrintMeshSettings.ObjectTypes.Ignored);

        noVoids = UnityUIUtil.FindToggleAndConnectToSource(Panel, "NoVoidsToggle",
                                                           () => { return(CC.ObjSettings.NoVoids); },
                                                           (boolValue) => { CC.ObjSettings.NoVoids = boolValue; });

        shellOnly = UnityUIUtil.FindToggleAndConnectToSource(Panel, "ShellOnlyToggle",
                                                             () => { return(CC.ObjSettings.OuterShellOnly); },
                                                             (boolValue) => { CC.ObjSettings.OuterShellOnly = boolValue; });

        openMeshMode = UnityUIUtil.FindDropDownAndAddHandlers(Panel, "OpenMeshesDropDown",
                                                              () => { return(CC.ObjSettings.OpenModeInt); },
                                                              (intValue) => { CC.ObjSettings.OpenModeInt = intValue; },
                                                              (int)PrintMeshSettings.OpenMeshModes.Default, (int)PrintMeshSettings.OpenMeshModes.Ignored);

        clearance = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "ClearanceInputField",
                                                             () => { return((float)CC.ObjSettings.Clearance); },
                                                             (floatValue) => { CC.ObjSettings.Clearance = Math.Round(floatValue, 3); }, -100.0f, 100.0f);
        clearanceRow = clearance.transform.parent.gameObject;

        offsetxy = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "XYOffsetInputField",
                                                            () => { return((float)CC.ObjSettings.OffsetXY); },
                                                            (floatValue) => { CC.ObjSettings.OffsetXY = Math.Round(floatValue, 3); }, -100.0f, 100.0f);
        offsetxyRow = offsetxy.transform.parent.gameObject;

        autoReload = UnityUIUtil.FindToggleAndConnectToSource(Panel, "AutoUpdateToggle",
                                                              () => { return(CC.ObjSettings.AutoReloadChanges); },
                                                              (boolValue) => { CC.ObjSettings.AutoReloadChanges = boolValue; });
        autoReload.interactable = false;
    }
Beispiel #7
0
        public void Start()
        {
            CC.Settings.OnNewSettings     += Settings_OnNewSettings;
            CC.Settings.OnSettingModified += Settings_OnSettingModified;

            layerHeight = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "LayerHeightInputField",
                                                                   () => { return((float)CC.Settings.LayerHeightMM); },
                                                                   (floatValue) => { CC.Settings.LayerHeightMM = Math.Round(floatValue, 5); }, 0.01f, 10.0f);

            infill = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "InfillSpacingInputField",
                                                              () => { return((float)CC.Settings.InfillStepX); },
                                                              (floatValue) => { CC.Settings.InfillStepX = Math.Round(floatValue, 5); }, 1.0f, 9999.0f);

            shells = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "ShellsInputField",
                                                            () => { return(CC.Settings.OuterShells); },
                                                            (intValue) => { CC.Settings.OuterShells = intValue; }, 1, 1000);

            roofLayers = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "RoofLayersInputField",
                                                                () => { return(CC.Settings.RoofLayers); },
                                                                (intValue) => { CC.Settings.RoofLayers = intValue; }, 0, 999999);

            floorLayers = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "FloorLayersInputField",
                                                                 () => { return(CC.Settings.FloorLayers); },
                                                                 (intValue) => { CC.Settings.FloorLayers = intValue; }, 0, 999999);

            clipOverlaps = UnityUIUtil.FindToggleAndConnectToSource(this.gameObject, "ClipSelfOverlapsToggle",
                                                                    () => { return(CC.Settings.ClipSelfOverlaps); },
                                                                    (boolValue) => { CC.Settings.ClipSelfOverlaps = boolValue; });

            interiorSolidRegionShells = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "InteriorSolidRegionShellsInputField",
                                                                               () => { return(CC.Settings.InteriorSolidRegionShells); },
                                                                               (intValue) => { CC.Settings.InteriorSolidRegionShells = intValue; }, 0, 999999);

            openMeshMode = UnityUIUtil.FindDropDownAndAddHandlers(this.gameObject, "OpenMeshesDropDown",
                                                                  () => { return(CC.Settings.OpenModeInt); },
                                                                  (intValue) => { CC.Settings.OpenModeInt = intValue; }, (int)PrintSettings.OpenMeshMode.Clipped, (int)PrintSettings.OpenMeshMode.Ignored);
        }
    public void Start()
    {
        ITool curTool = CC.ActiveContext.ToolManager.ActiveRightTool;

        if (curTool == null)
        {
            return;
        }
        Tool = curTool as SetDimensionsTool;
        if (Tool == null)
        {
            return;
        }
        ActiveParameterSet = Tool.Parameters;

        dimension_x = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "WidthInput",
                                                               () => { return((float)ActiveParameterSet.GetValueDouble("dimension_x")); },
                                                               (floatValue) => { set_value("dimension_x", floatValue); update_from_tool(); },
                                                               0, 9999999.0f);
        dimension_y = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "HeightInput",
                                                               () => { return((float)ActiveParameterSet.GetValueDouble("dimension_y")); },
                                                               (floatValue) => { set_value("dimension_y", floatValue); update_from_tool(); },
                                                               0, 9999999.0f);
        dimension_z = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "DepthInput",
                                                               () => { return((float)ActiveParameterSet.GetValueDouble("dimension_z")); },
                                                               (floatValue) => { set_value("dimension_z", floatValue); update_from_tool(); },
                                                               0, 9999999.0f);
        tabber.Add(dimension_x); tabber.Add(dimension_z); tabber.Add(dimension_y);

        scale_x = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "WidthXInput",
                                                           () => { return((float)ActiveParameterSet.GetValueDouble("scale_x")); },
                                                           (floatValue) => { set_value("scale_x", floatValue); update_from_tool(); },
                                                           0, 9999999.0f);
        scale_y = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "HeightXInput",
                                                           () => { return((float)ActiveParameterSet.GetValueDouble("scale_y")); },
                                                           (floatValue) => { set_value("scale_y", floatValue); update_from_tool(); },
                                                           0, 9999999.0f);
        scale_z = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "DepthXInput",
                                                           () => { return((float)ActiveParameterSet.GetValueDouble("scale_z")); },
                                                           (floatValue) => { set_value("scale_z", floatValue); update_from_tool(); },
                                                           0, 9999999.0f);
        tabber.Add(scale_x); tabber.Add(scale_z); tabber.Add(scale_y);


        uniform = UnityUIUtil.FindToggleAndConnectToSource(this.gameObject, "UniformToggle",
                                                           () => { return(ActiveParameterSet.GetValueBool("uniform")); },
                                                           (boolValue) => { set_value("uniform", boolValue); });
        tabber.Add(uniform);

        objectFrame = UnityUIUtil.FindToggleAndConnectToSource(this.gameObject, "ObjectFrameToggle",
                                                               () => { return(ActiveParameterSet.GetValueBool("use_object_frame")); },
                                                               (boolValue) => { set_value("use_object_frame", boolValue); });
        tabber.Add(objectFrame);
        objectFrameRow = objectFrame.transform.parent.gameObject;

        // this doesn't work yet because we need to also change the visible dimensions...
        //objectFrameRow.SetVisible(Tool.Targets.Count() == 1);
        objectFrameRow.SetVisible(false);

        update_from_tool();

        curTool.Parameters.OnParameterModified += on_parameter_modified;
    }