更新:从发布作业中删除x-ads-force:true标志可消除此问题
我有上周写的一些代码,goes through the process是使用forge从Fusion 360文件中提取元数据的。这段代码有效-生成了缩略图并创建了svf文件。元数据返回一个GUID,我能够提取属性。
回到今天,此过程不再有效。运行完成缩略图的作业,并且确实创建了缩略图。创建svf的工作似乎也可以正确完成,但是清单仅返回一项-缩略图。
当我提取元数据时,没有向导。
我想重申一下,我上周编写了代码,并且运行良好。这只是在最终测试中不起作用。
$ urn是基本编码的urn,可用于创建缩略图。
// Set up the data object
$metaData = '{
"input" : {
"urn" :"'.$urn.'"},
"output" :{
"formats" : [{"type":"svf",
"views":["2d", "3d"]
}]
}
}';
// POST THE JOBS
$url = 'https://developer.api.autodesk.com/modelderivative/v2/designdata/job';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $metaData );
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer '.$token,
'x-ads-force:true',
'content-Type: application/json'
));
$response = curl_exec ($ch);
$err = curl_error($ch);
curl_close ($ch);
$jobStatus = "pending";
$numSteps = 0;
// STAY IN LOOP UNTIL STATUS IS GOOD
while ( ( $jobStatus != "good" ) && ( $jobStatus != "bad" ) && ( $numSteps < 50 ) )
{
sleep(10);
$url = 'https://developer.api.autodesk.com/modelderivative/v2/designdata/'.$urn.'/manifest';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer '.$token
));
$response = curl_exec ($ch);
$err = curl_error($ch);
curl_close ($ch);
$response = json_decode($response);
if ( $response->status == "success" )
{
$jobStatus = "good";
}else if ( ( $response->status == "failed" ) || ( $response->status == "timeout" ) )
{
$jobStatus = "bad";
}
$numSteps = $numSteps + 1;
}
此处的响应如下:
object(stdClass)#769 (8) {
["type"]=>
string(8) "manifest"
["hasThumbnail"]=>
string(4) "true"
["status"]=>
string(7) "success"
["progress"]=>
string(8) "complete"
["region"]=>
string(2) "US"
["urn"]=>
string(80) "dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLk1UTm1FS2RBUTc2VWVVVFVhVUtlRFE_dmVyc2lvbj01"
["version"]=>
string(3) "1.0"
["derivatives"]=>
array(1) {
[0]=>
object(stdClass)#801 (4) {
["status"]=>
string(7) "success"
["progress"]=>
string(8) "complete"
["outputType"]=>
string(9) "thumbnail"
["children"]=>
array(1) {
[0]=>
object(stdClass)#717 (6) {
["guid"]=>
string(36) "e163169a-4ada-4e9c-99c8-8e8083cc9969"
["type"]=>
string(8) "resource"
["urn"]=>
string(124) "urn:adsk.viewing:fs.file:dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLk1UTm1FS2RBUTc2VWVVVFVhVUtlRFE_dmVyc2lvbj01/output/256x256.png"
["resolution"]=>
array(2) {
[0]=>
int(256)
[1]=>
int(256)
}
["mime"]=>
string(9) "image/png"
["role"]=>
string(9) "thumbnail"
}
}
}
}
}
然后,元数据端点返回一个空数组。
svf作业似乎没有运行吗?
答案 0 :(得分:0)
更新:从发布作业中删除x-ads-force:true标志可消除此问题
仅在覆盖现有衍生产品时才使用此标志。