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?
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!
Related
I am using the Forge Data Management search API below to retrieve all .rvt files in BIM360 Docs.
Search API
The returned JSON for included.attributes.hidden is true when a file itself is manually deleted in the BIM360 docs site. When a parent folder is deleted, the file doesn't return as hidden: true, but hidden: false. This applies also to parent folders of folders.
To accurately determine if a file is deleted or not using this logic, the code would have to search up the parent folder tree from the file to find if any hidden: true exists. I would like to avoid this.
Two options could be:
A better way to determine what is in the deleted items area? This
might exist but I wasn't able to find this in the documentation
The children of the folder be marked as hidden: true when the
parent is hidden (and vice versa)?
Are either of these cases doable or currently available?
Sample returned Json:
"data": [{
],
"included": [{
{
"type": "items",
"id": "urn:adsk.wipprod:dm.lineage:***",
"attributes": {
"displayName": "r&b.rvt",
"hidden": true,
"reserved": false,
"extension": {
"type": "items:autodesk.bim360:C4RModel",
"version": "1.0.0",
"data": {}
}
},
I am building a tool automatically scan a local folder and upload files to BIM360 Docs, with 2 legged authentification, so far files can already uploaded to BIM360 Docs using Forge Data Management API however the "updated by" field is empty. what i want to accomplish is load the current login user and set the current user's name as updated by.
I cannot find anywhere i can use from Forge API to set the "updated by", can anyone suggest?
Thanks a lot.
When you post/patch an item/version there are two fields you can specify that suit your needs - lastModifiedUserId and lastModifiedUserName:
"attributes": {
"mimeType": "appplication/pdf",
"displayName": "version-test.pdf",
"name": "version-test.pdf",
"extension": {
"data": {
"tempUrn": null,
"storageType": "OSS",
"properties": {},
"storageUrn": "urn:adsk.objects:os.object:wip.dm.prod/3c8f6bbc-fe5c-4815-a92e-8b8635e7b1cb.pdf"
},
"version": "1.0",
"type": "versions:autodesk.bim360:FileVersions",
"schema": {
"href": "/schema/v1/versions/versions%3Aautodesk.bim360%3AFileVersions-1.0"
}
},
"createUserName": "John Doe",
"createTime": "2016-04-01T11:09:03.000Z",
"createUserId": "BW9RM76WZBGL",
"lastModifiedUserName": "John Doe",
"lastModifiedUserId": "BW9RM76WZBGL",
"versionNumber": 2,
"lastModifiedTime": "2016-04-01T11:11:18.000Z"
},
"type": "versions",
"id": "urn:adsk.wipprod:fs.file:vf.d34fdsg3g?version=2",
"links": {
"self": {
"href": "/data/v1/projects/b.6f8813fe-31a7-4440-bc63-d8ca97c856b4/versions/urn%3Aadsk.wipprod%3Afs.file%3Avf.b909RzMKR4mhc3O7UBY_8g%3Fversion%3D1"
}
}
Normally, we would suggest you to use 3 legged token to modify a file in BIM360 Docs, because that will keep track the users who made the modification to that file(updated by). Yes you can also use 2 legged token for file management in BIM360 for now, but this behaviour may change in the future, and we will clearly mention in our blog if it happens.
There is no user information for any changes to the BIM360 files with 2 legged token, but there is one way, follow the Upload Files to BIM 360 Document Managemen Tutorial, in Step 7 & 8, add the x-user-id parameter in the header as the following picture, you will see the last modified user is filled.
Check this https://forge.autodesk.com/en/docs/bim360/v1/reference/http/users-GET/ if you want to know how to get the x-user-id information, should be uid(Autodesk ID).
I'm following this tutorial :
https://developer.autodesk.com/en/docs/model-derivative/v2/tutorials/prepare-file-for-viewer/
In previous steps, I get the token, get a token for bucket, create one and upload a file in it.
But, when I try, on the next step, to convert my file to svg, I get this message :
{fault.name} - The client_id specified does not have access to the api product
In Postman, I've do that :
POST https://developer.api.autodesk.com/modelderivative/v2/designdata/job
-- Header
Content-Type:application/json
Authorization:Bearer eyJhbGciOiJIUzI1...
-- Body
{
"input": {
"urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGV2c3RlZWxidWNrZXQvc2t5c2NwcjEuXXXX"
},
"output": {
"formats": [
{
"type": "svf",
"views": [
"2d",
"3d"
]
}
]
}
}
And I do not find any solution in Google.
You need to activate your account.
If you face same issue even after activating your account, another possibility could be-
you might have missed "Model derivative API" while creating forge APP.
I am currently getting into Microsoft Team Apps and am trying to create a very simple tool.
All it should be is a static tab, that when visited embeds a certain website, that's given the groupId as a parameter. This is the format, that I have in mind for the contentUrl: https://foo.bar?groupId=\{groupId\}
The app consists only of two images, that are PNGs in 20x20px (transparent) and 96x96px (with background color) and the manifest (version 1.2).
The manifest contains all required fields:
$schema, manifestVersion, version, id, packageName, developer {name, websiteUrl, privacyUrl, termsOfUseUrl}, icons {color, outline}, description {short, full}, accentColor, permissions, validDomains, staticTabs [{entityId, name, contentUrl, scopes}]
An Id for the app has been generated at apps.dev.microsoft.com.
The upload of the custom app as zip file causes no error and I can see the app in the list of the installed applications. If I switch to a channel I can't see the tab which should be there without being explicitly added because it's a static tab. Adding it manually isn't possible because it's not shown in the list of "addable apps".
I tried some of the example apps from GitHub, but they seem outdated and at least partly can't be even read (Error while reading manifest.json).
Is this sufficient information to help me?
Edit: (anonymized manifest.json)
{
"$schema":
"https://statics.teams.microsoft.com/sdk/v1.2/manifest/MicrosoftTeams.schema.json",
"manifestVersion": "1.2",
"version": "1.0.0",
"id": "12345678-abcd-efgh-1234-123456789012",
"packageName": "com.microsoft.teams.bar",
"developer": {
"name": "Foo Corp",
"websiteUrl": "https://foo.com",
"privacyUrl": "https://foo.com/privacy",
"termsOfUseUrl": "https://foo.com/termsofuse"
},
"icons": {
"color": "src/images/waldo-96x96.png",
"outline": "src/images/waldo-20x20.png"
},
"name": {
"short": "bar",
"full": "bar"
},
"description": {
"short": "Opens baz and does qux.",
"full": "Opens baz and does qux."
},
"accentColor": "#FFFFFF",
"permissions": ["identity", "messageTeamMembers"],
"validDomains": ["*.baz.com", "*.foo.com"],
"staticTabs": [
{
"entityId": "tabId",
"name": "example tab",
"contentUrl":
"https://foo.com/?teamId={teamId}&teamName={teamName}&channelId={channelId}&channelName={channelName}&locale={locale}&theme={theme}&entityId={entityId}&subEntityId={subEntityId}&upn={upn}&tid={tid}&groupId={groupId}&theme={theme}&isFullScreen={isFullScreen}",
"scopes": ["personal"]
}
]
}
I could see two issues in your manifest code:
Invalid GUID: 12345678-abcd-efgh-1234-123456789012 is not valid GUID.
Icons must be included in the package and referenced via relative paths in the manifest.
ex. waldo-96x96.png - Please place them inside zip file.
Please feel free to use Teams App Studio to create the manifest file. You can also use the existing form the sample code.
I'm doing this tutorial from here:
I have a sample revit file from revit itself, I saved it as: test1.rvt
I get my access token [it works]
I create my bucket [it works]
I check if my bucket exists [it works]
I upload test1.rvt [it works]
I translate the file with the urn, encoded in 64bit [result: success]
I verify the translation [it fails]
I don't understand my problem here. The eror says:
The file is not a Revit file or is not a supported version
But I have tried with the revit file from the homePage (revit 2017 and 2018) so what can be my problem here?
Just verified your revit file, it's working good with the translation service, here is my body of translation job API:
{
"input" : {
"urn": "dXJuOmFkc2sub2JqZWN0c*******m9uc29mdHdhcmV3b3Jrc2hvcDIvdGVzdHJ2dC5ydnQ"
},
"output" : {
"force": "true",
"destination": {
"region": "us"
},
"formats": [
{
"type": "svf",
"views": ["2d", "3d"]
}
]
}
}