Please find attached a 3dm file that contains various TextEntity objects. These are read and added with the code below, but Rhino 7 fails to do this and only adds the curve geometries, whereas Rhino 6 has no problem and adds all.
What can I do to make these text entities behave? They are valid objects according to the IsValid
property.
@dale is this something you can help with?
shipplan_titleblock.3dm (347.4 KB)
public Result RunCommand(RhinoDoc doc, RunMode mode)
{
string path = @"path\to\shipplan_titleblock.3dm"; // change this to where you saved the file
using (var file3dm = File3dm.Read(path))
{
foreach(var o in file3dm.Objects)
{
if (!o.Attributes.Visible) continue;
if (!file3dm.Layers[o.Attributes.LayerIndex].IsVisible) continue;
GeometryBase privateCopy = o.Geometry;
privateCopy.EnsurePrivateCopy();
if (privateCopy is TextEntity text)
{
var id = doc.Objects.AddText(text);
if (id == Guid.Empty) RhinoApp.WriteLine("Failed to add text entity with text "+text.Text);
}
else
{
doc.Objects.Add(privateCopy);
}
}
}
return Result.Success;
}