Frequently Asked Questions > Practical Questions > Working with Scene Nodes >

# How do I create a line between two points?

MAXScript FAQ > Working With Scene Nodes > How do I create a line between two points?

In order to create a simple line between two points, you have to perform the following steps:

- Create a new SplineShape object, position at the first point.

- Add a new Spline to the new object.

- Add a new corner Knot at the first position.

- Add a new corner Knot at the second position. Tell both knots to define a linear segment.

- Update the SplineShape to reflect the changes.

- Return the SplineShape as the result.

Here is the complete function implementing these steps:

SCRIPT
    fn drawLineBetweenTwoPoints pointA pointB =
    (
      ss = SplineShape pos:pointA
      addNewSpline ss
      addKnot ss 1 #corner #line PointA
      addKnot ss 1 #corner #line PointB
      updateShape ss
      ss
    )
    newSpline = drawLineBetweenTwoPoints [10,20,30] [100,200,10]

#### See Also

- SplineShape : Shape

- Spline Shape Common Properties, Operators, and Methods

- How To ... Draw a Freehand Spline

- Frequently Asked Questions