Reputation: 1010
I'm trying to upload a revit file with linked documents.
All the documents are in the same folder, and same bucket. ALL THE TIMES.
1 - You need to upload your files to the bucket. DONE!
2 - You need to Create References for the Composite Source File using this endpoint: https://forge.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-references-POST/
Ok, let's see if I can create a reference to a invalid file...
OK Forge recognized that one of my reference files did not exist! Nice.
Now let's send valid files:
Ok, it should be fine.
Now let's go to the final step... Let's start the job to translate the file to SVF!
Forge says that the linked files are missing, why?
Here are the requests...
References:
{
"urn": "urn:adsk.objects:os.object:federado/PL076-ARQ-EMB.rvt",
"filename":"PL076-ARQ-EMB.rvt",
"references": [
{"urn":"urn:adsk.objects:os.object:federado/PL076-HID-EMB.rvt", "metadata": {"Teste":"Gabriel"}},
{"urn":"urn:adsk.objects:os.object:federado/PL076-INC-EMB.rvt", "metadata": {"Teste":"Gabriel"}},
{"urn":"urn:adsk.objects:os.object:federado/PL076-ACO-EMB.rvt", "metadata": {"Teste":"Gabriel"}},
{"urn":"urn:adsk.objects:os.object:federado/PL076-ARQ-TOR01-FAC.rvt", "metadata": {"Teste":"Gabriel"}},
{"urn":"urn:adsk.objects:os.object:federado/PL076-ARQ-TOR01-OPC01.rvt", "metadata": {"Teste":"Gabriel"}},
{"urn":"urn:adsk.objects:os.object:federado/PL076-ELE-EMB.rvt", "metadata": {"Teste":"Gabriel"}},
{"urn":"urn:adsk.objects:os.object:federado/PL076-ENG-EMB.rvt", "metadata": {"Teste":"Gabriel"}},
{"urn":"urn:adsk.objects:os.object:federado/PL076-EST-CORDOALHAS.rvt", "metadata": {"Teste":"Gabriel"}},
{"urn":"urn:adsk.objects:os.object:federado/PL076-EST-EMB.rvt","metadata": {"Teste":"Gabriel"}}
]
}
JOB
{
"input": {
"urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZmVkZXJhZG8vUEwwNzYtQVJRLUVNQi5ydnQ",
"checkReferences": true
},
"output": {
"formats": [
{
"type": "svf",
"views": [
"2d",
"3d"
]
}
]
}
}
As you can see, the first request uses URN's without encoding to Base64, and the second one uses the encoding on the URN parameter. That's because their documentation says it should be like this.
So, any guesses why the links are missing?
Upvotes: 0
Views: 414
Reputation: 7070
Unfortunately, the reference API of the Model Derivate doesn't support Revit files currently as I know. Please upload a ZIP that contains the host RVT and its links to Forge OSS and trigger a translation job with this request body:
{
"input": {
"urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZmVkZXJhZG8vUEwwNzYtQVJRLUVNQi56aXA",
"compressedUrn": true,
"rootFilename": "PL076-ARQ-EMB.rvt"
},
"output": {
"formats": [
{
"type": "svf",
"views": [
"2d",
"3d"
]
}
]
}
}
If those models are uploaded onto your own managed Forge OSS bucket and they are not deleted yet, then you have to download all files included host and links and pack them to a zip and reupload again for translation.
Commonly, Forge OSS will delete all uploaded files automatically after 24hours with the transient bucket retention policy (the default policy in our codes samples and tutorials, you can change it as you want, see OSS Retention Policy page for details)
However, there is another way to see all your models in the same viewer scene - use Forge Viewer to load individual SVF model translated from your RVTs into the same scene. It’s well-known as the aggregate/multiple model scenario of the viewer. You can choose either way to achieve what you want.
BTW,
In multiple model scenario, you can obtain loaded models via accessing viewer.impl.modelQueue().getModels()
and get selection set via viewer.getAggregateSelection()
.
If your models are translated from a zip, you can determine if it’s from linked files via the external id of the element you selected. The external id for the Revit model is the Element.UniqueId
in Revit API. Each element in Revit has a unique GUID called UniqueId
and be assigned when the element was placed to the Revit view.
In the Forge Viewer, you can obtain the item's external id via calling viewer.getProperties( dbId )
. For item from links, the external will look like
65e0379f-2c38-40b3-b403-2979327abc7a-00080a4e/22858843-3747-4f42-8654-519948201028-000eaf08
. There would be a /
slash inside.
Hope it helps. Cheers!
Upvotes: 1