Soft Editing One Surface on a Closed Polysurface (Rhinocommon)

My rhinocommon plugin needs to soft edit one surface on a closed polysurface (made up of trimmed surfaces). The user will specify the location, u and v distances, and height to be soft edited.

If I were doing this in Rhino manually, I would explode the polysurface, soft edit the desired surface with fixedges on, and then join the trimmed surfaces back together, using joinedge to join anything not watertight.

In Rhinocommon, I don’t think I explode the brep, but rather get a list of trimmed surfaces, but I don’t see this option. Is there a way to get this? My plan then is to script the soft edit on the appropriate trimmed surface, then join the trimmed surfaces back together into a brep and use brep.joinnakededges to get it watertight.

The purpose of all this is to allow a user to add what is known as a metpad to a foot orthosis, which adds pressure (usually just behind) the metatarsal region of the foot. So basically, I’m just trying to bulge the volume of the orthosis in that region with a bit of user control. If you have any better suggestions on how to do this, I’d like to hear.

Thanks,
Sam

To “explode” a Brep in RhinoCommon, you would do something like:

Brep toExplode; //defined elsewhere
Brep[] exploded = toExplode.Faces.Select(bf => bf.DuplicateFace(false)).ToArray();

// soft edit here - I have no idea how to do this, you mention scripting it?

double joinTolerance = doc.ModelAbsoluteTolerance;
Brep joined = Brep.JoinBreps(exploded, joinTolerance);
while (!joined.IsSolid)
{
    joinTolerance *= 10;
    joined.JoinNakedEdges(joinTolerance);
}

Hi Menno,

I will be scripting softeditsrf.

I think in vb.net and so tried a converter with your code but it had trouble. Select doesn’t seen to be a member of Faces, what am I missing?:
toExplode.Faces.Select

Also, are you sure faces maintain trims? When I add all of the faces of a brep to a document, I get the untrimmed surfaces:
For Each BrepFace In toExplode.Faces
doc.Objects.AddBrep(BrepFace.ToBrep)
Next

Thanks,
Sam

Select is LINQ. I suppose in VB.NET you would do something like

For Each bf In toExplode.Faces
doc.Objects.AddBrep(bf.DuplicateFace(False))
Next

Or some such like that. The important bit is that you get each BrepFace from the Faces collection and call DuplicateFace(false) on it.

Thanks Menno,

That worked great.

I just realized a problem with my approach though; fixedges fixes the surface edges, not the trimmed edges, right?
So if I soft edit too close to the edge, then I won’t be able to rejoin… Looks like I will have to retrim the surfaces to each other.

A soft edit that worked on polysurfaces would be great. Anyone request this yet?

Thanks,
Sam