-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | ADT wrapper and renderer for OpenSCAD models. -- @package OpenSCAD @version 0.2.1.1 -- |
-- main = draw $ Solid ---- -- or main = drawL $ [Solid] -- -- and then set your IDE's compile command to use runhaskell or -- equivalent to run your code and send the output to a .scad file. Open -- that file in OpenSCAD, and set it to automatically reload if the file -- changes. Recompiling your program will cause the model to be loaded -- and displayed by OpenSCAD. -- -- The type constructors are not exported, with functions being exported -- in their stead. This allows extra checking to be done on those that -- need it. It also provides consistency, as otherwise you'd have to -- remember whether box is a constructor or a convenience -- function, etc. -- -- Because of this, the constructors are not documented, the exported -- functions are. The documentation is generally just the corresponding -- OpenSCAD function name, along with the names of the arguments from the -- OpenSCAD documentation. If no OpenSCAD function name is given, then -- it's the same as the OpenSCAD function. You should check the -- OpenSCAD documentation for usage information. -- --
-- draw $ polyhedron [[(p 0, p 1, p 2), (p 0, p 2, p 3), ... ]] -- where points = [.....] -- p i = points !! i ---- -- Also, the OpenSCAD polyedron code recently changed. The old version -- requires that the faces all be triangles, the new version allows for -- them to be arbitrary polygons. OpenSCAD supports both: if all -- your faces are triangles, it will use the old version. If some have -- more points, the new version will be used. If any have fewer than -- three points you get an error. At this time, no tests are done on the -- faces. That will probably change in the future. -- -- Offset is missing even though it's documented, as it isn't supported -- by a released version of OpenSCAD, so presumably subject to change. It -- is implemented, but untested as yet. You can add it to the module's -- export lists if you want to play with it. module Graphics.OpenSCAD -- | A Model is either a Model2d, a Model3d, a -- transformation of a Model, a combination of Models, or a -- Model with it's rendering tweaked by a Facet. -- Models can be rendered. data Model v class Vector a -- | A two-dimensional model. Note that the types do not mix implicitly. -- You must turn a Model2d into a Model3d using one of -- linearExtrude, rotateExtrude, or solid. type Model2d = Model Vector2d -- | A three-dimensional model. You can create a Model2d from a -- Model3d using projection. type Model3d = Model Vector3d -- | Vector2d is used where OpenSCAD expects an OpenSCAD -- vector of length 2. type Vector2d = (Double, Double) -- | Vector3d is used where OpenSCAD expects an OpenSCAD -- vector of length 3. type Vector3d = (Double, Double, Double) -- | A Facet is used to set one of the special variables that -- control the mesh used during generation of circular objects. They -- appear as arguments to various constructors, as well as in the -- var function to set them for the argument objects. data Facet -- | A 4x4 transformation matrix specifying a complete 3-space transform of -- a Model3d. type TransMatrix = ((Double, Double, Double, Double), (Double, Double, Double, Double), (Double, Double, Double, Double), (Double, Double, Double, Double)) -- | Create a rectangular Model2d with rectangle x-size -- y-size. rectangle :: Double -> Double -> Model2d -- | square is a rectangle with both sides the same size. square :: Double -> Model2d -- | Create a circular Model with circle radius -- Facet. circle :: Double -> Facet -> Model2d -- | Turn a list of list of Vector2ds and an int into polygon -- points path convexity. The argument to polygon is the list -- of paths that is the second argument to the OpenSCAD polygon function, -- except the points are Vector2ds, not references to -- Vector2ds in that functions points argument. If you were just -- going to pass in the points, it now needs to be in an extra level of -- List. polygon :: Int -> [[Vector2d]] -> Model2d -- | Project a Model3d into a Model with projection -- cut Model3d. projection :: Bool -> Model3d -> Model2d -- | importFile is import filename. importFile :: Vector v => FilePath -> Model v -- | Create a sphere with sphere radius Facet. sphere :: Double -> Facet -> Model3d -- | Create a box with cube x-size y-size z-size box :: Double -> Double -> Double -> Model3d -- | A convenience function for creating a cube as a box with all -- sides the same length. cube :: Double -> Model3d -- | Create a cylinder with cylinder radius height -- Facet. cylinder :: Double -> Double -> Facet -> Model3d -- | Create an oblique cylinder with cylinder radius1 height radius2 -- Facet. obCylinder :: Double -> Double -> Double -> Facet -> Model Vector3d -- | Turn a list of list of Vector3ds and an int into polyhedron -- points Sides convexity. The argument to polyhedron -- is the list of paths that is the second argument to the OpenSCAD -- polygon function, except the points are Vector3ds, not the -- references to Vector3ds used in that functions points -- argument. The function will build the appropriate function call, using -- faces if you pass in a side that uses more than 3 points, or -- triangles if not. Note that faces doesn't work in -- older versions of OpenSCAD, an triangles is depreciate. Until -- a mechanism to set the version of OpenSCAD is provided, generating the -- faces version will cause an error. polyhedron :: Int -> [[Vector3d]] -> Model3d -- | Transform a Model3d with a TransMatrix multMatrix :: TransMatrix -> Model3d -> Model3d -- | Extrude a Model2d along a line with linear_extrude. linearExtrude :: Double -> Double -> Vector2d -> Int -> Int -> Facet -> Model2d -> Model3d -- | Rotate a Model2d around the origin with rotate_extrude -- convexity Facet Model rotateExtrude :: Int -> Facet -> Model2d -> Model3d -- | Load a height map from a file with surface FilePath Invert -- Convexity. surface :: FilePath -> Bool -> Int -> Model3d -- | Turn a Model2d into a Model3d exactly as is. solid :: Model2d -> Model3d -- | Create the union of a list of Models. union :: Vector v => [Model v] -> Model v -- | Create the intersection of a list of Models. intersection :: Vector v => [Model v] -> Model v -- | The difference between two Models. difference :: Vector v => Model v -> Model v -> Model v -- | The Minkowski sum of a list of Models. minkowski :: Vector v => [Model v] -> Model v -- | The convex hull of a list of Models. hull :: Vector v => [Model v] -> Model v -- | Scale a Model, the vector specifying the scale factor for each -- axis. scale :: Vector v => v -> Model v -> Model v -- | Resize a Model to occupy the dimensions given by the vector. -- Note that this does nothing prior to the 2014 versions of OpenSCAD. resize :: Vector v => v -> Model v -> Model v -- | Rotate a Model by different amounts around each of the three -- axis. rotate :: Vector v => v -> Model v -> Model v -- | Translate a Model along a Vector. translate :: Vector v => v -> Model v -> Model v -- | Mirror a Model across a plane intersecting the origin. mirror :: Vector v => v -> Model v -> Model v -- | Render a Model in a specific color. This doesn't use the -- OpenSCAD color model, but instead uses the Colour model. The -- OpenSCAD module rexports Names so you can conveniently -- say color red Model. color :: Vector v => Colour Double -> Model v -> Model v -- | Render a Model in a transparent color. This uses the -- AphaColour color model. transparent :: Vector v => AlphaColour Double -> Model v -> Model v -- | A translate that just goes up, since those seem to be common. up :: Double -> Model3d -> Model3d -- | render does all the real work. It will walk the AST for a -- Model, returning an OpenSCAD program in a String. render :: Vector v => Model v -> String -- | A convenience function to render a list of Models by taking -- their union. renderL :: Vector v => [Model v] -> String -- | var uses assign to set a Facet variable for -- it's Models. var :: Facet -> [Model v] -> Model v -- | fn is used to set the $fn variable in a Facet -- or var. fn :: Int -> Facet -- | fs is used to set the $fs variable in a Facet -- or var. fs :: Double -> Facet -- | fa is used to set the $fa variable in a Facet -- or var. fa :: Double -> Facet -- | def is used where a Facet is needed but we don't want to -- change any of the values. def :: Facet -- | Use diam to turn a diameter into a radius for circles, spheres, -- etc. diam :: Double -> Double -- | A convenience function to write the rendered Model to standard -- output. draw :: Vector v => Model v -> IO () -- | A convenience function to write a union of Models to -- standard output. drawL :: Vector v => [Model v] -> IO () -- | You can use '(#)' to write transformations in a more readable postfix -- form, cube 3 translate (-3, -3, -3) (#) :: b -> (b -> c) -> c instance Show Facet instance Show Join instance Show Sides instance Show v => Show (Model v) instance Show Solid instance Show Shape instance Vector v => Monoid (Model v) instance Vector v => Semigroup (Model v) instance Vector Vector3d instance Vector Vector2d module Graphics.OpenSCAD.Unicode -- | (∪) = union -- -- U+222A, UNION (∪) :: Vector v => Model v -> Model v -> Model v -- | (∩) = intersection -- -- U+2229, INTERSECTION (∩) :: Vector v => Model v -> Model v -> Model v -- | (∖) = difference -- -- U+2216, SET MINUS (∖) :: Vector v => Model v -> Model v -> Model v -- | (∆) = Symmetric difference -- -- U+2206, INCREMENT (∆) :: Vector v => Model v -> Model v -> Model v