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