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?
Related
How can I convert the file I uploaded to Forge to svf format and then download it to my own server?
I wanted to do these operations using your project "https://github.com/Autodesk-Forge/forge-bucketsmanager-desktop/tree/master/bucket.manager". As a result, I downloaded it, but there are files in it that I will not use. The reason for this is that the load on the download process increases. I just want the "3d views" folder. Can you help with this?
As Alex said, the structure of an SVF asset can vary depending on the input file format. For more details on how to download the SVF (or just some of its parts), take a look at the forge-convert-utils library, specifically the SvfDownloader. It parses the actual SVF file to identify all the additional assets (e.g., geometry files, textures, property database files, etc.) that need to be downloaded as well.
I was downloading Revit models from BIM360 team hub via ForgeAPI using the following uri.
https://developer.api.autodesk.com/oss/v2/buckets/:bucketKey/objects/:objectName
All my objectName ended with .rvt. So I downloaded and saved them as rvt file.
However I noticed that some of the files cannot be opened by Revit. They are actually not rvt files but zip files. So I have to change the extension to .zip and unzip the file to get real 'rvt` files.
My Problem is that not all files is zip file. I cannot tell from the API because the URI I request is always ended with .rvt.
Every Unix OS provides the file command, a standard utility program for recognising the type of data contained in a computer file:
https://en.wikipedia.org/wiki/File_(command)
A zip file is directly recognised and reported like this:
$ file test_dataset.zip
test_dataset.zip: Zip archive data, at least v2.0 to extract
A Revit RVT model is a Windows compound document file, so it generates the following output:
$ file little_house_2021.rvt
little_house_2021.rvt: Composite Document File V2 Document, Cannot read section info
Hence you can use the same algorithm as file does to distinguish between RVT and ZIP files.
Afaik, file just looks at the first couple of bytes in the given file.
The Python programming language offers similar utilities; try an Internet search
for distinguish file type python; the first hits explain
How to check type of files without extensions in Python
and point to the filetype Python project.
Other programming languages can provide similar functionality.
I am just out of bootcamp and not familiar with .jl files. I read a solution on stack overflow to convert the .jl files into .txt and the files look like JSON syntax - but I am not experienced enough to say it absolutely is JSON!
The .txt file looks like this - if I wanted to access this file with FE React.js framework and only the product_id/ price / product_imgs_source - is there a method to do this? I can use the data simply by hard-coding it into an array and using it as front-end data and it works - but I am looking for a method that helps me map through this .txt data so a data-transformation method from .txt to .js
{"product_categories_mapped": [24]
"product_id": "ny221a00q-n11",
"price": "84.99",
"product_title": "some description",
"product_imgs_src": ["https://some.jpg"],
"images": [{"url": "https://some.jpg",
"path": "some.jpg",
"checksum": "10f6a0dc3db6b15724cebe9b1cb244be"}],
}
When I used the global fetch() method on the data that was a https link from aws s3 db with a .jl file extension - the error was a 403 so I converted the .jl files to a .txt file and would be great if I could use a JavaScript method to access the .txt data - my worst option is to make it work by manually extracting the data and hardcoding it into an array of objects and accessing the information in the front-end, then creating a node-express environment and a mongo-db collection from this data that I have manually extracted - if there is a better way I will be grateful for any suggestions!
In certain circumstances, BIM360 will serve a zip file of a Revit document along with its links, such as explained here: https://forums.autodesk.com/t5/bim-360-document-management/linked-revit-files-in-bim-360-docs/td-p/8774004
In this circumstances, however, when interacting with GET projects/:project_id/folders/:folder_id/contents the file still is shown as a regular file (potentially the isCompositeDesign attribute distinguishes it) with a .rvt file extension. In addition, the filesize shown in storageSize of the object is the sum of the main Revit file and all of its links. Checking the details in GET buckets/:bucketKey/objects/:objectName/details equally show the size object size attribute to be the sum of the main Revit file and all of its links.
I cannot seem to find functionality in Forge that:
Distinguishes a zip file from a lone file (potentially the isCompositeDesign attribute does this)
Provides a list of which other files are linked into the main file, or a list of the zip file contents and their URNs.
Provides a true filesize of the main revit file itself, not just the sum of all linked files in the zip.
Ideas?
Revit 4 worksharing, publishes a file to BIM360.
This file is named as a .rvt file (ie. 'mybigrevitproject.rvt'), but in fact, it's really a zip file in disguise. If you rename it to zip, download it, and unzip it, you'll find lots of .RVT inside the zip.
There's a neat trick to figuring this out, without downloading the entire file.
Use a range GET on the first 16 bytes, and check for the magic header.
For full details, check out this repo: https://github.com/wallabyway
Here's a snippet of the code that will help:
https://github.com/wallabyway/bim360-zip-extract/blob/master/server.js#L167
I think it's related to this question: Forge Data management returns zip file
I've implemented offline viewing based on the tutorial and github here. The problem I'm having is forge is looking for the db jsons in an odd location that makes url pathing awkward. The files in particular are 'objects_attrs.json.gz', 'objects_vals.json.gz', 'objects_offs.json.gz', 'objects_ids.json.gz', 'objects_avs.json.gz'. For some reason the forge viewer strips two layers of directories off the url then looks for the files there. Afterword Forge looks for the files in the original location but, looks for the straight json instead of the gziped jsons.
This can be handled in a few hacky ways like creating two arbitrary parent directories in the url and accepting files at the higher url as well. Or unzipping the gzips and saving them in location. But, these kind of hacks could easily be unstable if I'm not exactly right about the forge implementation.
Is there any reason these files are searched for in a different location? For example are these files also used by the 2d files not just the 3d files? Are there other files like this?
Look for the .svf file, say it's Design.svf. Rename it to Design.zip, and then upzip the file. This will get you the manifest.json.
Inside the manifest.json file, you'll file the URI's of all the files, including the one's you mentioned (the property database files).
Modify the URI as you wish, save the manifest.json file and re-zip it back up and rename it back to Design.svf.
If you got the URI path matching your file-system, then those property files will now load correctly.
Good luck!