# Wrap Curve onto Surface

I am trying to wrap a curve with a repetitive zig zag pattern onto a surface- this is a hypothetical situation to nail down a workflow. What I want is so that the zig zag stays relatively consistent. Think of it like pulling a ribbon tight over a surface- the pattern on the ribbon stays relatively consistent even when bent. Projection and pull are not viable solutions as those severely warps the zig zag spacing.

How can I do this in Rhino? Better yet, how can this be done in grasshopper (maybe recursively bending short portions of the curve relative to the curvature of the surface)? Preferably, this workflow would work for Breps too.

160420 Wrap Curve to Surface.3dm (266.9 KB)

Hi Lawrence - that will be tough to get right without some fiddling- the surface in the curvy area is pretty tapered. Try:

• Rebuild the target surface with a lot of points to even out the UV
• CreateUVCrv from this.
• Make a PlanarSrf from the rectangle
• Place the pattern in the rectangle
• FlowAlongSrf from the plane to the rebuilt surface. If you record History, you can move the pattern around on the flat and it will update on the 3d. (Example attached)
160420 Wrap Curve to Surface_PG.3dm (354.6 KB)

When the pattern is where you like in 3d, delete the rebuilt target surface and Show (it’s hidden) the original.

@lawrenceyy I’m not sure there is any advantage here in rebuilding the target surface - it looks about the same in this case.

No, I take that back - Rebuild helps.

-Pascal

Hey Pascal,

Your solution definitely works. It’s a shame there is no tool that is a mix of blend and pull so that you can manipulate the curve right on the surface in 3D space.

While I was waiting for a response I experimented with UnrollSrfUV. It seems that CreateUVCrv makes a UV rectangle while the UnrollSrfUV literally flattens out the geometry. In both cases FlowAlongSrf will work to orient 2D curves onto the 3D surface.

I had previously tried out grasshopper’s Map Srf command unsuccessfully, but it is working for me now, I think the UVs were not in sync between the source and the target surface. How can I UnrollSrfUV or CreateUVCrv in grasshopper or Rhinocommon (GhPython)?

Hi Lawrence - the Unroller is in Rhino.Geometry.Unroller

http://developer.rhino3d.com/api/RhinoCommonWin/html/T_Rhino_Geometry_Unroller.htm

-Pascal

Hi Lawrence - you don’t need to CreateUV curves or unroll - any rectangular surface will do - with History you can change it’s shape on the fly as well., it’s just that the UV rectangle matches the surface UV so the proportions are correct.

-Pascal

@pascal

If instead I had a mesh model, is there any way to flow along a mesh? Or would i have to find a way to approximate the mesh as a surface, do the whole unroll and flow along sequence and then pull the results to the mesh? How do we pull to a mesh in grasshopper- the default pull only pulls to surface.

Actually, I found pull to mesh: Rhino.Geometry.Curve.PullToMesh()

Hi Lawrence - meshes cannot be used to flow to… you’ll have to make a surface - Patch on a subset of the mesh vertices - or all of them depending - may be useful - you may then want to split the surface with isocurves (`Split` command) to frame out a smaller part of the resulting surface as a flow target. ShrinkTrimmedSrf, or Shrink=Yes in Split…

Pull should work on meshes - maybe not in GH, I’ll check, but certainly in a script…

-Pascal

Thanks Pascal,

I did not know that the patch tool also worked with a collection of points. And it appears that I can guide the UV orientation if I draw a curve on the mesh and add it to the selection of points.

I’m working with closed meshes. Is there anyway to lasso all the vertices within an area without lasso-ing vertices on the other side of the mesh? The other thing I noticed was that you can’t deselect with lasso by holding the control key like you can with normal deselection.

Hi Lawrence - use CullControlPolygon to hide back-facing mesh points. Hmm- I see that command is broken, for meshes, in V6… http://mcneel.myjetbrains.com/youtrack/issue/RH-33710

Also, `SelBrushPoints` may be useful here.

-Pascal

Thanks Pascal. CullControlPolygon is really useful.