gcodehs-0.1.2.0: GCode processor

Safe HaskellNone
LanguageHaskell2010

Data.GCode.Utils

Description

GCode pretty-printing functions

Utilities for manipulating and filtering GCode

Synopsis

Documentation

isG :: Code -> Bool Source #

True if Code is a G-code

isM :: Code -> Bool Source #

True if Code is a M-code

isGN :: Int -> Code -> Bool Source #

True if Code is a G{N} code

hasAxis :: AxisDesignator -> Code -> Bool Source #

True if Code has a coordinate in axis a

hasX :: Code -> Bool Source #

True if Code contains X axis

hasY :: Code -> Bool Source #

True if Code contains Y axis

hasZ :: Code -> Bool Source #

True if Code contains Z axis

hasE :: Code -> Bool Source #

True if Code contains E axis

hasParam :: ParamDesignator -> Code -> Bool Source #

True if Code contains parameter with ParamDesignator

getParam :: ParamDesignator -> Code -> Maybe Double Source #

Get parameter if defined

hasFeedrate :: Code -> Bool Source #

True if Code contains feedrate parameter (e.g. G0 F3000)

gcodes :: [Code] -> [Code] Source #

Filter G-codes

mcodes :: [Code] -> [Code] Source #

Filter M-codes

rapids :: [Code] -> [Code] Source #

Filter rapid moves

moves :: [Code] -> [Code] Source #

Filter moves

replaceClass :: Class -> Code -> Code Source #

Replace Class of Code (e.g. for chaning G0 to M0)

replaceCode :: Int -> Code -> Code Source #

Replace code value of Code (e.g. for chaning G0 to G1)

replaceAxis :: AxisDesignator -> Double -> Code -> Code Source #

Replace axis with AxisDesignator in Code returning new Code

modifyAxis :: AxisDesignator -> (Double -> Double) -> Code -> Code Source #

Apply function to axis specified by AxisDesignator

modifyAxes :: [AxisDesignator] -> (Double -> Double) -> Code -> Code Source #

Apply function to axes specified by '[AxisDesignator]'

hasXY :: Code -> Bool Source #

Test if Code has X and Y axes

modifyXY :: (Double -> Double -> (Double, Double)) -> Code -> Code Source #

Apply function to X and Y axes

addReplaceAxis :: AxisDesignator -> Double -> Code -> Code Source #

Replace or add axis with AxisDesignator in Code returning new Code

replaceX :: Double -> Code -> Code Source #

Replace X axis coordnate

replaceY :: Double -> Code -> Code Source #

Replace Y axis coordinate

replaceZ :: Double -> Code -> Code Source #

Replace Z axis coordinate

replaceE :: Double -> Code -> Code Source #

Replace E axis coordinate

addReplaceX :: Double -> Code -> Code Source #

Replace or add X axis coordinate

addReplaceY :: Double -> Code -> Code Source #

Replace or add Y axis coordinate

addReplaceZ :: Double -> Code -> Code Source #

Replace or add Z axis coordinate

addReplaceE :: Double -> Code -> Code Source #

Replace or add E axis coordinate

replaceParam :: ParamDesignator -> Double -> Code -> Code Source #

Replace parameter with ParamDesignator in Code returning new Code

modifyParam :: ParamDesignator -> (Double -> Double) -> Code -> Code Source #

Apply function to parameter with ParamDesignator

modifyParams :: [ParamDesignator] -> (Double -> Double) -> Code -> Code Source #

Apply function to parameters specified by '[ParamDesignator]'

modifyParamsWithKey :: [ParamDesignator] -> (ParamDesignator -> Double -> Double) -> Code -> Code Source #

Apply function to parameters specified by '[ParamDesignator]'

Function gets ParameterDesignator passed as its first argument

addReplaceParam :: ParamDesignator -> Double -> Code -> Code Source #

Replace or add parameter with ParamDesignator in Code returning new Code

replaceFeedrate :: Double -> Code -> Code Source #

Replace feedrate (F parameter) in Code returning new Code

modifyFeedrate :: (Double -> Double) -> Code -> Code Source #

Apply function to feedrate

travelDistance :: Code -> Double Source #

Sum of all axis distances of this Code

roundprec :: (Integral a, RealFrac b, Fractional c) => a -> b -> c Source #

Round x with specified precision