More Cage Edit Options

It would be nice if the control points of a cage editor could be used by some commands like project to surface etc. Unless something like that is already available?

That sounds interesting. How do you mean exactly?

I’ve only really explored Cage Edit recently - I’ve used it for Shoe Sole models for final tweaks with annoying stuff e.g. adding a whole 1mm thickness without reworking completely (obviously resulting in isocurve mayhem, but does give an ‘option’ quickly). Using lofts/sweeps as Control Objects to try and hold position of very specific areas and such was a fun test too. I also tried Cage Editing a collection of polysurfaces, exploded as surfaces, with MatchSrf+History to see if I could have a workaround for Preserve Structure to sort of work with Cage Edit.

How else do you use CageEdit, Michael?

I also feel that when performing the Cage Edit e.g. with Gumball that it should possible for the preview to not be yellow. Can this be done? It can be very distracting, esepcially if for example doing a Cage Edit in Top View to match an edge to a desired location determined by a guide curve, to hardly be able to see anything through.

What I mean is this. In Maya I can make a Lattice (Maya’s version of a cage)

Then I can snap the lattice points to surfaces, etc. Makes high resolution deformations easier. That is why I think if the control points could use Rhino commands like project or closest point that it could make the cage easier to use.

Hi Michael - this is ‘scriptable’… I’ll have a look.

This should work as long as there is only one possible target location for the control point - i.e. the target object does not have two surfaces or a surface that doubles back to provide a second target - like a box or sphere. I’ll fix that up when I get a chance.

Pre-select the control points for this one, it’s quick and dirty…

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino


def ProjectControlPoints():
    ids = rs.NormalObjects()
    gripList = [(id, rs.SelectedObjectGrips(id)) for id in ids if rs.ObjectGripsSelected(id)]

    if len(gripList) == 0 : return
    
    targId = rs.GetObject("Select the target object.", 8+16)
    if not targId: return
    targ = sc.doc.Objects.Find(targId).Geometry
    
    vecDir = rs.ViewCPlane()[3]
    tol= sc.doc.ModelAbsoluteTolerance

    rs.EnableRedraw(False)
    for id,grips in gripList:
        pts = [rs.ObjectGripLocation(id,grips[n]) for n in range(len(grips))]
        targs = []
        for pt in pts:
            ray = Rhino.Geometry.Ray3d(pt, vecDir)
            Result = Rhino.Geometry.Intersect.Intersection.RayShoot(ray, [targ], 1)[0]
            if Result:
                targs.append(Result)

        for n in range(len(grips)):
            rs.ObjectGripLocation(id, grips[n], targs[n])
            
    rs.EnableRedraw(True)

    
if __name__ == '__main__': ProjectControlPoints()

@Michael_Pryor - edited above to handle more complex target objects and get the right- I hope - location.
Projecting control points is being worked on as a built-in Rhino thing I believe.

-Pascal

7 Likes

Thank you! This will save a lot of time on a current task! (Could be nice to integrate as a real feature sometime :wink: )

Hi
You can also do this with FlowAlongSurface

That is for one surface. If you look at the images the issue was about fitting between two surfaces.

Hi
I meant If you select the set of Points(From the cage) you want to project then build them a rectangle surface (this will be the base surface for the FlowalongSrf command) then run the FlowAlongSrf command for the set of points you want to relocate on the new surface.
hope my explanation is clear enough

Solomon

1 Like

Flow along surface does not work with cage edit points. That was the reason I made the post. Again, this doesn’t solve the between two surfaces issue.

Edit: It seems in R6 it does, however with Pascal’s is nice that I can snap to meshes and polysurfaces. The good news is he says they are working on including it. The other nice thing is you don’t have to worry about reference surfaces and surface UV directions. However, good to know the FlowAlongSurface Method -Thanks!

Hi
I hope i am not nagging but Flow Along Surface command do work with control points (Mesh , cage edit points, surface)
Also works with flow along curve

Solomon

Read my edit - I said it worked :smiley: I know Flow Along Surface well, just didn’t know it works with cage points now.

The advantages of the other methods is
1.Projection rather than interpolation (flow interpolates via UV space which can cause unwanted x and y deformation based on the difference in the UV space of the reference surface to the surface to flow along)
2.No need for reference surfaces
3.No need to check UV directions
4.I can snap / flow to Meshes and Polysurface (flow on surface and flow on curve only flow along surfaces and curves)

You are right
Thanks

Hi,
Select the target object is only one surface, does muti surfaces?