DrawSprite WorldLocation


#1

Hello,

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;
        doc.Views.Redraw();
        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
Enric


(Steve Baer) #3

Thanks Enric,
I’ll take a look. I logged the bug at
https://mcneel.myjetbrains.com/youtrack/issue/RH-43751


#4

Than you


(Brian Gillespie) #5

RH-43751 is fixed in the latest Service Relase Candidate


#6

Good to know, Thanks!