Create Curve Offset

Let me share how to offset curves in Revit API.
I found it really useful on a few recent tools I was working, so I want to share it with you. It's not complicated and I think it can be really useful.
Here is how it works.
Simple Curve Offset
Curve class has a method CreateOffset(distance, axis)
to create an offset.
Overall it's very simple to use:
Axis
Some people get confused about the Axis for their offset.
Imagine a simple line in 3D space.
Theoretically you could create an offset in any direction(360degrees) around its own axis like a circle.
Therefore you need an axis so you can only create offset in 2 directions (positive, negative).
Here a few sketches to explain it.

💡Your axis should be perpendicular to your curve.
Example 1: Create Wall Offset
Here is an example:
Pick Wall
Get Curve
Create Wall Offset
Get Wall parameters
Create new Walls with Offset
Example 2: Create Model Line Offset
Pick ModelLine
Create Offset Curve
Define Plane
Create New Model Lines

⌨️ Happy Coding!
Erik Frits