CNC Without gcode

How can i draw a line or a circle or rectangle with given dimensions by 2D cnc plotter ( 2 stepper nima17 ) and with a servo to control the pen up and down without using gcode ( through the arduino code )
I'm using A4988 motor driver
Arduino Uno and Arduino Sheild CNC machine v3 board

GCode is just a convenient way of describing the movement of the tool using real-world measurements - for example move N mm in the X direction.

On any CNC machine the GCode has to be converted into the appropriate numbers of steps for each of the stepper motors. Among other things that requires you to know how many steps are needed to move exactly 1 mm.

If you don't have a GCode interpreter then you can create the moves as a sequence of steps - for example

10 steps X 23 steps Y
10 steps X 17 steps Y
etc
etc

Figuring out the numbers of steps for a rectangle is reasonably straightforward. A circle will require a large number of small movements if the tool is to follow a smooth path. You can calculate the X and Y positions around a circle using simple trigonomoetry (sin and cosine).

...R
Stepper Motor Basics
Simple Stepper Code

For drawing lines you would probably use the Bresenham Line Drawing Algorithm. For drawing arcs of an ellipse (the general case of a circle) you would probably use the Midpoint Ellipse Algorithm.

Bressenham's circle algorithm is used for arcs usually, just as Bressenham's line algorithm for linear interpolation. The low level movement operations never need floats, just ints and simple operations like +/- shifts and comparisons. Digital differential analysis is the generic term for this approach I believe. Bezier curves are another approach amenable to this general approach.