Hi all,
I have a custom legend object that I want to bake.
It contains a list of TextEntity classes that all have TextHorizontalAlignment == Right.
I want to change all those textEntities to left alignment and then offset them to the right so they physically look like they are right aligned.
I was hoping to change their alignment to Left and then call some Rhino.Transform.Align(objects, vector) but can’t find anything like that.
Theres the rhino command Align, but i cant find it in the SDK.
As a 1st altenative approach i looked into the displaypipeline measuring of text lengths but this is not (afaik) callable outside the pipeline methods.
As a 2md alternative approach, i could use the TextEntity.GetBoundingBox(); however calling this method resets my textHeight to 1.0. (this is a rhino7 bug but fixed in rhino8).
IEnumerable<(GeometryBase geo, ObjectAttributes atts)> rightHandText = geometries
.Where(g => g.geo is TextEntity txt && txt.TextHorizontalAlignment == TextHorizontalAlignment.Right);
// make text left aligned and align it to the right (speckle compatibility)
foreach ((GeometryBase geo, ObjectAttributes atts) in rightHandText)
{
if (geo is TextEntity txt)
{
txt.TextHorizontalAlignment = TextHorizontalAlignment.Left;
// offset to the right?
}
}