# Offset trimmed surface

**URL:** <https://discourse.mcneel.com/t/offset-trimmed-surface/201282>\
**Category:** Rhino Developer\
**Tags:** windows\
**Created:** [March 13, 2025, 2:42pm UTC](https://discourse.mcneel.com/t/offset-trimmed-surface/201282 "2025-03-13T14:42:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christos\_Tsaridis](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/christos_tsaridis/32/762744_2.png) [@Christos\_Tsaridis](https://discourse.mcneel.com/u/Christos_Tsaridis)\
**Post date:** [March 13, 2025, 2:42pm UTC](https://discourse.mcneel.com/t/offset-trimmed-surface/201282/1 "2025-03-13T14:42:17Z")

</div>

I am using the following code to visualise thickness of Breps and their faces (comments on how this could be done otherwise or better welcome):

```auto
Brep getThickenedSurfaceBrep(BrepFace face, double thickness, double eccentricity) {
    double tol = RhinoDoc.ActiveDoc.ModelAbsoluteTolerance;
    Surface offset = face.Offset(eccentricity, RhinoDoc.ActiveDoc.ModelAbsoluteTolerance);
    BrepFace offsetFace = offset.ToBrep().Faces[0];

    Brep thick = Brep.CreateFromOffsetFace(offsetFace, thickness / 2, tol, bothSides: true, 
createSolid: true);
    return thick;
}

```

The issue is that trimmed faces are back to their untrimmed state as soon as I use the `Offset` method. How can I create this offset solid from a trimmed face?

---

<div class="post-metadata">

**Author:** ![jim](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jim/32/570126_2.png) [@jim](https://discourse.mcneel.com/u/jim)\
**Post date:** [March 13, 2025, 4:36pm UTC](https://discourse.mcneel.com/t/offset-trimmed-surface/201282/2 "2025-03-13T16:36:17Z")

</div>

> [@Christos\_Tsaridis](#):
>
> The issue is that trimmed faces are back to their untrimmed state as soon as I use the `Offset` method.

Its the ToBrep method as well as face.Offset that will untrim the face.

Can’t you just feed your face variable to Brep.CreateFromOffsetFace ?

You seem to be trying to offset the face twice so both times I would use Brep.CreateFromOffsetFace, but don’t use ToBrep in between if you want to preserve the trim definitions

.

---

<div class="post-metadata">

**Author:** ![Christos\_Tsaridis](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/christos_tsaridis/32/762744_2.png) [@Christos\_Tsaridis](https://discourse.mcneel.com/u/Christos_Tsaridis)\
**Post date:** [March 13, 2025, 6:40pm UTC](https://discourse.mcneel.com/t/offset-trimmed-surface/201282/3 "2025-03-13T18:40:30Z")

</div>

I do it like this because `Brep.CreateFromOffsetFace` offsets the surface in place, while I want to be able to have eccentricity applied, therefore I first move the surface by the eccentricity.

---

<div class="post-metadata">

**Author:** ![jim](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jim/32/570126_2.png) [@jim](https://discourse.mcneel.com/u/jim)\
**Post date:** [March 13, 2025, 7:37pm UTC](https://discourse.mcneel.com/t/offset-trimmed-surface/201282/4 "2025-03-13T19:37:16Z")

</div>

> [@Christos\_Tsaridis](#):
>
> while I want to be able to have eccentricity applied, therefore I first move the surface by the eccentricity

You asked why your trimmed brepface was losing reverting to its untrimmed

Both of these lines in your code will result in the loss of the face trims:

```auto
    Surface offset = face.Offset(eccentricity, RhinoDoc.ActiveDoc.ModelAbsoluteTolerance);
    BrepFace offsetFace = offset.ToBrep().Faces[0];

```

That means you cannot use those functions if you don’t want to lose the trim boundaries. You have to do it a different way.

If you use face.Offset() it will offset the underlying surface and the trim boundaries are lost.

The first offset needs to be done with Brep.CreateFromOffsetFace() as does the second offset. You should extract the face from the brep result of the first offset to get the face to input for the second offset.

---

<div class="post-metadata">

**Author:** ![Christos\_Tsaridis](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/christos_tsaridis/32/762744_2.png) [@Christos\_Tsaridis](https://discourse.mcneel.com/u/Christos_Tsaridis)\
**Post date:** [March 14, 2025, 12:16pm UTC](https://discourse.mcneel.com/t/offset-trimmed-surface/201282/5 "2025-03-14T12:16:15Z")

</div>

That was enlightening, this is how I made it work, thanks for the input:

```auto
Brep getThickenedSurfaceBrep(BrepFace face, double thickness, double eccentricity) {
    double tol = RhinoDoc.ActiveDoc.ModelAbsoluteTolerance;
    Brep offset = Brep.CreateFromOffsetFace(face, eccentricity, tol, bothSides: false, createSolid: false);
    BrepFace offsetFace = offset.Faces.First();

    Brep thick = Brep.CreateFromOffsetFace(offsetFace, thickness / 2, tol, bothSides: true, createSolid: true);
    return thick;
}

```
