Home » Developers » Shapeways API » Materials List in submitModel
Search Search  
Show: Today's Messages    Show Polls    Message Navigator
Materials List in submitModel [message #38971] Mon, 21 November 2011 16:08 UTC Go to next message
avatar GeoBling  is currently offline GeoBling
Messages: 15
Registered: October 2011
Go to my shop
Junior Member
While it doesn't appear on the API documentation site, the Web Service Description indicates that for the data type SWModel used for the submitModel function, there is a parameter "materials":

<xsd:element name="materials" type="xsd:array" nillable="1"/>


I tried using the materials parameter for a PHP batch upload script I am using to upload tens of models in one operation. The script works fine when not using the materials field. I have a small set of test models that pass the test when uploaded through the API. As soon as I specify the materials parameter, however, I start getting this error email:

Quote:

We're sorry, but there was a problem with processing your product called 'Switzerland Heightmap Pendant 35mm'. It didn't pass all the checks that we run to make sure a product is printable. Here's the error message:

Based upon the size, volume and wallthickness of your product there is no printer available which is able to print your product. Please adjust the volume and/or size of your product.


It is unclear to me why this error appears. The model uploads and validates just fine when not specifying materials. Maybe the materials parameter is not working correctly?

I realize that this is an undocumented feature and therefore it would be fair to say that I cannot possibly expect it to work. But since the parameter is already there in code and because others have asked for it here in the forums, I figured I'd flag this up. It would be extremely helpful to me (and probably others) if you could make the materials parameter work. If I could specify the available materials for the model through the API, it would save me hours of repetitive clicking in the web interface.
Re: Materials List in submitModel [message #39038 is a reply to message #38971 ] Tue, 22 November 2011 12:43 UTC Go to previous messageGo to next message
avatar mctrivia  is currently offline mctrivia
Messages: 808
Registered: September 2010
Go to my shop
Senior Member
you need to use the material name. it must be an exact match also. It is a silly setup but oh well.


Follow me on twitter http://twitter.com/mctrivia or my blog at http://4ddice.blogspot.com/
Re: Materials List in submitModel [message #39093 is a reply to message #39038 ] Wed, 23 November 2011 05:51 UTC Go to previous messageGo to next message
avatar GeoBling  is currently offline GeoBling
Messages: 15
Registered: October 2011
Go to my shop
Junior Member
With that hint I get it to work for a single material by specifying it as a string like so:
'materials' => 'Silver'


But what if I need to specify multiple materials? I tried all of these without any success:
'materials' => array('Silver','Sandstone')

'materials' => 'Silver,Sandstone'

'materials' => 'Silver;Sandstone'

'materials' => 'Silver&Sandstone'


Am I missing something?

And while I'm at it: I expected the "tags" to show up as "keywords" under the model but they don't. Any trick for these?

[Updated on: Wed, 23 November 2011 06:10 UTC]

Re: Materials List in submitModel [message #39364 is a reply to message #39093 ] Mon, 28 November 2011 12:18 UTC Go to previous messageGo to next message
avatar mctrivia  is currently offline mctrivia
Messages: 808
Registered: September 2010
Go to my shop
Senior Member
beleive sandstone is called
"Full Color Sandstone"

I know WSF is "White, Strong & Flexible" caps must be exact.

try
'materials' => array('Silver','Full Color Sandstone')


That is the correct formating at least

[Updated on: Mon, 28 November 2011 12:19 UTC]


Follow me on twitter http://twitter.com/mctrivia or my blog at http://4ddice.blogspot.com/
Re: Materials List in submitModel [message #39953 is a reply to message #39364 ] Thu, 08 December 2011 03:30 UTC Go to previous message
avatar GeoBling  is currently offline GeoBling
Messages: 15
Registered: October 2011
Go to my shop
Junior Member
Thanks mctrivia! So while I was trying this I must have been using a bad set of material names, stupid me!

In the meantime we also found a way to work around this: I generated a whole bunch of Javascript to automatically fire the requests to the Shapeways server that would normally be generated by manually filling out the materials form for each model and saving it. Here is a sample:

jQuery.post("/index.php?uri=/udesign/model/saveMaterials","model_id=12345678&default_material_id=53&
markup%5B1%5D=&materials_available%5B%5D=1&
markup%5B4%5D=&materials_available%5B%5D=4&
markup%5B5%5D=&materials_available%5B%5D=5&
markup%5B6%5D=2&materials_enabled%5B%5D=6&materials_available%5B%5D=6&
markup%5B7%5D=&materials_available%5B%5D=7&
markup%5B23%5D=&materials_available%5B%5D=23&
markup%5B25%5D=2&materials_enabled%5B%5D=25&materials_available%5B%5D=25&
markup%5B26%5D=&materials_available%5B%5D=26&
markup%5B27%5D=&materials_available%5B%5D=27&
markup%5B28%5D=&materials_available%5B%5D=28&
markup%5B30%5D=&materials_available%5B%5D=30&
markup%5B31%5D=&materials_available%5B%5D=31&
markup%5B35%5D=&materials_available%5B%5D=35&
markup%5B36%5D=&materials_available%5B%5D=36&
markup%5B37%5D=&materials_available%5B%5D=37&
markup%5B38%5D=&materials_available%5B%5D=38&
markup%5B39%5D=&materials_available%5B%5D=39&
markup%5B45%5D=2&materials_enabled%5B%5D=45&materials_available%5B%5D=45&
markup%5B53%5D=12&materials_available%5B%5D=53&
markup%5B54%5D=2&materials_enabled%5B%5D=54&materials_available%5B%5D=54&
markup%5B58%5D=2&materials_enabled%5B%5D=58&materials_available%5B%5D=58&
markup%5B59%5D=12&materials_enabled%5B%5D=59&materials_available%5B%5D=59&
markup%5B60%5D=&materials_available%5B%5D=60&
markup%5B61%5D=&materials_available%5B%5D=61&
markup%5B62%5D=&materials_available%5B%5D=62&
markup%5B63%5D=&materials_available%5B%5D=63", function(data) {console.log(data);}); 


You can enter this into your browser's console (press Ctrl-Shift-I in Chrome), be sure to be logged in to Shapeways or otherwise it won't work. You can get the material IDs by having a careful look at the "Edit Model" page's sourcecode. A similar trick works for batch changing the tags, but I somehow lost the source code I used for that.

 
   
Previous Topic:Possible Interface for mass changes
Next Topic:WSDL 2 JAVA compilation error