How to place an object or bitmap image in viewport?

I’m generating piped paths in lattices at XY origin. I like to show an in perspective reference lattice in the viewport corner (see image).

My strategies / issues are:
First strategy:
Position lattice at origin and move it in viewport corner.
The problem is that the perspective changes as I move it and I have no good way to move it and keep it in the corner while zooming or changing perspective.

Second strategy:
Render an image of the lattice at origin first and insert that bitmap in the viewport corner before exporting the combination. I don’t know how to go about inserting a small bitmap in the viewport corner.

Any suggestions would be greatly appreciated.

  • A

Hi @Anton, you can try if below python script helps as a starting point, it uses a conduit to draw a box in the viewport corner:

Conduit_BoxInViewport.py (1.1 KB)

You could draw a bitmap in a conduit as well, but i guess the first strategy would be easier.
_
c.

1 Like

@clement thank you much sir. I’ll check this out next weekend.

while not a python guy yet, I got it to work. Any suggestions why it may lock up from time to time? Any way to invoke it and pass the lattice on an input. Maybe it needs an active / inactive toggle. I’m going to play with it more tomorrow. Its very close to exactly what I was looking for. Thanks you very much!

Hi @Anton, are you running this in Rhino 5 or Rhino 6 ? You’re using the built in PythonScript editor ?

Small stutter i’ve only noticed in Rhino 5. But no lockup. I can probably change it to turn it on or off so it runs permanently.

_
c.

I use Rhino 6. It would be great to enable the displaying in the screen with the lattice object provided on an input in the lower right hand corner. However, you gave given me a lot to work with and learn from already, it is only the crash that concerns me. I could like wrestle through the rest.

Added the enable trigger. Struggling a bit to make it based on brep in and output that brep at the target location.

Hi Anton, i cannot make it crash over here. I only see a bit of stutter in V5 but in V6 it runs very fast. If it brings down Rhino on your side, it may leave a crashlog on your desktop which would help to find out the source.

Also if you post your script i may be able to help you further.

Not sure i get this. You can change the position of the lattice object from the script if you change this line which displays it at top right:

pt2d = Rhino.Geometry.Point2d(bounds.Right - 90,  90)

to this which then displays it at bottom right:

pt2d = Rhino.Geometry.Point2d(bounds.Right - 90, bounds.Bottom - 90)

I’ll answer your PM now.
_
c.