How to implement su push/pull

I want to implement similar operations to su push/pull.
In UI, select object or sub object which is curve, edge, face, and then can push/pull with gumball.
Using api, I can filter selected object or sub object and highlight it, but don’t know which api should be used to implement push/pull.
One possible way is show gumball of selected object/sub object, and then use builtin function. It seems not a perfect way because need one more step picking gumball before push/pull. In addition, I don’t find the api to select sub object.

What is this? Can you provide any additional information?

– Dale

“su” is abbreviation of “SketchUp”, and below gif demo operation of su push/pull

Hi @RyanZhou,

The basis for push/pull, in regards to Breps, is Brep.TransformComponent.

There are ways to select Brep components using GetObject. I’m sure there are dozens of examples here on the forum.

– Dale

@dale, Thanks for your suggestion.
I have implemented a demo with Brep.TransformComponent, but the result is not as expected.
Expected result is below

It may be that Brep.TransformComponent implement gumball’s extrusion, and my expected opration is gumball’s push/pull.

Sorry, I guess I was thinking of SolidTools.

I’m sure gumball extrude does some kind of BrepFace.CreateExtrusion and Brep.CreateBooleanUnion thing.

– Dale

Does it mean that there is no existed api equals to gumball’s operations, need to implement myself using CreateExtrusion and CreateBooleanUnion?


– Dale

You may also want to check this post:

1 Like

@mlukasz87 Thanks for your sharing!
I will study this and try to imitate using C#

@dale I want to implementing same result of gumball’s pulling/pushing on selected face of open polysurface.

Currently, I achieved it by below steps:

  1. Get border of selected face and create extrusion from curve
  2. Remove selected face from created extrusion with CreateBooleanDifference
  3. Remove selected face from origin Brep with CreateBooleanDifference
  4. Join all breps gotten from step 2,3

I am not sure it is correct way or whether there is other simple way. Do you have any suggestion?

Below are source code and model
SUTestCommand.cs (3.4 KB)
pushpull.3dm (69.0 KB)


@dale, Do you have any suggestion?

@dale , Would you please have a look at this question?

When a subsurface is pulled from one side of a body to a parallel opposing side, SketchUp push/pull automatically eliminates the face. The result is a closed object. In Rhino however you end up with a closed polysurface with two coplanar faces. The polysurface can be exploded and the inner surface can be subtracted from the larger one with a planar boolean difference. I always liked how this works in SketchUp.

Pulling the subsurface beyond the opposing face results in a polysurface where Rhino seems to be confused with the normals. Exploding the polysurface shows flipped original surfaces. Once everything is trimmed and joined again, the result is inside out and needs to be flipped.

@martinsiegrist I’m not seeing that behavior here:

You’re right. I wasn’t using the extrude function on the arrow for all operations.

In Sketchup you can use the push/pull function to extrude an extension and then move the new face back into the object with the move command. Once the surface is coplanar with the opposite surface it automatically trims the surface. The surface I moved needs to be deleted.

What I wanted to point out is that SketchUp automatically splits a surface with a coplanar curve.

Hi @RyanZhou,

There is a lot in this thread. What is the question, specifically?


– Dale

Hi @dale, it is related to this.

Hi @RyanZhou,

As I’ve mentioned, there is no method in RhinoCommon for what the gumball does in regards to extruding. That said, what you are doing seems reasonable. You might also consider throwing BrepFace.CreateExtrusion into your toolbox.

– Dale