Requests throw when using loadModel - autodesk-forge

I tried to use a viewer API for using offline data(SVF) .
When I called loadModel, any requests sent as follows.
https://ase.autodesk.com/adp/v1/analytics/upload
https://raas-assets.autodesk.com/StaticContent/BaseAddress?family=protein
https://raas-assets.autodesk.com/StaticContent/BaseAddress?family=prism
What does this request mean?
Is it checking see if data is correct?

The first one is for is internal to the viewer for properties access. The 2 others are internal for the viewer to access material definition for rendering purpose. Protein material are current/legacy material library (proprietary, and requires specific libraries from NVidia), Prism is the new future material library which is open (json information format)

Related

Is it possible to load new Cloud (BIM 360) links in a Revit model either through the Revit API or FORGE API?

I have a two-part WPF App and Revit Addin that runs a series of routines to create and activate a new BIM 360 project via the FORGE BIM 360 API, launches Revit and creates and sets up a collection of Revit models from a "seed" Revit model. The primary requirement is to have zero user interaction in this process: to be fully automated.
Given that background, I am having trouble linking the newly saved BIM 360 models to one-another. I have the option to do this either in the Revit Addin with Revit API hooks (preferred) or through the manager WPF App with FORGE API REST calls after the models are created.
Is either one possible?
I have successfully linked with the cached local models as described here and here. However, this does not meet the requirement fully, since when any other user (besides the automation machine user) opens the model the links are Not Found.
Screenshot of links Not Found.
Current "sort-of-working" code:
var wId = GetWorksetId(doc, w);
if (wId != null)
{
string localPath = settings.CloudModels.Where(x => x.ModelName == _linkModelNames[i]).Select(x => x.LocalFilePath).First();
ModelPath path = ModelPathUtils.ConvertUserVisiblePathToModelPath(localPath);
using (var options = new RevitLinkOptions(true))
{
using (var t = new Transaction(doc, w))
{
t.Start();
doc.GetWorksetTable().SetActiveWorksetId(wId);
using (var result = RevitLinkType.Create(doc, path, options))
{
_ = RevitLinkInstance.Create(doc, result.ElementId);
}
t.Commit();
linkPlaced++;
}
}
}
I was able to get the correct ModelPath via the Revit API thanks to this helpful tip. I can save this value in my Addin, close the model, and access the property later after opening a different model (saved in the CloudModels class referenced in the linq statement in the code snippet above). Unfortunately for me RevitLinkType.Create() that takes a ModelPath does not accept the cloud path, so I may have hit another dead end. Unless it is possible with an ExternalResourceReference. Has anyone tried this option? If so, how do you assemble a Revit ExternalResourceReference? I am not familiar with this process, and looking over this course from AU 2017, I don't see that it necessarily applies to BIM 360 cloud models. A BIM 360 cloud example would be very helpful if this is possible.
Alternate strategy: I do not see any reference to loading links in the FORGE Data Management API or other FORGE APIs. If I have somehow missed it, please share a link.
Any help would be very much appreciated!!
EDIT: I have since found these two (1) (2) similar questions that, at least for my purposes, were not answered satisfactorily. Any updates I should be aware of?
As of now (Jan 2020), unfortunately, we do not have a Link API for cloud models. It is on the roadmap.
Revit API 2022 docs mention that
The methods:
RevitLinkType.Create(Document, ModelPath, RevitLinkOptions)
RevitLinkType.LoadFrom(ModelPath, WorksetConfiguration)
have been enhanced to support creation of new cloud model Revit links.
You may use ModelPathUtils.ConvertCloudGUIDsToCloudPath() to
create a cloud path to use as an argument to these methods.
Additional Resource:
This Youtube Video showcases an example and its respective Github repo.
For Revit 2021 and below, you can use ExternalResourceReference() as a workaround, but I've noticed that this is not always reliable.
Its also mentioned in the documentation of InSessionPath property to not rely on this property:
Do not rely on this path (InSessionPath ) to look up an ExternalResourceReference, as the path is neither unique nor stable. It isn't unique because multiple servers might use the same server name and display name format. It isn't stable because some servers allow renaming, and because a server might change its name at some point.
Below is the code to do that:
var linkCloudPath = doc.GetCloudModelPath(); // the cloudpath of a BIM360 model
Guid linkedmodelguid = linkCloudPath.GetModelGUID();
Guid linkedprojectguid = linkCloudPath.GetProjectGUID();
Dictionary<string, string> Dictionary_ExternalResource = new Dictionary<string, string>(){
{"LinkedModelModelId", modelGuid.ToString()},
{"LinkedModelProjectId", projGuid.ToString()}
};
Dictionary<string, Guid> servers = new Dictionary<string, Guid>();
foreach (var service in ExternalServiceRegistry.GetServices())
{
if (service.Name == "External Resource Service")
{
IList<Guid> server_ids = service.GetRegisteredServerIds();
foreach (var server_id in server_ids)
{
servers.Add(service.GetServer(server_id).GetName(), server_id);
}
}
}
Guid BIM360ServerID = servers["BIM 360"];
ExternalResourceReference ERS = new ExternalResourceReference(BIM360ServerID, Dictionary_ExternalResource, "", "");
RevitLinkOptions options = new RevitLinkOptions(false);
LinkLoadResult result = RevitLinkType.Create(gcdoc, ERS, options);
RevitLinkInstance.Create(gcdoc, result.ElementId);
Please note that this seems to be working fine in Revit 2020, but not in Revit 2021.
I believe it is possible to create links to the Cloud Models in Revit 2019 or higher (with ModelPathUtils.ConvertCloudGUIDsToCloudPath()). You'll need the ProjectGUID and ModelGUID to make the cloud model path.
Regarding the ExternalResource approach, that also works - but it's super messy - you can read the properties associated with existing BIM360 links and you'll see how an ExternalResource is defined for BIM360 links.
Finally - as of today, the Forge Design Automation for Revit approach would not work for you at all:
1. Not possible to open a live cloud workshared model (only published/uploaded models).
2. No network access while you're running in a Design Automation for Revit session.
Good luck...
-Matt

Is there extension to show the models on a level?

I'd like to make a function to show models on a level which someone selected like a function that we can see in BIM 360 docs.
level selection in BIM 360 docs
Is there such kind of extension?
Try the Autodesk.AEC.LevelsExtension extension - so long as the model comes with the required AEC data about existing floors:
viewer.addEventListener(Autodesk.Viewing.OBJECT_TREE_CREATED_EVENT/Autodesk.Viewing.GEOMETRY_LOADED_EVENT , //wait till design data is loaded
viewer.loadExtension('Autodesk.AEC.LevelsExtension')
)
You can inspect whether your model contains the necessary data using model.getAecModelData()

How do I get access from a client app by using PhoneGap to OpenHAB?

I'm developing a hybrid app (using PhoneGap) for openHAB. At the moment I'm struggling to build a connection from my hybrid to the OpenHAB runtime. Any suggestions?
The intended way to connect to the openHAB runtime is the REST API which is described in detail in the wiki (see https://github.com/openhab/openhab/wiki/REST-API).
You could also have a look at the implementations of the native Android client (see https://github.com/openhab/openhab.android) or the greenT HTML5 application based on Sencha Touch (see https://github.com/openhab/openhab/tree/master/distribution/openhabhome/webapps/greent).
Hope this helps,
Thomas E.-E.
The openhab has a REST API implemented as a bundle. this can be accessed via the URL "http://openhabip:8080/rest/".
If you want to access the items and implemet your own UI you can use "http://openhabip:8080/rest/items" with HTTP GET, POST ,PUT.
Otherwise you can use the "http://:8080/rest/sitemaps" and use the openhab provided sitemaps.
The details are in https://github.com/openhab/openhab/wiki/REST-API

How to do Chart on Windows Phone Universal App

I'm new Windows Phone Universal App, I need to implement bar/pie chart.
Tried many dll, Metro UI, WinRtXamlToolKit and WinRtXamlToolKit.Controls.DataVisualization
These dll are not working.
Give me good idea to do this on Windows Phone Universal App. How to do chart programmatically.
Thanks
I believe the Telerik has some Chart libraries that cost money ( can't link though as stackoverflow only permits me to post 2 links ( less than 10 rep) ). I have not used it and it is in Beta version at the moment. Google "Rad Chart windows universal apps" and you can read about it.
When I have needed charts for universal apps i have used the Google Chart Tools. You can use https://developers.google.com/chart/image/ even though Google is not developing on it anymore. It is is freakingly easy to use if you do not want to spend time drawing your own Charts. With the API you can request a chart just through a http request. You can setup almost everything and it's really easy to use thanks to the well documented API.
Here is an example of a bar chart i made using the API.
http://chart.googleapis.com/chart?chtt=Karakterfordeling&cht=bvg&chof=png&chs=300x300&chxt=x,y&chco=0076A3&chf=bg,s,65432100&hxr=0,0,50&chxl=0:|2|4|7|10|12&chxr=1,0,20&chbh=40,0,10&chd=t:2,60,70,10,90
All the arguments are passed through the http request and you can set your Chart up using the Live Chart Playground:
These are the arguments for the http request posted above. You can use the Live Chart Playground to set up parameters like below.
chtt=Karakterfordeling
cht=bvg
chof=png
chs=300x300
chxt=x,y
chco=0076A3
chf=bg,s,65432100
hxr=0,0,50
chxl=0:
2
4
7
10
12
chxr=1,0,20
chbh=40,0,10
chd=t:2,60,70,10,90
In code you set the http string as your ImageSource. You can manipulate the http string in your code and adapt the chart parameters/data if needed. I would recommend using a Converter that you bind to from you XAML. Pass your data to the converter and let it return a ImageSource with the http request. If you are new to Converters you can probably find a few posts about it here on stackoverflow.
Don't use DLLs grab the files into your project.
Add WinRTXamlToolkit.Controls.DataVisualization.csproj to your solution and reference it in the main project and add this to your page.
xmlns:charting="using:WinRTXamlToolkit.Controls.DataVisualization.Charting"
xmlns:datavis="using:WinRTXamlToolkit.Controls.DataVisualization"
Look at the samples project http://winrtxamltoolkit.codeplex.com
Unfortunately, winrtxamltoolkit is only for WinRT; VS 2013 doesn't allow adding of project references of that kind to WinPhone projects.

Is there a way to target specific file in Box app on IOS through box:// url scheme?

Box:// seems to open the app, however I am not able to discern how to target a specific file.
Currently we don't have support for this, but it is a great idea that we'll consider for our roadmap.
We actually do support this. The best way to add this integration into your app is to use our OneCloud AppToApp framework (additional information available here http://developers.box.com/the-box-sdk-for-onecloud-on-ios/)
This is easy using the app-to-app framework. You just need to call BoxAppToAppAPI's sendFileDownloadRequestToApplication:withMetaData: if you want an app to go to a particular file and in Box's case download/preview it.
To make it go to the Box app you can simply pass in [BoxAppToAppApplication BoxApplication] in the first parameter.
As for the metadata parameter, you can create it with BoxAppToAppFileMetadata's appToAppFileMetadataWithFileName:fileExtension:folderPath:mimeType:fileID:folderPathByID:exportToken:username:
Assuming your app already integrates with the Box API via the SDK or otherwise, it should be able to get all of that information easily.
If the mimeType is not known, nil can be passed in. Also, nil can be passed in for the exportToken if the file was not exported out of the Box app (with the AppToApp framework, a roundtrip scenario is also supported where the user starts in the Box app, picks a file to view/edit/etc in your app, and then sends it back to Box to upload). So if it's not a round-trip, it's just a one-way from your app to Box, use nil for the exportToken.
Before doing this, you can also check if the Box app is installed by checking for [[BoxAppToAppApplication BoxApplication] isInstalled].
Below is a fictional example (the values are made up):
BoxAppToAppFileMetadata *metadata = [BoxAppToAppFileMetadata appToAppFileMetadataWithFileName:#"fileName"
fileExtension:#"png"
folderPath:#"All Files/Folder1"
mimeType:nil
fileID:[NSNumber numberWithLongLong:123456]
folderPathByID:#"0/12345"
exportToken:nil
username:#"username#email.com"]
BoxAppToAppStatus status = [BoxAppToAppAPI sendFileDownloadRequestToApplication:[BoxAppToAppApplication BoxApplication]
withMetaData:metadata];