
$fn : fixed number of fragments in 360 degrees. $fs : minimum circumferential length of each fragment. center false (default), z ranges from 0 to h true, z ranges from -h/2 to +h/2 $fa : minimum angle (in degrees) of each fragment. cylinder(h = height, r1 = BottomRadius, r2 = TopRadius, center = true/false) Parameters h : height of the cylinder or cone r : radius of cylinder. NOTE: If r, d, d1 or d2 are used they must be named. If a parameter is named, all following parameters must also be named. Parameter names are optional if given in the order shown here. When center is true, it is also centered vertically along the z axis. does not have as many small triangles on the poles of the sphereĬreates a cylinder or cone centered about the z axis.

Sphere(2, $fn=100) // also creates a 2mm high resolution sphere but this one Sphere(d = 20) // this creates a high resolution sphere with a 2mm radius $fa Fragment angle in degrees $fs Fragment size in mm $fn Resolution default values: sphere() yields: sphere($fn = 0, $fa = 12, $fs = 2, r = 1) For more information on these special variables look at: OpenSCAD_User_Manual/Other_Language_Features d Diameter. The resolution of the sphere is based on the size of the sphere and the $fa, $fs and $fn variables. center false (default), 1st (positive) octant, one corner at (0,0,0) true, cube is centered at (0,0,0) default values: cube() yields: cube(size =, center = false) examples:Ĭreates a sphere at the origin of the coordinate system.

cube(size =, center = true/false) Ĭube(size = x, center = true/false) parameters: size single value, cube with all sides this length 3 value array, cube with dimensions x, y and z. Argument names are optional if given in the order shown here. When center is true, the cube is centered on the origin. Instead open polygons are treated as shapes defined by their stroke-width.Ĭlosed shapes are always using the geometric specification regardless of fill or stroke-with defined in the SVG file.Creates a cube in the first octant. OpenSCAD handles only closed polygons, so importing lines or open polygons is not possible. The article Understanding SVG Coordinate Systems and Transformations gives a nice introduction of how all combinations of the viexBox related attributes affect the display.ĭPI handling Edit Open and closed shapes Edit The OpenSCAD import supports the tranformations including the preserveAspectRatio attribute. The ViewBox attribute of the SVG file defines the initial coordinate system for displaying its content. In general the OpenSCAD SVG import extracts the core geometric information of the objects and transforms that into closed 2D polygons. Especially all animation features and most visual properties in the SVG file are ignored. This means there are a number of features that do not translate well into the use as CAD format. Scalable Vector Graphics (SVG), as the name already implies, is designed to be a scalable graphics format targeting rendering on Web pages with support for interactivity and animation. The minimum segment length to use when converting circles and arcs to polygons. The minimum angle step to use when converting circles and arcs to polygons. The number of polygon segments to use when converting circles, arcs, and curves to polygons. If an absolute unit is given for width/height (px/pt/pc/in/mm/cm) the DPI value is ignored.

for files created with older versions of Adobe Illustrator). If no width/height is given at all the viewbox is used instead (e.g. Use this DPI value for calculating the size of the viewbox if no unit is given for width/height. If set to true, the imported geometry is centered by bounding box of the geometry. Import(file = "file.svg", center = false, dpi = 96) OpenSCAD can import the geometric structure of SVG files.
