How to load various CZML files from a folder without hardcoding in Cesium - cesiumjs

In many of the Cesium Sandcastle examples such as here CZML files are loaded individually using:
Cesium.CzmlDataSource.load("../SampleData/simple.czml")
If rather than hardcoding a file path for a specific single file I instead wanted to gather all CZML files in a folder and load each one how could I do so?

Related

How can I find which Revit files are linked in BIM 360 via Forge?

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

Weird url pathing for autodesk forge db jsons

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!

Dynamically add files to the FileReferenceList class

I was wondering that if there is way to add/select files to filerefernce instead of using filereference.browse().
Usage: I have to pick all files from a directory to be uploaded.
Thanks
Siddharth
Edit: Or is there any other way of uploading all files in a directory (num of files not more than 25)
You must use FileReferenceList.browse() method.
Flash Player creates an array of selected files called FileReferenceList.fileList

turn folder into a zip file

I have a folder on my desktop and i want to convert it into a .zip file. It shouldnt ask me were to save it but just save it straight to my desktop or any folder i specified.
I tried ASZip, fZip etc. but i can't get it to work. There isn't any of them that seem to let me just add a folder and zip it.
I was only able to create a byteArray wit ASZip but when i saved it, it left me with a file that was not able to be opened.
Would it be possible to achieve what i want without the use of an external library?
Any help would be appreciated.
You can't actually zip a folder but you can zip all the contents inside the folder. You would have to use FileReferenceList to load in flash all the files inside the folder.
FileReferenceList allows you to have multiple selection in the browse window.
Then you would have to pass all these files to the zip managing library and get a ByteArray from it.
This byte array you would localy dump inside a "yourFileName.zip" by using FileReference.save().
The application cannot save the file to a predetermined location. The user has to pick the location using the "save to" prompt.

Saving several images (and metadata for each) in a single file using Adobe Air

Is it possible, via Adobe Air, to save multiple types of data in a single file? For example, an application would allow the user to load in external images, position them on stage and label them. This data would be then be stored in a ByteArray (I guess) using BitmapData for the images and probably XML for the metadata.
I would then like to write this to a single file, with a bespoke file extension that could be associated with said Air app.
I've asked this on various forums and never received a single reply.
You can add everything to a byte array and write it to file - but defining boundaries and extracting individual entities back from the file would take some effort. How about writing them to normal files, zipping them to a single file and deleting the originals? This way you can still have a single file and deal with the individual items more easily.
This article describes some ActionScript zip libraries. I've used nochump in the past and it was easy - this page has some sample code
If you want some individuality for your files, you can rename the zipped file to whatever extension you want - that's what Firefox extensions do, they have .xpi extension, but they're plain zip files renamed.