diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-03-05 12:34:58 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-03-05 12:34:58 +0200 |
| commit | 628819a1787290f84c22ecc7cb747f649fd54468 (patch) | |
| tree | abc7aa70a02818bc0549e36f82564d278ec247c6 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs | |
| parent | 4a9f241ed8230586242621795f76aa0add9f6008 (diff) | |
| download | Tango-628819a1787290f84c22ecc7cb747f649fd54468.tar.gz Tango-628819a1787290f84c22ecc7cb747f649fd54468.zip | |
Added dynamic factoring for embroidery import thread length.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 218733819..566dc7a16 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -1639,7 +1639,7 @@ namespace Tango.MachineStudio.Developer.ViewModels if (jobName != null) { - AddJobFromEmbroideryFile(jobName, vm.Paths.ToList(), vm.StitchLength, vm.EmbroideryFile, dlg.FileName, view.EmbroideryImageBytes); + AddJobFromEmbroideryFile(jobName, vm, dlg.FileName, view.EmbroideryImageBytes); } }, () => @@ -1649,7 +1649,7 @@ namespace Tango.MachineStudio.Developer.ViewModels } } - private async void AddJobFromEmbroideryFile(String jobName, List<EmbroideryPath> paths, int stitchLength, EmbroideryFile embroideryFile, String fileName, byte[] imageBytes) + private async void AddJobFromEmbroideryFile(String jobName, EmbroideryImportViewVM vm, String fileName, byte[] imageBytes) { LogManager.Log(String.Format("Adding new job from embroidery file {0}...", jobName)); @@ -1668,12 +1668,23 @@ namespace Tango.MachineStudio.Developer.ViewModels job.EmbroideryJpeg = imageBytes; job.HasEmbroideryFile = true; - foreach (var path in paths.Skip(1)) + foreach (var path in vm.Paths.Skip(1)) { Segment segment = new Segment(); - segment.Length = (path.Length / 1000d) * 2d; + + double baseLength = path.Length / 1000d; + double embThicknessLength = (vm.EmbroideryMaterialThickness * path.StitchCount) / 1000d; + double stabilizerThicknessLength = (vm.StabilizerThickness * path.StitchCount) / 1000d; + double totalLength = (baseLength + embThicknessLength) * vm.SelectedEmbroideryMaterial.Coefficient; + + if (vm.HasStabilizer) + { + totalLength += (stabilizerThicknessLength * vm.SelectedStabilizer.Coefficient); + } + + segment.Length = totalLength; segment.Name = "Embroidery Segment"; - segment.SegmentIndex = paths.IndexOf(path) + 2; + segment.SegmentIndex = vm.Paths.IndexOf(path) + 2; if (path.Brush is SolidColorBrush) { |
