Skip to content

Instantly share code, notes, and snippets.

@anthonybudd
Created April 17, 2019 15:38
Show Gist options
  • Save anthonybudd/38f5e41a64d7edaeada72a5782a6610e to your computer and use it in GitHub Desktop.
Save anthonybudd/38f5e41a64d7edaeada72a5782a6610e to your computer and use it in GitHub Desktop.
// Programmer's dice
// https://www.thingiverse.com/thing:1958065
var diceComponent = await Component.create({
id: uuidv4(),
created_by: 'aaaaaaaa-9a34-4466-ba4c-46438def7d7f', // Dont change
group_id: '00000000-9a34-4466-ba4c-46438def7d7f', // Dont change
image: 'https://3ps-media.ideea.io/media/bolt.jpg',
is_public: 1,
name: 'dice',
resolution: '100',
material: 'PLA',
color: 'blue',
process: 'FDM',
infill: '60',
})
var dice = await Obj.create({
id: uuidv4(),
group_id: '00000000-9a34-4466-ba4c-46438def7d7f',
is_public: 1,
name: 'Programmers dice',
image: 'http://3ps-media.ideea.io/nut-bolt.jpg',
}).then(object => {
ComponentsObjects.create({
id: uuidv4(),
component_id: diceComponent.id,
object_id: object.id,
}).catch(err => console.error(err));;
})
.catch(err => console.error(err))
.finally(() => console.log('Object Created'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment