I am using a DisplayConduit
to display information to the user which I do not want captured in the Rhino Doc. For a while now we have been telling users to stick to Rhino 7 as the text is not drawn correctly in Rhino 8 (I’ve only now just found the time to diagnose the issue).
The issue as far as I can tell is that we create a DimensionStyle
in memory (which is not added to the Document), which contained within a TextEntity
which we draw using DrawText
within our DisplayConduit
, i.e. the sudo code would be
internal record DrawData(IEnumerable<TextEntity> textEntities);
internal class MyLogic
{
public CreateDrawData(MyModel model)
{
var dimStyle = new DimensionStyle()
{
TextVerticalAlignment = TextVerticalAlignment.Middle,
TextHorizontalAlignment = TextHorizontalAlignment.Center,
}
// Some logic
var textEnitities = new List<TextEntity>()
{
TextEntity.Create(myText, nyPlane, dimStyle, false, 0, 0);
}
return new DrawData(text);
}
}
internal class MyConduit : DisplayConduit
{
public DrawData? Data { get; set; }
protected override void PreDrawObjects(DrawEventArgs e)
{
foreach (var textEntity in Data.TextEntities)
{
e.Display.DrawText(textEntity, myColor);
}
}
}
The issue appears to be that the DimensionStyle
is not applied. I’m guessing maybe this is due to the fact that it has not been added to the Document (which I would rather not do) as it indicates the DimensionStyle
is unset which is expect is because it does not have an index? … I’m guessing.
However, this logic worked perfectly fine in Rhino 7.
I expect one solution for this is just to keep everything as is and unpack the data and use Draw3dText
instead, which should work for my case, but I think this is more limited that DrawText