Skip to content

Commit

Permalink
Merge pull request #217 from MaslowCNC/Add-a-tag-for-cutlist
Browse files Browse the repository at this point in the history
Add a tag for cutlist atom
  • Loading branch information
BarbourSmith committed Aug 20, 2019
2 parents 6097f50 + f1bf04e commit 4276ae3
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/js/globalvariables.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { create, all } from 'mathjs'
import Assembly from './molecules/assembly.js'
import CutAway from './molecules/cutaway.js'
import CutList from './molecules/cutlist.js'
import Circle from './molecules/circle.js'
import Color from './molecules/color.js'
import Rectangle from './molecules/rectangle.js'
Expand Down Expand Up @@ -91,7 +92,8 @@ class GlobalVariables{
stretch: {creator: Stretch, atomType: 'Stretch'},
gcode: {creator: Gcode, atomType: 'Gcode'},
code: {creator: Code, atomType: 'Code'},
cutAway: {creator: CutAway, atomType: 'CutAway'}
cutAway: {creator: CutAway, atomType: 'CutAway'},
CutList: {creator: CutList, atomType: 'CutList'}
}
/**
* A reference to the molecule curently being displayed on the screen.
Expand Down
43 changes: 43 additions & 0 deletions src/js/molecules/cutlist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import Atom from '../prototypes/atom'
import GlobalVariables from '../globalvariables.js'

/**
* This class creates the Add To Cutlist atom.
*/
export default class CutList extends Atom{

/**
* The constructor function.
* @param {object} values An array of values passed in which will be assigned to the class as this.x
*/
constructor(values){
super(values)

this.addIO('input', 'geometry', this, 'geometry', '')
this.addIO('output', 'geometry', this, 'geometry', '')

/**
* This atom's name
* @type {string}
*/
this.name = 'Add To Cutlist'
/**
* This atom's type
* @type {string}
*/
this.atomType = 'cutList'

this.setValues(values)
}

/**
* Add a tag to the input geometry. The substance is not changed.
*/
updateValue(){
try{
const values = [this.findIOValue('geometry'), "cutList"+GlobalVariables.generateUniqueID()]
this.basicThreadValueProcessing(values, "tag")
}catch(err){this.setAlert(err)}
super.updateValue()
}
}
2 changes: 1 addition & 1 deletion src/js/molecules/tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class Tag extends Atom{
super(values)

this.addIO('input', 'geometry', this, 'geometry', '')
this.addIO('input', 'tag', this, 'string', 'cutList')
this.addIO('input', 'tag', this, 'string', 'Tag String')
this.addIO('output', 'geometry', this, 'geometry', '')

/**
Expand Down

0 comments on commit 4276ae3

Please sign in to comment.