Upload linked Revit models for Forge Viewer - autodesk-forge

How can I upload a Revit model that contains multiple Revit files, where one of them is a main file and the remaining are linked files into Forge Viewer?
I've uploaded separately and they show as different files in the bucket and the viewer. Can we have one combined file to be viewed in the Forge Viewer?

A ZIP file can help you do such thing. You can pack them in a single .zip file, then upload it to Forge Data Management Service.
While submitting a translation job to the Forge Model Derivative Service, your job configs should contain two extra parameters compressedUrn and rootFilename, for example:
{
"input": {
"urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bW9kZWxkZXJpdmF0aXZlL0E1LnppcA",
"compressedUrn": true,
"rootFilename": "myAwesomeHostFile.rvt"
},
"output": {
"formats": [
{
"type": "svf",
"views": [
"2d",
"3d"
]
}
]
}
}
Afterward, those RVT files will be translated into a single derivative, you can see all linked file contents in the viewer via a single URN.

Related

How to put .rfa file on forge design automation?

I want to put file .rfa into Forge DesignAutomation to use function LoadFamily create Special equipment by Revit. I don't know how to put it.
Is it possible to upload the .rfa?
And do i need to configure the activity, bucket or anything else ?
You can send any data to Design Automation job, so that includes rfa files. You may follow any of our code samples (say count.delete) and modify it's activity definition to add an extra parameter and give it an hardcoded local name.
"inputRFA": {
"verb": "get",
"description": "Input Family",
"localName": "input.rfa"
}
When you post your workitem, you can add the inputRFA argument to it with a downloadable link corresponding to the file. This will save your file on the worker machine in the working folder with the hardcoded name provided in the activity parameter input.rfa.
You may then load the family in your appbundle code using:
Family family = null;
document.LoadFamily("input.rfa", out family);
If your input.rfa is always the same for different jobs, you can instead save the family file(s) in the app bundle itself. See some ideas discussed in the blog.

Can I use a link to Ressource in Json?

Hello I want to create a link in Json to other Json files, that are in my Ressource folder.
Can I do that? How?
example:
{
"name": "Category 1",
"linkToJson": R.Ressources.Categories1
}
I want to use it in Android Studio. I have a main category and sub-categories. There will be so many sub-categories, so I want to separate them into individual files.

How can I get links between models on BIM 360?

I am trying to build a script that transfers files from the Project Files subfolders to the Plans subfolders.
In my BIM 360 Docs I have .rvt models that are linked (e.g. HVAC model linked to the architecture 3D model). When I download a linked model (manually or via the Forge API), I get a .zip file with all the linked models in it.
Is it possible to check which models are linked to an item via the Forge APIs and also in which folder those linked models are stored?
Thank you for your help.
Edit: I tried getting those links by calling versions/:version_id/relationships/refs, but it only shows copies I made from the file.
The links I am trying the get are created in Revit via Insert > Link Revit > Add... and then selecting a file from BIM 360.
Also, when uploading this kind of file (with linked models) manually, to do it correctly I need to select the "upload linked files" option in BIM 360 and then select the parent file.
After you get one version id of one file, you could call versions/:version_id/ relationships/refs. It will tell the relationships of this file with other files. In the structure, fromId is the root file, toId is the xref file. So, if fromId is same to the version_id, that means this file you are checking is a root file. Otherwise, it is one xref (linked) file.
And in the relationships, it will also tell the information of all xrefs file.
The below is the example with my test files.
Root file is urn:adsk.wipprod:fs.file:vf.z4KMn52OT5OIuKamXnzmFw?version=1
Linked file is
urn:adsk.wipprod:fs.file:vf.bIJqAo5-TrCmyMy07ELifw?version=1
Using version id of root file:
https://developer.api.autodesk.com/data/v1/projects/ /versions/ urn%3aadsk.wipprod%3afs.file%3avf.z4KMn52OT5OIuKamXnzmFw%3fversion%3d1/relationships/refs
it returns the structure:
"data": [
{
"type": "versions",
"id": "urn:adsk.wipprod:fs.file:vf.bIJqAo5-TrCmyMy07ELifw?version=1",
"meta": {
"refType": "xrefs",
"fromId": "urn:adsk.wipprod:fs.file:vf.z4KMn52OT5OIuKamXnzmFw?version=1",
"fromType": "versions",
"toId": "urn:adsk.wipprod:fs.file:vf.bIJqAo5-TrCmyMy07ELifw?version=1",
"toType": "versions",
"direction": "from",
"extension": {
"type": "xrefs:autodesk.core:Xref",
"version": "1.0",
"schema": {
"href": "https://developer.api.autodesk.com/schema/v1/versions/xrefs:autodesk.core:Xref-1.0"
},
"data": {}
}
}
}
],
I also had a lot of trouble to follow links between Revit files on BIM360/ACC and after a lot of research, the situation seems as follows:
There is no way to get links/references for models that are composite designs (ie. downloadable as zip files)
For non-composite models, your mentioned relationships/refs endpoint will return incoming and outgoing references correctly
To check wether an item (revit file) is a composite design or not, check projects/:project_id/items/:item_id/versions. This will return an array of versions, each with attributes.extension.data.isCompositeDesign (bool). If you find versions with isCompositeDesign=false, you can use the relationships/refs endpoint to get all references (of that version).
A model will become composite once there are referenced items with unpublished changes. See here for more details on composite design and here for troubleshooting the creation of cloud compatible links/references.
Models that are composite designs will contain all referenced files including the source file in one zip file. It is noteworthy that the zip file will not contain referenced references, ie. it does not follow references. In other words: If a composite design model references models that are composite designs themselves, the zip file will not contain the zip file of the composite design reference, but only the reference (rvt file) without its references. This makes it very hard, if not impossible, to use design automation in real world scenarios where models often contain sub-references (reference of a reference) and not all the models along the reference chain are untouched, published models.

Search method doesn't work with Autodesk Navisworks file in Autodesk forge Viewer API

Search method always return empty objects with Navisworks file but it works with Revit file. Here is the sample code which works with revit file but doesn't work with navisworks file.
viewer.search('Levels', function(dbIds){ console.log(dbIds); }, null, ['Type'])
Please let me know if you have a solution for .nwd file

Autodesk Forge Viewer Exporter

I am trying to get access to the manifest.json and metadata.json for a converted revit file that has children f2d.
If I convert a revit file. I get a manifest file that has a svf and f2d files
I know that I can open the svf file as a zip and get its manifest and metadata files to pull down all the files that go along with it.
but the f2d files are not zip files in a format that I understand. So my question is what is the f2d format and how can I access its manifest and metadata so that I can use it in the Viewer.
EXAMPLE:
{
"role": "graphics",
"mime": "application/autodesk-f2d",
"urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6Z3JlZ2JpbWJ1Y2tldHR3ZW50eXNpeC9SZXZpdF9TYW1wbGVfMjAxNi5ydnQ/output/332d9c2c-1bfd-51c1-35c6-aff868a7e5db_f2d/primaryGraphics.f2d",
"status": "success",
"type": "resource"
},
Note 1 this is not a question about how to convert a DWG file directly. Its a question about converting a revit file that has 2D drawings.
Note 2 I am using the version v2 of the API to convert and pull down the converted files.
Something that got suggested to me by one of our engineer's was the following:
The manifest.json.gz and metadata.json.gz are just files in the same location as the f2d file. But if you are using an F2D file in the viewer, why not use the viewer to load it, and then access those using model.getData().metadata and model.getData().manifest.
I haven't tried it on my side, since I don't have anything setup to get the f2d files at the moment, but I thought it was worth the shot to try with you first.
I see from past questions you have been trying to understand the origin of the .sb and bin files you get back, have you been able to do so?