Annotation text in rhino3dm.net

public static class RhinoGeometryBaseObjectExtensions
{
    public static G3_Text GetG3Text(this GeometryBase geometryBase, double? offsetX = default, double? offsetY = default)
    {
        if (geometryBase != null && geometryBase is AnnotationBase text)
        {
            return text.GetG3Text(offsetX, offsetY);
        }

        return default;
    }

    public static G3_Text GetG3Text(this AnnotationBase annotation, double? offsetX = default, double? offsetY = default)
    {
        if (annotation != null)
        {
            return new G3_Text
            {
                label = annotation.PlainText,
                height = annotation.TextHeight,
                width = annotation.TextModelWidth,
                point = new g3.Vector2d(annotation.GetBoundingBox(true).Center.X, annotation.GetBoundingBox(true).Center.Y),
                originPoint = new g3.Vector2d(annotation.Plane.Origin.X, annotation.Plane.Origin.Y),
                rotationDegrees = Rhino.RhinoMath.ToDegrees(Rhino.Geometry.Vector3d.VectorAngle(Rhino.Geometry.Vector3d.XAxis, annotation.Plane.XAxis, Rhino.Geometry.Plane.WorldXY)),
                rotationRadians = Rhino.Geometry.Vector3d.VectorAngle(Rhino.Geometry.Vector3d.XAxis, annotation.Plane.XAxis, Rhino.Geometry.Plane.WorldXY),
                fontSize = 10,
                color = annotation.MaskColor
            };
        }

        return default;
    }
}

below is an operational code calls the ext methods above:

 var layers = file3dm.AllLayers.ToList();

    foreach (var layer in layers)
    {
                
        var rhinoObjects = file3dm.Objects.FindByLayer(layer);
        foreach (var rhinoObject in rhinoObjects)
        {
            G3_Entity g3_entity;

            switch (rhinoObject.Geometry.ObjectType)
            {
                case ObjectType.Annotation:
                    g3_entity = rhinoObject.Geometry.GetG3Text();
                    break;

                case ObjectType.Detail:
                    g3_entity = rhinoObject.Geometry.GetG3Text();
                    break;

                default:
                    break;
            }
        }
                
    }

Please note Snippet G3_Text is my internal processing object I am creating from Rhino GeometryBase object if it is AnnotationBase…

Above code works alright on Windows but not giving me any text out when deployed to AWS Lambda or Linux (Ubuntu I have tested with). Rest geometries works ok…

The annotation portion is not working, but everything else is working? Is that correct?

Technically Annotation & Detail both giving me empty strings for labels but they both I believe narrows down to AnnotationBase object… which is not working…

Hi there, I would love to know if this issue is going to be fixed or released soon?

Hello! Can you go a bit more in detail here? You are using rhino3dm on windows and the code you shared is giving you the text? Then deploying to AWS/Linux and you don’t get any text with the same code?

yeah right. that was the case in linux with old stable version we were using. I have put some code we are using up there. what more information you exactly need now?

I’ve had time to test this and see the issue you are reporting. I’ve identified where the issue is and we’re working on a fix.

Awesome! Thanks for your notification about the progress! We are waiting for the solution.

Hello @Gunjan_Patel
I’ve committed some fixes that allow the access to these properties in Linux. I’ve pushed a beta build to nuget with this fix: NuGet Gallery | Rhino3dm 8.6.0-beta

Please let me know if this works for you.

Hi Luis, thanks for your updates. This package worked for us (it extracted images for us). We have now started using the 8.6.0-beta in production (about to switch)…

1 Like