How to put .rfa file on forge design automation? - autodesk

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.

Related

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

Autodesk Forge - Post Jobs - Must files be in buckets and proper URN

I am working on doing a post job and I am confused about where files need to be to run the job and the proper urn.
The examples all use a file that the user uploads to a bucket. I am trying to run the post job on a file that a user has created in Fusion 360 and that he has selected through a GUI I created. The urn in question is obtained by letting the user select the hub, project, folder(s), and file. I then use this file urn on the post job.
I keep getting back the response of :
Failed to download the design description for the input design.
My questions are:
Is it possible to do this from a users hub or do all items have to be in buckets?
Where are those translated files stored once created? If I want to get data like volume and mass without storing the translated file, is that possible?
I took the "urn:" off the front of the urn and got a different error, which I believe meant that it couldn't find any file.
Invalid 'design' parameter.
So, it looks like the urn I am using is finding a file but there is an issue somewhere that is preventing that file from being accessed or translated or something.
I keep getting back the response of : Failed to download the design description for the input design.
For Fusion 360 files make sure the extension name of the object is f2d/f3d. BTW Forge Viewer support these two formats directly so you don't have to translate to SVF for Viewer to visualize them.
Is it possible to do this from a users hub or do all items have to be in buckets?
For hub project items use the Data Management API to obtain the object ID - be sure to include the version parameter in your URN - see GET projects/:project_id/folders/:folder_id/contents and use the id of the item as your URN as well as tutorial here to help you understand how project folder items work.
Where are those translated files stored once created? If I want to get data like volume and mass without storing the translated file, is that possible?
The translated derivatives would be stored separately and you can access them through the derivative manifest. Use GET :urn/metadata/:guid/properties to query derivative properties but you will need to translate the model (to any format will do) in order to extract properties - see tutorial here.

fuelphp download csv on button click?

Similar to the uploading feature in fuelphp (link provided below), is there a tutorial for downloading files in fuelphp. There is not much information out there for fuelphp (other than the docs). Would I require a separate config page called download.php similar to upload.php?
All I really need is a page with either a download link or button to export csv to a user's local machine
Link to Upload feature
https://www.tutorialspoint.com/fuelphp/fuelphp_file_uploading.htm
Thanks in advance
Have you looked at the File class? This has a method of download which you pass the path of the file to. The 2nd param allows you to specify the name of the file that's downloaded.
File::download('path/to/file.txt, 'new-file-name.txt');
If you want to restrict downloads per user, you'll need to add logic around that.
https://fuelphp.com/docs/classes/file/usage.html#/method_download
Example
Create a new controller, as you've pointed out, download.php, and use the following as a starting point.
You'll need to pass something through to the get_index in order to determine which file the client will download. I'd suggest some sort of look up, using an unique identifier, instead of a file path, otherwise this would easily be exploited.
class Controller_Download extends Controller
{
public function get_index()
{
// #todo add logic surrounding file download
File::download('path/to/file.txt, 'new-file-name.txt');
}
}

show linked files in autodesk forge viewer

i am trying to make auto-desk forge viewer.
using this link Forge & ASP.NET: from zero to hero in 30 minutes
and it works fine with single revit file.
now i want to view revit document that has linked document and i found this post How to Set References with Revit Files for View and Data API
but i think it is an old version of api.
so i don't know how to apply these steps in the viewer code.
any help
A zipped file which is contained the host RVT file and corresponding linked files can help you archive this goal. After uploading this ZIP file to the Forge DM, you have to make sure that ‘compressedUrn: true’ and ‘rootFilename: {your host RVT filename with the sub filename .rvt}’ your input field of the job configuration body while submitting your translation job. Please refer here for the details: https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/job-POST/
Some more info:
If you do not want to manage the reference, while simply count on Forge detects the reference automatically, the choice is what Eason mentioned: package all files in an zip, upload, and ask Forge Post Job service to translate the zip. You only need to specify the root file.
https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/job-POST/
This blog tells more:
https://forge.autodesk.com/cloud_and_mobile/2016/07/translate-referenced-files-by-derivative-api.html
If you want to manage the reference, e.g. in one time, you have uploaded all files of one version or only a few files of the package. While after some time, some files need to be updated, or are not referred anymore, but it is unnecessary to upload all related files again (as in #1, upload zip again).
In such scenario, the choice is, firstly, set reference manually by another Forge service (Set Reference):
https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-references-POST/
next, ask POST Job service to translate:
https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/job-POST/
As of 1/2020 Autodesk has said that they do not support reference endpoint when exporting to SVG so zip file is the only supported method currenty.

Autodesk viewer offline - http-server communication to load and save files

We run the offline viewer using the http-server command, how can we make it load more files other than the bubbles and to be able to send strings back to it to save as files on the file system?
Do we have to write a modified http-server for that? if so can we have some direction on how?
The Viewer is read-only, nothing is saved or changed on the model after the translation.
It's possible to get the current state, like zoom, perspective or position via Autodesk.Viewing.Viewer3D methods: getState() and restoreState(), but the state is not actually saved by default, you'll need to implement a JavaScript that communicate with your backend to POST and GET this information. This sample extends this state.
Another sample extend this to save changes on model back to server that comunicate to the original file. Again, everything is custom implemented.
In any case you'll need a back-end that store the changes and a JavaScript that read and restore it.