Huge news!Announcing our $20M Series A led by Andreessen Horowitz.Learn more
Socket
Socket
Log inDemoInstall

materialisecloud

Package Overview
Dependencies
2
Maintainers
1
Versions
1
Issues
File Explorer

Advanced tools

Install Socket

Protect your apps from supply chain attacks

Install

materialisecloud

Materialise Cloud API SDK for node.js

    1.0.0latest
    npm

Version published
Maintainers
1
0

Weekly downloads

Readme

Source

Materialise Cloud SDK

The SDK to run operations on Materialise Cloud API.

Description

All operations in materialisecloud module have the same contracts (input and result) as per documentation.

For example, the operation Reduce Triangles has the following parameters:

accuracyMm (number) maxAngle (number) numberOfIterations (number) inputId (string)

which is manifested in the function's signature:

function reduceTrianglesOperationApi(inputId, accuracyMm, maxAngle, numberOfIterations, callback)

The operation's results are in JSON format and have the following structure:

{ "operationId": "98f499ac-099c-4637-a2d5-f54fed455773", "resultId": "ca74d93d-43b7-452b-bf44-1554081d6bac" }

which is exactly the structure of the object returned in the result parameter of the operation's callback function. The callback is a standard node.js style callback function with first arugment 'error' if an error has occured, the second: the resulting object.

cloud.reduceTrianglesOperationApi('<<INPUTID>>', 1, 45, 5, function(error, result) { console.log("OperationId: " + result.operationId); console.log("ResultId: " + result.resultId); }

Usage

Import the module. It has an entry point function create which requires your credentials and (optionally) the base url (without http and slashes) and port (if not supplied, defaults to production values). After calling create simply call the operation API functions:

var cloudFactory = require("materialisecloud"); var cloud = cloudFactory.create("<<YOUR EMAIL HERE>>", "<<PASSWORD>>", "<<CLIENTID>", "<<CLIENTSECRET>>", "api-cloudtoolkit-sandbox.materialise.net", "443"); cloud.uploadFileFromLocalStorageApi('\\path\\to\\file.stl', function(error,result){ if(error){ console.log('Error: ' + error); } else { console.log('Result file id: ' + result.fileId); cloud.importOperationApi(result.fileId, 'mm', function(error,result){ if(error){ console.log('Error: ' + error); } else { console.log('Result id: ' + result.resultId); } }); } });

You can also use a control flow library like async.js to get rid of nested callbacks. See examples for more information.

Install

$ npm install materialisecloud

API

uploadFileFromLocalStorageApi(pathToFile, callback)

cloud.uploadFileFromLocalStorageApi('//path//to//saved//file.stl', function(error, result) { console.log(result.fileId); //id of uploaded file });

see more

uploadFileFromBufferApi(buffer, fileName, callback)

cloud.uploadFileFromLocalStorageApi(bufferWithFileContents, "test.stl", function(error, result) { console.log(result.fileId); //id of uploaded file });

see more

downloadFileToLocalStorageApi(fileId, pathToFile, callback)

in case of success path to downloaded file will be returned in callback's second argument

cloud.downloadFileToLocalStorageApi('<<FILEID>>', "//path//to//saved//file.stl", function(error, result) { console.log(result); //logs "//path//to//saved//file.stl" });

see more

downloadFileToBufferApi(fileId, callback)

in case of success downloaded file buffer will be returned in callback's second argument

cloud.downloadFileToBufferApi('<<FILEID>>', function(error, result) { fs.writeFile("\\path\\to\\file.stl", result, function(err) { console.log('file saved'); }); });

see more

analyzeOperationApi(inputId, callback)

cloud.analyzeOperationApi('<<INPUTID>>', function(error,result){ console.log(result); //outputs model analysis data in JSON format });

see more

convertToStlOperationApi(inputId, measurementUnits, callback)

cloud.convertToStlOperationApi('<<INPUTID>>', 'mm', function(error,result){ console.log(result.resultId); //outputs id of result });

see more

exportOperationApi(inputId, format, callback)

cloud.exportOperationApi('<<INPUTID>>', 'stl', function(error,result){ console.log(result.fileId); //id of resulting stl file });

see more

generateThumbnailOperationApi(inputId, width, height, cameraAngleX, cameraAngleY, cameraAngleZ, callback)

see more

geometricalRepairOperationApi(inputId, callback)

see more

hollowingOperationApi(inputId, wallThicknessMm, callback)

see more

importOperationApi(fileId, measurementUnits, callback)

see more

reduceTrianglesOperationApi(inputId, accuracyMm, maxAngle, numberOfIterations, callback)

see more

repairOperationApi(inputId, callback)

see more

scaleOperationApi(inputId, axis, scaleToSizeMm, callback)

see more

shrinkwrapOperationApi(inputId, accuracy, callback)

see more

wallThicknessAnalysisOperationApi(inputId, accuracyWallThickness, minimalWallThicknessMm, callback)

see more

Keywords

FAQs

Last updated on 23 Aug 2016

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install
SocketSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc