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

{
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)
{
if (id == Guid.Empty) RhinoApp.WriteLine("Failed to add text entity with text "+text.Text);
}
else
{
}
}
}

return Result.Success;
}


Hi @menno,

See this YT: - https://mcneel.myjetbrains.com/youtrack/issue/RH-61123

Basically, the dimension style referenced by your text entities is not in the document. Thus the failure.

– Dale

Is there something I can do in code to assign a dimension style that is in the document?

Hi @menno,

You could do something like this:

if (privateCopy is TextEntity text)
{
text.DimensionStyleId = doc.DimStyles.Current.Id;

And, you can always script the Import command.