Can I use a link to Ressource in Json? - 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.

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.

Visual Studio Code JSON completion

I'm making my first videogame in Unity and I was messing around with storing data in JSON files. More specifically, language localization files. Each file stores key-value pairs of strings. Keys are grouped in categories (like "menu.pause.quit").
Now, since each language file is essentially going to have the same keys (but different values), it would be nice if VS code recognized and helped me write these keys with tooltips.
For example, if you open settings.json in VS code, if you try to write something, there's some kind of autocompletion going on:
How does that work?
The auto completion for json files is done with json schemas. It is described in the documentation:
https://code.visualstudio.com/docs/languages/json#_json-schemas-and-settings
Basically you need to create a json schema which describes your json file and you can map it to json files via your user or workspace settings:
// settings.json
{
// ... other settings
"json.schemas": [
{
"fileMatch": [
"/language-file.json"
],
"url": "./language-file-schema.json"
}
]
}
This will provide auto completion for language-file.json (or any other file matched by the pattern) based on language-file-schema.json(in your workspace folder, but you can also use absolute paths)
The elements of fileMatch may be patterns which will match against multiple 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.

Adding a JSON Selection directory to Angular Application

So I'm designing a program that lets a user send a JSON to an API using HTTP-Post.
The Json are stored in a folder inside my application called JsonFiles then inside this folder are then put into there own brand name so the path looks something like this >JsonFiles>Nike>OrderConfirm.Json
What would be a good way to let the user select a JSON File from the user interface in like a dropdown menu?
What I have so far is being able to pick a specific file from the component.ts using import,
but this is no good due to I need user interaction to choose the file. In case anyone is wondering I'm creating an application for work.
Thanks guys so much.
You can move these json files to the assets folder. So it will be available to fetch using http request.
httpClient.get(`/JsonFiles/Nike/${jsonFileName}.json`)
And in the component you just need to keep the file names.
files = ['OrderConfirm']
You can also just keep your folder anywhere, But add that path to angular.json as follows,
"assets": [
"src/assets",
"src/favicon.ico"
]
For ref: https://github.com/angular/angular-cli/wiki/stories-asset-configuration

How can I convert a .txt file into a JavaScript object?

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!