ObjectTable.Add does not handle the specified attributes properly when the geometrybase is a TextEntity


I noticed that ObjectTable.Add() does not well maintain the attributes specified in the method if the GeometryBase is a TextEntity. I found out that the originally assigned layer in the ObjectAttributes is replaced automatically by the CurrentLayer. Also, the assigned Name is forgotten. Is that an expected behaviour for TextEntity?
I finally decided to work with ObjectTable.AddText() and it works well. However this makes me raise an exception which I could have avoided with the former method, being more generic.


Hi @PaulPoinet,

Can you provide some sample code that is not working for you?

– Dale

  foreach(KeyValuePair<Rhino.Geometry.GeometryBase, Rhino.DocObjects.ObjectAttributes> entry in Objects)
    if (entry.Key is Rhino.Geometry.TextEntity){
      Rhino.RhinoDoc.ActiveDoc.Objects.AddText((Rhino.Geometry.TextEntity) entry.Key, entry.Value);
      Rhino.RhinoDoc.ActiveDoc.Objects.Add(entry.Key, entry.Value);

Hi @dale! I just share here the piece of code we talked about.
Will let you know if the same issue exists in Rhino6.