All 2D primitives can be transformed with 3D transformations. Usually used as part of a 3D extrusion. Although infinitely thin, they are rendered with a 1 thickness.

### squareEdit

Creates a square at the origin of the coordinate system. When center is true the square will be centered on the origin, otherwise it is created in the first quadrant. The argument names are optional if the arguments are given in the same order as specified in the parameters

**Parameters**

- size
- Decimal or 2 value array. If a single number is given, the result will be a square with sides of that length. If a 2 value array is given, then the values will correspond to the lengths of the X and Y sides. Default value is 1.

- center
- Boolean. This determines the positioning of the object. If true, object is centered at (0,0). Otherwise, the square is placed in the positive quadrant with one corner at (0,0). Defaults to false.

**Example**

square ([2,2],center = true);

### circleEdit

Creates a circle at the origin of the coordinate system. The argument name is optional.

**Parameters**

- r
- Decimal. This is the radius of the circle. The resolution of the circle will be based on the size of the circle. If you need a small, high resolution circle you can get around this by making a large circle, then scaling it down by an appropriate factor, or you could set $fn or other special variables. Default value is 1.
- d
- Decimal. This is the diameter of the circle. The resolution of the circle will be based on the size of the circle. If you need a small, high resolution circle you can get around this by making a large circle, then scaling it down by an appropriate factor, or you could set $fn or other special variables. Default value is 1.

(NOTE: d is only available in versions later than 2014.03. Debian is currently know to be behind this)

**Examples**

circle(); // uses default radius, r=1

circle(r = 10); circle(d = 20);

scale([1/100, 1/100, 1/100]) circle(200); // this will create a high resolution circle with a 2mm radius circle(2, $fn=50); // Another way to create a high-resolution circle with a radius of 2.

### polygonEdit

Create a polygon with the specified points and paths.

**Parameters**

- points
- vector of 2 element vectors, ie. the list of points of the polygon

- paths
- Either a single vector, enumerating the point list, ie. the order to traverse the points, or, a vector of vectors, ie a list of point lists for each seperate curve of the polygon. The latter is required if the polygon has holes. The parameter is optional and if omitted the points are assumed in order. (The 'pN' components of the
*paths*vector are 0-indexed references to the elements of the*points*vector.)

- convexity
- Integer. Number of "inward" curves, ie. expected path crossings of an arbitraty line through the polygon.

**Usage**

polygon(points = [ [x, y], ... ], paths = [ [p1, p2, p3..], ...], convexity = N);

**Example**

polygon(points=[[0,0],[100,0],[0,100],[10,10],[80,10],[10,80]], paths=[[0,1,2],[3,4,5]]);

In this example, we have 6 points (three for the "outer" triangle, and three for the "inner" one). We connect each one with two 2 path. In plain English, each element of a path must correspond to the position of a point defined in the points vector, e.g. "1" refers to [100,0].

Notice: In order to get a 3D object, you either extrude a 2D polygon (linear or (rotation ) or directly use the polyhedron primitive solid. When using extrusion to form solids, its important to realize that the winding direction of the polygon is significant. If a polygon is wound in the wrong direction with respect to the axis of rotation, the final solid (after extrusion) may end up invisible. This problem can be checked for by flipping the polygon using scale([-1,1]) (assuming that extrusion is being done about the Z axis as it is by default).

Notice: Althought the 2D drawing commands operate in axes labeled as X and Y, the extrusion commands implicitly translate these objects in X-Z coordinates and rotate about the Z axis.

Example:

polygon([[0,0],[10,90],[11,-10]], convexity = N);

### import_dxfEdit

DEPRECATED: The import_dxf() module will be removed in future releases. Use import() instead.

Read a DXF file and create a 2D shape.

**Example**

linear_extrude(height = 5, center = true, convexity = 10) import_dxf(file = "example009.dxf", layer = "plate");