Browse files

working on documentation

  • Loading branch information...
2 parents 1814efa + 1c5eabc commit ee8ad9deb4f8cb446b05b9400cd459ef4d727a93 Mikola Lysenko committed Aug 5, 2012
Showing with 15 additions and 11 deletions.
  1. +3 −0 LICENSE
  2. +9 −10
  3. +3 −1 lib/models.js
@@ -1,3 +1,6 @@
+This license applies to all files except for those in ./lib/soap-mod
Copyright (c) 2012 Mikola Lysenko
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@@ -13,7 +13,7 @@
-# Introduction #
+# About #
This is a node.js library for interfacing with the [ShapeWays]( 3D printing service. It allows you to:
@@ -41,12 +41,8 @@ Here is a trivial example showing how to upload an STL file:
# Install #
-Via npm:
npm install shapeways
# API #
@@ -100,7 +96,7 @@ The _upload_ method sends a model to ShapeWays. _options_ is a dictionary conta
When _upload_ completes, it calls __callback__ with either an error code, or else a string encoding the _model_id_ in the ShapeWays database. This _model_id_ can be used with ShapeWays [Add To Cart API]( to sell the model.
-#### Model Formats ####
+#### Models ####
In addition to the above parameters, you also need to specify a model. There are three different ways you can do this:
@@ -128,7 +124,6 @@ In addition to the above parameters, you also need to specify a model. There ar
* __JSON__
While the above two methods may be sufficient for some purposes, the interchange formats accepted by ShapeWays API are quite cumbersome for applications that process or manipulate 3D geometry in Javascript. To facilitate working with models in Javascript, I added an extra option to directly upload an indexed set of faces using JSON. To do this, you specify an object in the _model_json_ field. For example, here is the option field required to upload a multicolored cube:
title: 'Test JSON Cube'
@@ -170,14 +165,18 @@ In addition to the above parameters, you also need to specify a model. There ar
* _face_colors_ : (Optional) An array of colors for each face (must be same length as _faces_)
* _tex_coords_ : (Optional) An array of texture coordinates (must be same length as _verts_)
+ __Note:__ It is redundant to specify both _face_colors_ and _tex_coords_. If both are present and a texture is specified, _tex_coords_ overrides _face_colors_.
+#### Textures ####
+You can also specify [textures]( to color your models. Note that only VRML and X3D formats currently support this feature.
+# Legal Stuff
-# Legal stuff
-ShapeWays is a trademark of ShapeWays Inc. This is of course free software and is provided without any warranty.
+This unofficial wrapper was written by Mikola Lysenko, and is not in any way supported by or affiliated with ShapeWays. This package includes a modified version of [node-soap](, with patches to work around some API compatibility problems. Other than the files in lib/soap-mod, this project is covered by the MIT license.
4 lib/models.js
@@ -193,7 +193,7 @@ exports.read_model = function(args, cb) {
var mtype = model_types[type]
, has_color = mtype.color && !!args.has_color;
- fs.readFile(filename, 'base64', function(err, data) {
+ fs.readFile(filename, function(err, data) {
if(err) {
cb(err, null);
@@ -249,6 +249,8 @@ exports.read_model = function(args, cb) {
} else if('texture_filename' in args) {
+ fs.readFile(args.tex
} else {
//Don't use texture
create_model(null, null, null);

0 comments on commit ee8ad9d

Please sign in to comment.