Plugin : Flow Objects to Surface Along Projection Direction
ProjectFlowEx is a plugin command (ProjectFlowEx) developed for Rhino 7, used to map/deform selected geometry between two surfaces (Base / Target) according to a user-specified projection direction or the normal direction of the base surface. It combines capabilities of “projection + mapping + optional normal-based rotation,” making it convenient for geometric migration and deformation between complex shapes.
Usage Instructions
Select the objects to be projected.
Select the base surface and target surface; multiple surfaces are supported(Brep).
Select the projection direction. The objects to be projected must be fully covered by the base and target surfaces along the projection direction.
This is particularly useful for applying solid patterns or textures to other surfaces while ensuring precise fitting. Rhino’s built-in UV unwrapping and surface flow tools are not very user-friendly and do not support multiple surfaces.
Implementation
- Single Point Transformation:
For a point A, create an infinite line passing through A along vector vectora, intersecting the base surface and target surface to obtain FromPt and ToPt respectively.
Calculate the displacement from FromPt to ToPt along vectora, and move point A by the corresponding amount to get point A2.
If alignment along the normal direction on the target surface is desired, calculate the rotation angle angle1 between the vector (FromPt - ToPt) and the normal vector of the target surface at ToPt. Then, with ToPt as the base point and vector (FromPt - ToPt) as the base vector, rotate by angle1.
The same principle applies to other desired directions.
- Transforming Geometry Based on Point Transformation:
For curves, convert to NurbsCurve and adjust by moving control points to fit onto the target surface.
For subdivisions, meshes, extrusions, and surfaces, uniformly convert to Brep for processing.
For each face of the Brep, convert to NurbsSurface and adjust by moving control points to fit onto the target surface.
Limitations and Known Issues
For trimmed surfaces, projecting to the target surface will revert to untrimmed surfaces, or they may need to be converted to meshes for handling.
It does not automatically calculate tolerances; to achieve a close fit to the target surface, need Increase the number of control points. My plugin can set the magnification factor, but I don’t know how to automatically calculate the magnification factor based on the required tolerance.
I don’t know of better ways to transform geometry based on point transformations. I know about CageEdit, but it doesn’t have an open API in C# RhinoCommon.
For already trimmed surfaces, I’m not sure how to handle them (perhaps by transforming the Brep trim curves to the target surface simultaneously and then trimming the transformed untrimmed surface to retain the trimmed state, but I don’t know how to implement it).
How to automatically trim the parts of the projected objects that exceed the target surface?
Performance issues: I used parallelism, and although no errors were reported, I’m not sure if Rhino supports parallelism and which operations can be parallelized.
ProjectTools.rar (121.6 KB)