Esempio n. 1
0
        private static void RenderModelGetScreenMinMax(Model3DNode model, M3D.Model.Utils.Vector3 rotation, M3D.Model.Utils.Vector3 translation, M3D.Model.Utils.Vector3 scale, out Rectangle screen_rec)
        {
            var     scale1       = Matrix4.CreateScale(scale.X, scale.Y, scale.Z);
            Matrix4 matrix4_1    = Matrix4.CreateRotationY(rotation.Y * ((float)Math.PI / 180f)) * Matrix4.CreateRotationX(rotation.X * ((float)Math.PI / 180f)) * Matrix4.CreateRotationZ(rotation.Z * ((float)Math.PI / 180f));
            var     translation1 = Matrix4.CreateTranslation(translation.X, translation.Y, translation.Z);
            Matrix4 matrix4_2    = matrix4_1;
            Matrix4 mat          = scale1 * matrix4_2 * translation1;

            GL.MatrixMode(MatrixMode.Modelview);
            GL.PushMatrix();
            GL.Rotate(-90f, new OpenTK.Vector3(1f, 0.0f, 0.0f));
            GL.MultMatrix(ref mat);
            Color4 diffuse    = model.Diffuse;
            var    brightness = model.Brightness;
            var    highlight  = model.Highlight;

            if (ImageCapture.IconColor == "Standard")
            {
                model.Diffuse = new Color4(98, 181, 233, byte.MaxValue);
            }
            else if (ImageCapture.IconColor == "Random")
            {
                FilamentConstants.HexToRGB(FilamentConstants.generateHEXFromColor((FilamentConstants.ColorsEnum)(ImageCapture.internalRandomGenerator.Next(10) + 5)), out var R, out var G, out var B, out var A);
                model.Diffuse = new Color4(R, G, B, A);
            }
            model.Brightness = 1f;
            model.Highlight  = false;
            model.Render3D();
            model.Diffuse    = diffuse;
            model.Brightness = brightness;
            model.Highlight  = highlight;
            screen_rec       = ImageCapture.GetScreenMinMax(model);
            GL.PopMatrix();
        }
Esempio n. 2
0
 public void SelectProfile(int index)
 {
     if (index >= 0 && index < filamentprofile_list.Items.Count)
     {
         var filamentOptions = (FilamentProfilePage.FilamentOptions)filamentprofile_list.Items[index];
         type_edit.Text                 = filamentOptions.Key.type.ToString();
         color_edit.Text                = FilamentConstants.ColorsToString(filamentOptions.Key.color);
         temperature_edit.Text          = filamentOptions.Options.temperature.ToString();
         TemperatureEditButton.Enabled  = true;
         TemperatureResetButton.Enabled = true;
     }
     else
     {
         type_edit.Text                 = "";
         color_edit.Text                = "";
         temperature_edit.Text          = "";
         TemperatureEditButton.Enabled  = false;
         TemperatureResetButton.Enabled = false;
     }
     temperature_edit.Enabled      = false;
     TemperatureEditButton.Visible = true;
     TemperatureSaveButton.Visible = false;
     TemperatureSaveButton.Enabled = false;
     filamentprofile_list.Selected = index;
     prevSelectedProfile           = index;
 }
 public override void OnActivate(Mangage3DInkStageDetails details)
 {
     base.OnActivate(details);
     filamentset.Value = false;
     Host.SetFocus(custom_temperature_edit);
     custom_temperature_edit.Text = details.current_spool.filament_temperature.ToString();
     textColor.Text    = FilamentConstants.ColorsToString((FilamentConstants.ColorsEnum)Enum.ToObject(typeof(FilamentConstants.ColorsEnum), CurrentDetails.current_spool.filament_color_code));
     textMaterial.Text = CurrentDetails.current_spool.filament_type.ToString();
 }
Esempio n. 4
0
        private void AddColorItems(FilamentSpool.TypeEnum type)
        {
            color_combobox.ClearItems();
            foreach (FilamentConstants.ColorsEnum color in (FilamentConstants.ColorsEnum[])Enum.GetValues(typeof(FilamentConstants.ColorsEnum)))
            {
                color_combobox.AddItem(FilamentConstants.ColorsToString(color));
            }

            color_combobox.Select = 0;
        }
Esempio n. 5
0
 public void PushDataToDictionary(FilamentDictionary dictionary)
 {
     foreach (SettingsManager.Filament profile in profiles)
     {
         FilamentProfile.TypeColorKey typeColorKey;
         typeColorKey.type  = FilamentConstants.StringToType(profile.Type);
         typeColorKey.color = FilamentConstants.StringToFilamentColors(profile.Color);
         FilamentProfile.CustomOptions customOptions;
         customOptions.temperature = profile.Temperature;
         dictionary.AddCustomTemperature(typeColorKey.type, typeColorKey.color, customOptions.temperature);
     }
 }
Esempio n. 6
0
 public Filament(FilamentProfile profile)
 {
     if (profile != null)
     {
         Color       = FilamentConstants.ColorsToString(profile.Color);
         Temperature = profile.Temperature;
         Type        = profile.Type.ToString();
     }
     else
     {
         Color       = "";
         Temperature = 0;
         Type        = "";
     }
 }
Esempio n. 7
0
        public override void MyButtonCallback(ButtonWidget button)
        {
            switch (button.ID)
            {
            case 7:
                MainWindow.ActivateFrame(Manage3DInkMainWindow.PageID.Page11_CheatCodePage, CurrentDetails);
                break;

            case 8:
                FilamentConstants.ColorsEnum filamentColors = FilamentConstants.StringToFilamentColors(color_combobox.EditBox.Text);
                for (var index = 0; index < CurrentDetails.user_filaments.Count; ++index)
                {
                    if (CurrentDetails.user_filaments[index].Color != filamentColors)
                    {
                        if (CurrentDetails.user_filaments[index].Color == FilamentConstants.ColorsEnum.Other)
                        {
                            CurrentDetails.user_filaments[index] = new M3D.Spooling.Common.Filament(CurrentDetails.user_filaments[0].Type, filamentColors, CurrentDetails.user_filaments[0].CodeStr, CurrentDetails.user_filaments[0].Brand);
                        }
                        else if (CurrentDetails.user_filaments.Count == 1)
                        {
                            CurrentDetails.user_filaments.RemoveAt(index);
                            --index;
                        }
                    }
                }
                M3D.Spooling.Common.Filament filament;
                int temperature;
                if (!settingsManager.FilamentDictionary.ResolveToEncodedFilament(CurrentDetails.user_filaments[0].CodeStr, out filament, out temperature))
                {
                    temperature = settingsManager.GetFilamentTemperature(CurrentDetails.current_spool.filament_type, filamentColors);
                }

                CurrentDetails.current_spool.filament_color_code  = (uint)filamentColors;
                CurrentDetails.current_spool.filament_temperature = temperature;
                if (CurrentDetails.mode == Manage3DInkMainWindow.Mode.AddFilament)
                {
                    CurrentDetails.mode = Manage3DInkMainWindow.Mode.SetFilamentLocationInsertingNew;
                }
                else if (CurrentDetails.mode == Manage3DInkMainWindow.Mode.SetDetails)
                {
                    CurrentDetails.mode = Manage3DInkMainWindow.Mode.SetFilamentLocationAlreadyInserted;
                }

                MainWindow.ActivateFrame(Manage3DInkMainWindow.PageID.Page18_FilamentSpoolSize, CurrentDetails);
                break;
            }
        }
Esempio n. 8
0
        public List <string> GenerateColors(FilamentSpool.TypeEnum type = FilamentSpool.TypeEnum.NoFilament)
        {
            var stringList = new List <string>();

            if (type == FilamentSpool.TypeEnum.NoFilament)
            {
                for (var index = 0; index < 20; ++index)
                {
                    stringList.Add(FilamentConstants.ColorsToString((FilamentConstants.ColorsEnum)index));
                }

                stringList.Add(FilamentConstants.ColorsToString(FilamentConstants.ColorsEnum.Grey));
            }
            else
            {
                dictionary.TryGetValue(type.ToString(), out List <Filament> filamentList);
                foreach (Filament filament in filamentList.FindAll(x => x.Type == type))
                {
                    stringList.Add(filament.ColorStr);
                }
            }
            return(stringList);
        }
Esempio n. 9
0
        private void ShowCurrentFilament(PrinterObject printer, FilamentSpool current_spool)
        {
            text_title.Text             = "3D Ink Currently in use:\n\n" + FilamentProfile.GenerateSpoolName(current_spool, true);
            text_temperature_value.Text = current_spool.filament_temperature.ToString() + " Degrees C";
            FilamentConstants.Branding brandingFrom = FilamentConstants.GetBrandingFrom(current_spool.filament_type, (FilamentConstants.ColorsEnum)current_spool.filament_color_code);
            text_material_value.Text       = brandingFrom == FilamentConstants.Branding.Other ? FilamentConstants.TypesToString(current_spool.filament_type) : FilamentConstants.TypesToString(current_spool.filament_type) + " " + FilamentConstants.BrandingToString(brandingFrom);
            text_color_value.Text          = FilamentConstants.ColorsToString((FilamentConstants.ColorsEnum)current_spool.filament_color_code);
            text_main.Text                 = "";
            text_3dInkAmount_value.Text    = current_spool.estimated_filament_length_printed.ToString("0.00");
            text_temperature_value.Visible = true;
            text_material_value.Visible    = true;
            text_color_value.Visible       = true;
            text_temperature.Visible       = true;
            text_material.Visible          = true;
            text_color.Visible             = true;
            if (!settingsManager.CurrentFilamentSettings.TrackFilament)
            {
                return;
            }

            text_3dInkAmount_value.Visible = true;
            text_3dInkAmount.Visible       = true;
        }
Esempio n. 10
0
        public void MyButtonCallback(ButtonWidget button)
        {
            switch (button.ID)
            {
            case 3:
                FilamentSpool.TypeEnum       type           = ((FilamentSpool.TypeEnum[])Enum.GetValues(typeof(FilamentSpool.TypeEnum)))[type_combobox.ListBox.Selected];
                FilamentConstants.ColorsEnum filamentColors = FilamentConstants.StringToFilamentColors(color_combobox.EditBox.Text);
                settings_manager.FilamentDictionary.AddCustomTemperature(type, filamentColors, FilamentConstants.Temperature.Default(type));
                Enabled = false;
                Visible = false;
                host.GlobalChildDialog -= (this);
                if (manageFilamentPage != null)
                {
                    manageFilamentPage.Enabled = true;
                }

                if (manageFilamentPage == null)
                {
                    break;
                }

                manageFilamentPage.UpdateProfileList(type, filamentColors);
                break;

            case 4:
                Enabled = false;
                Visible = false;
                if (manageFilamentPage != null)
                {
                    manageFilamentPage.Enabled = true;
                }

                host.GlobalChildDialog -= (this);
                break;
            }
        }