# Variable offset

**URL:** <https://forum.dynamobim.com/t/variable-offset/78320>\
**Category:** Packages\
**Tags:** geometry, dynamo\
**Created:** [July 4, 2022, 3:47pm UTC](https://forum.dynamobim.com/t/variable-offset/78320 "2022-07-04T15:47:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![hassan.orion](https://avatars.discourse-cdn.com/v4/letter/h/eb8c5e/32.png) [@hassan.orion](https://forum.dynamobim.com/u/hassan.orion)\
**Post date:** [July 4, 2022, 3:47pm UTC](https://forum.dynamobim.com/t/variable-offset/78320/1 "2022-07-04T15:47:16Z")

</div>

Hi,  
I am trying to offset a polygon. I am using different offset values for each side.  
Is it possible to attain ? I cannot seem to find any node for that.

I tried to offset with offset distance with various values but then corners are not joining. I also to find any fillet that could close the open corners, no luck so far. has anyone achieved this in Dynamo ?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/c/6cc600f89fc9f72d6bd1b7754b9ce9a089113195.png)

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [July 4, 2022, 4:25pm UTC](https://forum.dynamobim.com/t/variable-offset/78320/2 "2022-07-04T16:25:38Z")

</div>

![OffsetAndTrim](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/9/897851b15dac2292590abb7944ad324b4095ad10.png)  
 ![2022-07-04_18h24_50](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/3/a3b3dc70ad1cf5f3d84812fcca1fdf74a01b5921.png)

@hassan.orion , hi

i think you have to index each offset, and redraw the polygone…

---

<div class="post-metadata">

**Author:** ![GavinNicholls](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/gavinnicholls/32/190442_2.png) [@GavinNicholls](https://forum.dynamobim.com/u/GavinNicholls)\
**Post date:** [July 5, 2022, 4:43am UTC](https://forum.dynamobim.com/t/variable-offset/78320/3 "2022-07-05T04:43:54Z")

</div>

This is the algorithm i use in dynamo and grasshopper. It’s fairly reliable except for extreme shapes that weave and bend a lot.

> [@Offset Curve not the sample distance](https://forum.dynamobim.com/t/offset-curve-not-the-sample-distance/69374/2):
>
> Unfortunately most programs don’t have a builtin way of achieving this - need to do some geometry gymnastics. I had the same challenge in Grasshopper as well, I’ve attached my method built in Dynamo instead. It involves hyperextending the curves in an offset state and finding the most likely center segment when they’re all split at the intersections. It gets a bit messed up for very distorted shapes. You could also use trigonometry on each corner for a better but more complex outcome (I’m not go…

---

<div class="post-metadata">

**Author:** ![viktor\_kuzev](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/viktor_kuzev/32/48254_2.png) [@viktor\_kuzev](https://forum.dynamobim.com/u/viktor_kuzev)\
**Post date:** [July 5, 2022, 11:51am UTC](https://forum.dynamobim.com/t/variable-offset/78320/4 "2022-07-05T11:51:13Z")

</div>

Pity I haven’t seen the older post earlier.

As you mentioned there it needs some geometry gymnastics.  
I believe it’s worth mentioning that the Revit API has such a method for curveloops:

> **[CreateViaOffset Method (CurveLoop, IList(Double), XYZ)](https://www.revitapidocs.com/2022/3097f423-9b0e-5496-bae2-3a82b6875414.htm)**
>
> Online Documentation for Autodesk's Revit API: 2015, 2016, 2017, 2017.1, 2018

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [July 5, 2022, 2:36pm UTC](https://forum.dynamobim.com/t/variable-offset/78320/5 "2022-07-05T14:36:56Z")

</div>

As a design script function.

 ![UnequalOffset_2022-07-05_08-05-11](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/9/f985f75457d608b37e939d1c1c851582adca0c1e.jpeg)

```auto
def unEqOffset (pgn,dst:var[]..[])
{
	crv = List.ShiftIndices(pgn.Explode().Offset(dst),[1,0]);
	cr1 = crv[0].ExtendEnd(crv[0].Length*10);
	cr2 = crv[1].ExtendStart(crv[1].Length*10);
	pnt = List.Flatten(cr1.Intersect(cr2),-1);
	return Polygon.ByPoints(pnt);
};

```

[UnequalOffset.dyn](https://forum.dynamobim.com/uploads/short-url/9CvtypvbeEmav6NMuadChHhy7YJ.dyn) (8.9 KB)

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [July 7, 2022, 11:11am UTC](https://forum.dynamobim.com/t/variable-offset/78320/6 "2022-07-07T11:11:56Z")

</div>

Hello, is the definition of a function dependent on the dynamo version?

 ![Capture d’écran 2022-07-07 130710](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/9/39f7d6586ee4f6d7a9175f2b226b423630005bfc.jpeg)

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/6/0627efd1cc67b931baccb0b22efaf373c2665e43.png)

cordially  
christian.stan

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [July 7, 2022, 12:03pm UTC](https://forum.dynamobim.com/t/variable-offset/78320/7 "2022-07-07T12:03:43Z")

</div>

> [@christian.stan](#):
>
> is the definition of a function dependent on the dynamo version?

No idea 😕

See if this helps you spot the problem

 ![UnequalOffset_2022-07-07_05-30-36](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/1/51e5bf2033ff704e4634c16205ef1da92fdb14c1.png)  
[UnequalOffset-1.dyn](https://forum.dynamobim.com/uploads/short-url/vt9o926FG3wyQ4Krycc1JSVVbS8.dyn) (9.3 KB)

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [July 7, 2022, 12:10pm UTC](https://forum.dynamobim.com/t/variable-offset/78320/8 "2022-07-07T12:10:24Z")

</div>

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/d/8d9c1e379a431bec646d672926136394362abe59.png)  
This may be due to the fact that I have a revit education version

cordially  
christian.stan

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [July 7, 2022, 12:12pm UTC](https://forum.dynamobim.com/t/variable-offset/78320/9 "2022-07-07T12:12:51Z")

</div>

No need to mobilize too much of your time, I will try simple functions from the Bilt 18 document by Mr. Sol Amour

cordially christian.stan

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [July 7, 2022, 12:35pm UTC](https://forum.dynamobim.com/t/variable-offset/78320/10 "2022-07-07T12:35:56Z")

</div>

> [@christian.stan](#):
>
> This may be due to the fact that I have a revit education version

That shouldn’t be a problem

---

<div class="post-metadata">

**Author:** ![hassan.orion](https://avatars.discourse-cdn.com/v4/letter/h/eb8c5e/32.png) [@hassan.orion](https://forum.dynamobim.com/u/hassan.orion)\
**Post date:** [July 7, 2022, 12:56pm UTC](https://forum.dynamobim.com/t/variable-offset/78320/11 "2022-07-07T12:56:49Z")

</div>

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/7/d7187dcd75f2ff15fcb7fb5a199829d4f022f6a5.png)  
i am facing the same issue

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [July 7, 2022, 1:19pm UTC](https://forum.dynamobim.com/t/variable-offset/78320/12 "2022-07-07T13:19:55Z")

</div>

Our problem comes from line 7  
(of the creation of intersection points)  
In the creation you relied on the Orchid classes (Not sure of the term used)

Cordially  
christian.stan

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [July 7, 2022, 1:26pm UTC](https://forum.dynamobim.com/t/variable-offset/78320/13 "2022-07-07T13:26:36Z")

</div>

Then try to prefix _List_ with _DSCore_

```auto
def unEqOffset (pgn,dst:var[]..[])
{
	crv = DSCore.List.ShiftIndices(pgn.Explode().Offset(dst),[1,0]);
	cr1 = crv[0].ExtendEnd(crv[0].Length*10);
	cr2 = crv[1].ExtendStart(crv[1].Length*10);
	pnt = DSCore.List.Flatten(cr1.Intersect(cr2),-1);
	return Polygon.ByPoints(pnt);
};

```

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [July 7, 2022, 1:36pm UTC](https://forum.dynamobim.com/t/variable-offset/78320/14 "2022-07-07T13:36:49Z")

</div>

I tried that and also to change the precision  
anEqOffset is not colored

 ![Capture d’écran 2022-07-07 153303](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/1/e1b3537fe82a77074bcd2fce13344c41706a4173.jpeg)

Intersect (not a function used within a function)  
cordially  
christian.stan

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [July 7, 2022, 1:53pm UTC](https://forum.dynamobim.com/t/variable-offset/78320/15 "2022-07-07T13:53:26Z")

</div>

See if the node version of the same works

 ![UnequalOffset-N_2022-07-07_07-20-58](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/6/d6bc537a1390ab097ef11e2539d9552f2484cf70.jpeg)

[UnequalOffset-N.dyn](https://forum.dynamobim.com/uploads/short-url/spcjpmlAR4srLTkXV1Nuufqeyvu.dyn) (32.3 KB)

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [July 7, 2022, 1:57pm UTC](https://forum.dynamobim.com/t/variable-offset/78320/16 "2022-07-07T13:57:15Z")

</div>

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/6/66e30b1fa499ab5e12c270f5730d33fe7bd029d7.png)  
Thank you for your efforts

edit:  
You can show the contents of the Geometry.Intersect node  
cordially  
christian.stan

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [July 7, 2022, 2:18pm UTC](https://forum.dynamobim.com/t/variable-offset/78320/17 "2022-07-07T14:18:23Z")

</div>

> [@christian.stan](#):
>
> show the contents of the Geometry.Intersect node

Expanded most of them

 ![UnequalOffset-N_2022-07-07_07-46-55](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/9/891713c71b34b4dc31b4458044d259a57e957f84.png)

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [July 7, 2022, 2:32pm UTC](https://forum.dynamobim.com/t/variable-offset/78320/18 "2022-07-07T14:32:28Z")

</div>

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/6/563a20b7a77d3251361efdd92c48a89af4fbacec.png)  
Very strange I don’t have the same coordinates after offset

I mobilize you a lot, in addition it is starting to get late at your home (with the jet lag), thank you for your pugnacity  
Cordially  
christian.stan

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [July 8, 2022, 6:34am UTC](https://forum.dynamobim.com/t/variable-offset/78320/19 "2022-07-08T06:34:36Z")

</div>

Hello, this comes from the curve.offset some offsets are normal to the plane of the curve and others tangent to the curve (I think that’s what gives different results from you)

 ![Capture d’écran 2022-07-08 082905](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/b/6bf5aee71a57b8be956378989d100b308411fc6f.jpeg)

Cordially  
christian.stan

---

<div class="post-metadata">

**Author:** ![GavinNicholls](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/gavinnicholls/32/190442_2.png) [@GavinNicholls](https://forum.dynamobim.com/u/GavinNicholls)\
**Post date:** [July 8, 2022, 6:40am UTC](https://forum.dynamobim.com/t/variable-offset/78320/20 "2022-07-08T06:40:29Z")

</div>

Try the algorithm i posted earlier. It checks curves for which way their normal faces to make sure they offset the right way.

[Next page](https://forum.dynamobim.com/t/variable-offset/78320.md?page=2)
