Maker.js, a Microsoft Garage project, is a JavaScript library for creating and sharing modular line drawings for CNC and laser cutters.

View project on GitHub Star

Api - chain Namespace

Index

Functions

chainFillet

  • chainFillet(traditional: boolean, chainToFillet: IChain, filletSpec: any): IModel

cycle

  • Shift the links of an endless chain.

    Parameters

    • chainContext: IChain

      Chain to cycle through. Must be endless.

    • Default value amount: number = 1

      Optional number of links to shift. May be negative to cycle backwards.

    Returns IChain

    The chainContext for cascading.

dogbone

  • dogbone(chainToFillet: IChain, filletRadius: number): IModel
  • dogbone(chainToFillet: IChain, filletRadii: object): IModel
  • Adds a dogbone fillet between each link in a chain. Each path will be cropped to fit a fillet, and all fillets will be returned as paths in a returned model object.

    Parameters

    • chainToFillet: IChain

      The chain to add fillets to.

    • filletRadius: number

      Radius of the fillet.

    Returns IModel

    Model object containing paths which fillet the joints in the chain.

  • Adds a dogbone fillet between each link in a chain. Each path will be cropped to fit a fillet, and all fillets will be returned as paths in a returned model object.

    Parameters

    • chainToFillet: IChain

      The chain to add fillets to.

    • filletRadii: object

      Object specifying directional radii.

      • Optional left?: number

        Radius of left turning fillets.

      • Optional right?: number

        Radius of right turning fillets.

    Returns IModel

    Model object containing paths which fillet the joints in the chain.

fillet

  • fillet(chainToFillet: IChain, filletRadius: number): IModel
  • fillet(chainToFillet: IChain, filletRadii: object): IModel
  • Adds a fillet between each link in a chain. Each path will be cropped to fit a fillet, and all fillets will be returned as paths in a returned model object.

    Parameters

    • chainToFillet: IChain

      The chain to add fillets to.

    • filletRadius: number

      Radius of the fillet.

    Returns IModel

    Model object containing paths which fillet the joints in the chain.

  • Adds a fillet between each link in a chain. Each path will be cropped to fit a fillet, and all fillets will be returned as paths in a returned model object.

    Parameters

    • chainToFillet: IChain

      The chain to add fillets to.

    • filletRadii: object

      Object specifying directional radii.

      • Optional left?: number

        Radius of left turning fillets.

      • Optional right?: number

        Radius of right turning fillets.

    Returns IModel

    Model object containing paths which fillet the joints in the chain.

reverse

startAt

  • Set the beginning of an endless chain to a known routeKey of a path.

    Parameters

    • chainContext: IChain

      Chain to cycle through. Must be endless.

    • routeKey: string

      RouteKey of the desired path to start the chain with.

    Returns IChain

    The chainContext for cascading.

toKeyPoints

  • toKeyPoints(chainContext: IChain, maxArcFacet?: number): IPoint[]
  • Get key points (a minimal a number of points) along a chain of paths.

    Parameters

    • chainContext: IChain

      Chain of paths to get points from.

    • Optional maxArcFacet: number

      The maximum length between points on an arc or circle.

    Returns IPoint[]

    Array of points which are on the chain.

toNewModel

  • toNewModel(chainContext: IChain, detachFromOldModel?: boolean): IModel
  • Convert a chain to a new model, independent of any model from where the chain was found.

    Parameters

    • chainContext: IChain

      Chain to convert to a model.

    • Default value detachFromOldModel: boolean = false

      Flag to remove the chain's paths from their current parent model. If false, each path will be cloned. If true, the original path will be re-parented into the resulting new model. Default is false.

    Returns IModel

    A new model containing paths from the chain.

toPoints

  • toPoints(chainContext: IChain, distanceOrDistances: number | number[], maxPoints?: number): IPoint[]
  • Get points along a chain of paths.

    Parameters

    • chainContext: IChain

      Chain of paths to get points from.

    • distanceOrDistances: number | number[]
    • Optional maxPoints: number

      Maximum number of points to retrieve.

    Returns IPoint[]

    Array of points which are on the chain spread at a uniform interval.

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc