Trimmed BSPlineSurface by distance

I have a NURBS face shown in pink. I want to trim the surface, similar to with  Geom_RectangularTrimmedSurface, but with distance as opposed to u,v parameter to achieve the draw face shown in green.

I know this is a tricky problem because the distance trimmed by the u,v parameters may not be uniform along each edge, but if necessary I can approximate that it is.

Any ideas would be greatly appreciated. Thanks!

Mikhail Sazonov's picture

I think you need to make inside offset of the bounds and restrict the surface by them.

Thomas Anderson's picture

Here is a trick that I have been using for years, with varying success:
Thicken your pink, input surface to a solid. The offset value doesn't matter, just make solid.
Offset just the perimeter faces of that solid by the desired distance. Negative value in your case.
Extract the smaller face copy from the result solid.
good luck.

Matthias K.'s picture

May I ask how you offset only a subset of a solid. I am trying it using

BRepOffset_MakeOffset

but without success. Thanks, Matthias.

Thomas Anderson's picture

That trick doesn't always work, so you might not be doing anything wrong and it still fails. anyway here is how I am doing it in cadseer

BRepOffset_MakeOffset builder;
builder.Initialize
(
  'TopoDS_Shape', //the entire shape
   0.0, //actual offsets will be assigned in loop.
   1.0e-06, //same tolerance as the sewing default.
   BRepOffset_Skin, //offset mode
   Standard_False, //intersection
   Standard_False, //self intersection
   GeomAbs_Intersection, //join type.
   Standard_False, //thickening.
   Standard_False //remove internal edges
);
for (const auto &f : Faces)
  builder.SetOffsetOnFace(f, -1.0);
Matthias K.'s picture

Thanks Thomas!
I set to zero after initialization, which obviously does not work.

I can confirm your experience that some configurations do work and others do not.