DrawSprite WorldLocation


The method DisplayPipeline.DrawSprite(DisplayBitmap bitnap, Point3d worldLocation, float size, bool sizeInWorldSpace) is not using the Point3d in world coords, it seems to be using th x,y screen coordinates.

Here the code:

 public class DrawSpriteCommand : Command
    private readonly DisplayBitmap _bm;
    private bool _enabled;

    public DrawSpriteCommand()
        Instance = this;
        _bm = new DisplayBitmap(new System.Drawing.Bitmap(@"C:\Users\MyUser\Desktop\image.jpg"));

    public static DrawSpriteCommand Instance { get; private set; }

    public override string EnglishName => "DrawSpriteCommand";

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        _enabled = !_enabled;
        if (_enabled) DisplayPipeline.DrawOverlay += DisplayPipeline_DrawOverlay;
        else DisplayPipeline.DrawOverlay -= DisplayPipeline_DrawOverlay;
        return Result.Success;

    private void DisplayPipeline_DrawOverlay(object sender, DrawEventArgs e)
        e.Display.DrawSprite(_bm, Point3d.Origin, 15f,false);

Here a video of the behavior:

Best Regards

Thanks Enric,
I’ll take a look. I logged the bug at

Than you

RH-43751 is fixed in the latest Service Relase Candidate

Good to know, Thanks!

Hi @stevebaer , @brian,
I’m posting there because I have a similar bug (6.9.18253.21101, 10/09/2018):

DisplayPipeline.DrawSprite(DisplayBitmap, Point2d, Single) works fine, while DisplayPipeline.DrawSprite(DisplayBitmap, Point3d, Single, Boolean) fails (does nothing)

Both used to work in V5. I use e.Viewport.WorldToClient(loc) as a workaround and it’s ok.

Best regards