Skip to content
Mark Moissette edited this page Mar 31, 2013 · 6 revisions

[[TOC]]

Generating a bill of materials

The Part class

  • Any part subclassing the built-in Part class will get registered in the system at compile time, and any parameters passed to its options hash will also get recorded

ie:

class CoolHardware extends Part
  constructor:(options)->
    defaults = {thickness:5}
    #here we merge defaults and the options passed in using the 
    #"merge" utility function :it takes two objects/hashes, 
    #and merges them into one
    {@thickness} = options = merge(defaults, options)
    #we pass the full options hash (parameters passed in + defaults)
    #to the parent class 
    super options  
    @cb = new Cube({size:[5,10,@thickness]})
    @union(@cb)

Viewing the bom

  • after you compile a project, you can go to file -> export -> bom , and review the list of parts in your project and then export that list as a json file
  • any custom change to the quantities, variant name, manufactured boolean etc are reset every time you re-compile your design, but if you change the settings and export them , the correct quantities etc will be present in the json file

** Note:** you can find this specific example at the project->examples->object oriented->defining parts