Sorry, it was late last night and I realized the post had some wrong info, which is why I deleted it…
The projection is a bit more complex than I described in the original post, so today, in between things, I decided to script it in Python. Pascal has a VB Rhinoscript somewhere that does more or less the same thing, but I decided to write mine from scratch as a learning experience.
The attached (first draft) will project one or more curves onto one or more surfaces or polysurfaces using the perspective projection in the active viewport. It does so by:
- finding the camera-target vector and camera plane
- finding the bounding box of the target objects
- creating a plane behind the bounding box of the objects parallel to the view plane
- copying the curve objects to this plane at the same time scaling them up according to the perspective view angle
- extruding the copied curves back to the camera point (extrude to point)
- finding the intersection between the extruded surface(s) and the target object(s) (if any)
- the intersections represent the projection in perspective of the input curves. In theory in the active perspective viewport they should line up perfectly with the input curves…
As this is written partly with RhinoCommon, no geometry is added to the file until the final step, so if the user bails out in the middle or it fails, no remnants should be left behind (that was part of the reason for RhinoCommon).
Anyway, feel free to try it out, let me know if it breaks, I haven’t tested it extensively.
ProjectAlongViewPerspective.py (2.6 KB)