Better flatten on text
This commit is contained in:
parent
90be18e19f
commit
3b867d78e0
1 changed files with 18 additions and 1 deletions
|
|
@ -44,6 +44,7 @@ using Newtonsoft.Json;
|
|||
using Newtonsoft.Json.Converters;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace MatterHackers.MatterControl.DesignTools
|
||||
{
|
||||
|
|
@ -82,11 +83,27 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
// change this from a text object to a group
|
||||
var newContainer = new GroupObject3D();
|
||||
newContainer.CopyProperties(this, Object3DPropertyFlags.All);
|
||||
int index = 0;
|
||||
foreach (var child in this.Children)
|
||||
{
|
||||
newContainer.Children.Add(child.Clone());
|
||||
var clone = child.Clone();
|
||||
var newName = index < NameToWrite.Length ? NameToWrite[index++].ToString() : "Letter".Localize();
|
||||
clone.Name = MapIfSymbol(newName);
|
||||
newContainer.Children.Add(clone);
|
||||
}
|
||||
undoBuffer.AddAndDo(new ReplaceCommand(new[] { this }, new[] { newContainer }));
|
||||
newContainer.Name = this.Name + " - " + "Flattened".Localize();
|
||||
}
|
||||
|
||||
private string MapIfSymbol(string newName)
|
||||
{
|
||||
switch(newName)
|
||||
{
|
||||
case " ":
|
||||
return "space";
|
||||
}
|
||||
|
||||
return newName;
|
||||
}
|
||||
|
||||
public override async void OnInvalidate(InvalidateArgs invalidateType)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue