Is there any way to hook into v5 gumball's extrusion for custom object?

So I’m looking at integrating with Rhino v5’s gumball better. One thing that would be nice is if you could extrude t-spline faces/edges with the ctrl key like you can extrude curves into surfaces and surfaces into solids.

Is there any way to hook into that with v5?

Something like CRhinoObjectGrips::DeleteGrips (but for extrusion) would be ideal, but I didn’t see anything.

There should be, although I have never typed up an example. Give me a few days and let me see what I can come up with.

Great, thanks Dale. I was rereading my post and realized I forgot to specify, would this be possible with the auto gumball, outside of any command?

I’ve posted a gumball sample on our GitHib site:

https://github.com/mcneel/Rhino5Samples_CPP/blob/master/SampleCommands/cmdSampleGumball.cpp

The sample demonstrates using the gumball in a command.

As far as using the “auto” gumball with custom objects, it is not clear to me whether or not this is possible. But I will do some more digging.

Thanks Dale… :smile:
I’d love to get t-splines as functional with the gumball as they are with the ts manipulator.

Hey Dale, any news on whether it’s possible with the auto gumball?

Hi Tom,

I have not heard back from the developer. I know he has been on vacation for a while.

Personally I don’t believe it is possible. I don’t believe the auto-gumball is exposed anywhere. So I don’t know how you are going to get at it to customize it. But I will wait for a more informed rely.

Yeah, it’s not possible. That stuff isn’t my handiwork, I think it’s Dale Lear’s, or Steve’s, but seems to me everything related to autogumball is deliberately not exported in any shape or form.

So, I would love to drop our manipulator in Rhino 5 and beyond, and just use the gumball. But I don’t think our customers would be happy about it at all unless we could get the same functionality with the rhino 5 gumball (or close enough).

There are 2 things that I think would be necessary. The first is soft manipulation, and the second is extrusion in the manipulator. For soft manipulation we might be able to hack something into the grips themselves (this would lose some functionality, but not too much). But for extrusion in the manipulator, we’d need to integrate with the gumball itself.

So, here’s a proposal of how it could work (and not break rhino 4 compatibility, or plugins that were compiled before the changes).

Make a subclass of CRhinoObjectGrips called CRhinoObjectGripsEx or CRhinoObjectGrips2 or however you want to version the class. I’ll call it CRhinoObjectGrips2 for this example. CRhinoObjectGrips2 has a new member function called ExtrudeGrips which is similar to the DeleteGrips function. It takes an array of indexes of grips to extrude. This extrusion happens immediately, but is only internal state to the grips object, and only takes final effect when NewObject is called. But that way you can get the nice dragging previews while extruding.

You might also add a CRhinoObjectGrips2::ClearGripExtrusions or something if you wanted to.

I’ll change my code to subclass CRhinoObjectGrips2 on Rhino 5, just requiring whatever version it is added in.

Then inside of the autogumball code, where it would usually extrude grips, it runs a CRhinoObjectGrips2::Cast on the grips, and if that succeeds then it calls the ExtrudeGrips function. If not, then it tries to do its own thing as before.

That way if someone subclassed CRhinoObjectGrips, their stuff still works. But if they subclass the new version then they get the new functionality. This is a bit messy, in that you’re basically versioning your parent classes. However, when you break backwards compatibility in Rhino 6, you just collapse all of the CRhinoObjectGrips classes down into the base class… move the new functions into CRhinoObjectGrips and delete the other classes. Plugin developers then just need to search and replace CRhinoObjectGrips2 with CRhinoObjectGrips, and they’re good to go (or if they never used the new functionality, they’re source compatible).

I think that kind of approach could fix a lot of the difficult circumstances that arise from maintaining binary backwards compatibility with Rhino 4.

TL;DR: Please fix all my problems :grin:

Hi Tom,

When I get a chance I will run this by @dalelear. By extruding a grip, you are basically looking to translate a grip in a fixed direction?

The current manipulator extrude that we have implemented has two parts… the first is the change to the object, and then second is the transformation of the new components. So if you extrude a curve with the manipulator, it first turns it into a surface and then transforms the edge grips that correspond with the other side of the surface.

If you extrude some faces on a T-spline then it first does the topological change, and then transforms the faces. So, you can do things like scaling a face in while extruding it, as shown in this video: http://youtu.be/ldAwJ94Nimg

Hey Dale, any news on this?

@dalelear, I think this for you…

Hey @dalelear, any news on this?

1 Like

This would be awesome.