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

Generating a bill of materials

  • 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)
  • This means that 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

Note:

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

Clone this wiki locally