将链接的Revit模型上传到Autodesk Forge [英] Uploading linked Revit models to Autodesk Forge
问题描述
我一直在尝试使用Post引用( https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-references-POST/ )来设置两个文件之间的引用在forge中,但是尽管我在forge查看器上尝试显示成功消息时,即使转换了模型,我仍然仍然单独看到文件。有人遇到过同样的问题吗?
I've been trying to use the Post references (https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-references-POST/) to set up the reference between two files in forge but although I get a message "success" as result when I try it on the forge viewer I still see the files separately even after I translate the models. Has someone been through the same issue?
推荐答案
如果没有看到您的代码,就很难说出正在发生什么。下面,我复制了bash脚本代码,该代码引用/转换了具有材质和纹理的obj。
Without seeing you code it is hard to tell what is happening. Below I copied my bash script code which references/translate an obj with material and texture.
Au.obj
+- Au.mtl
+- Au.jpg
上传后,我得到了这些
- idObj = urn:adsk.objects:os.object:cyrillejcrja / Au.obj
- idMtl = urn:adsk.objects:os.object:cyrillejcrja / Au.mtl
- idJpg = urn:adsk.objects:os.object:cyrillejcrja / Au.jpg
现在设置引用的代码
urn=$(xbase64encode $idObj)
job='{
"urn": "'${idObj}'",
"filename": "Au.obj",
"references": [{
"urn": "'${idMtl}'",
"relativePath": "./Au.mtl",
"filename": "Au.mtl",
"references": [{
"urn": "'${idJpg}'",
"relativePath": "./Au.jpg"
}]
}]
}'
response=$(curl -H "Content-Type: application/json" \
-H "Authorization: ${bearer}" \
-X POST ${ForgeHost}/modelderivative/v2/designdata/${urn}/references \
-k -s -d "${job}")
此处收到如下所示的答复,仅表示引用已注册。
Here is got a reply like below which only means that the references are registered.
{
"result": "success"
}
现在,我这样做是为了翻译obj并使用引用
Now, I do this to translate the obj and use the references
urn=$(xbase64encode $idObj)
job='{
"input": {
"urn": "'${urn}'",
"checkReferences": true
},
"output": {
"formats": [
{
"type": "svf",
"views": [
"2d",
"3d"
]
}
]
}
}'
response=$(curl -H "Content-Type: application/json" \
-H "Authorization: ${bearer}" \
-H "x-ads-force: true" \
-X POST ${ForgeHost}/modelderivative/v2/designdata/job \
-k -s -d "${job}")
请注意 checkReferences:正确,如记录的这里。
Note the "checkReferences": true, as documented here.
现在,我可以等待翻译完成并在查看器中查看结果。
Now, I can wait the translation to complete and see the result in the Viewer.
上面使用的xbase64safeencode函数供参考
For reference the xbase64safeencode function used above
function xbase64safeencode () { local id64=$(echo -ne $1 | base64 $wrap_arg | tr -d '=' | tr '+/' '-_'); echo $id64; }
这篇关于将链接的Revit模型上传到Autodesk Forge的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!