Skip to content

LINE_TO ​

Adds another point to the path and connects with the previous point via a straight line.

Syntax ​

leo-grammar
LINE_TO [ x:measureValue ] [ y:measureValue ] .

Parameters ​

  • x (measureValue, optional) - The x-coordinate of the point. The default is 0cm.
  • y (measureValue, optional) - The y-coordinate of the point. The default is 0cm.

Details ​

When thinking of defining a path as "drawing with an invisible pen", then this command draws a line from the last point of the path to a new point.

The order in which the lines of a path are specified is relevant when the path is later used to draw a shape, as their order determines the filled areas when a path's lines intersect.

This command should only be used after a BEGIN_PATH and before an END_PATH command.

See Also ​

Examples ​

Draw a simple diagonal line with a thickness of 3pt.
Diagonal black line

leo
GRAPHREP
SHADOW off

# Define the path.
BEGIN_PATH
MOVE_TO x:0cm y:0cm
LINE_TO x:1cm y:1cm
END_PATH

# Draw the path.
PEN w:3pt
DRAW_PATH

Draw a blue document symbol with an exaggerated wavy line at the bottom using a dashed line.
Document symbol with straight lines on the left, top and right and an exaggerated wavy line at the bottom

leo
GRAPHREP
# Note: SHADOW is on by default.

# Define the path.
BEGIN_PATH
MOVE_TO x:-1cm y:-1cm
LINE_TO x:-1cm y:0cm
BEZIER_TO 3
    x1:-0.25cm y1:-1cm x2:0.5cm y2:2.5cm x3:1cm y3:0cm
LINE_TO x:1cm y:-1cm
END_PATH

# Draw the path as a shape.
PEN style:dash
FILL color:"lightblue"
DRAW_PATH

Draw two vertical lines that are connected at the bottom with an exaggerated wavy line.
Two parallel vertical lines connected with an exaggerated wavy line at the bottom

leo
GRAPHREP
# Note: SHADOW is on by default.

# Define the path.
BEGIN_PATH
MOVE_TO x:-1cm y:-1cm
LINE_TO x:-1cm y:0cm
BEZIER_TO {-0.25cm, -1cm, 0.5cm, 2.5cm, 1cm, 0cm}
LINE_TO x:1cm y:-1cm
END_PATH

# Draw the path only as an outline.
PEN w:3pt
DRAW_PATH mode:stroke

Draw a purple hour-glass shape and a lying hour-glass shape to the right of it. The order of the points influences which areas are filled as part of the shape.
A purple hour-glass shape and a lying hour-glass shape to the right of it

leo
GRAPHREP
SHADOW off

# One path defining both shapes.
BEGIN_PATH
# Left hour-glass shape.
# 1st: top-left, 2nd: top-right, 3rd: bottom-left, 4th: bottom-right.
MOVE_TO x:-0.5cm y:-0.5cm
LINE_TO x:0.5cm y:-0.5cm
LINE_TO x:-0.5cm y:0.5cm
LINE_TO x:0.5cm y:0.5cm
# Right hour-glass shape.
# A different order of the points causes different areas to be filled in.
# 1st: top-left, 2nd: bottom-left, 3rd: top-right, 4th: bottom-right.
MOVE_TO x:0.6cm y:-0.5cm
LINE_TO x:0.6cm y:0.5cm
LINE_TO x:1.6cm y:-0.5cm
LINE_TO x:1.6cm y:0.5cm
END_PATH

FILL color:"purple"
DRAW_PATH

Versions and Changes ​

Available since ADOxx 1.3