Drawing to view at runtime with PDI (FPrimitiveDrawInterface)

I was asking what the context is since that affects how you can get hold of a PDI.
But yes, for the general case, you would want to create a custom component deriving from UPrimitiveCompoent, and a custom scene proxy to go with it.

I have some rather old code here you can look at. It probably wouldn’t compile with current engine versions, but the general process is essentially still the same.