Forge ARKit: Cannot load model in Unity - autodesk-forge

With the latest ForgeARKit-update-6-2018.1, I was trying to load my model in Unity, with the sample Unity scene 'loadAtStartup'. I can successfully load the sample models from 'Sandbox', but I couldn't load my model, which was uploaded through script 'test-2legged'.
Error message shows 504, it seems not reaching the service:
AsyncRequestCompleted The remote server returned an error: (504) Gateway Time-out.
UnityEngine.Debug:Log(Object)
Autodesk.Forge.ARKit.RequestQueueMgr:AsyncRequestCompleted(Object, AsyncCompletedEventArgs) (at Assets/Forge/CodeBase/RequestQueue.cs:322)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()
Model URN:
dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bWFvbGlua3ppOHM3cnlvZWx4bjVndnR4bjcyZWc2N2l0dGp0a2MvMmZsb29yX0FyYy5pZmM=
[Update 23/4/2019]
I found that I can successfully load the same model with ForgeARKit-update-3-2017.1.2f1. I compare the Forge code in Unity. I think it has something to do with the service URL. The version 6 is fetching models from 'https://developer-api-beta.autodesk.io' while version 3 is fetching from 'https://developer-api.autodesk.io'. Meanwhile the shell script 'test-2legged' is uploading to the latter one ('https://developer-api.autodesk.io'). That is why it counldn'd find the resource. Question here is how can I upload model to the 'beta' ARKit? I tried modifying the URL in script 'test-2legged' but it doesn't work. Below screen-shot is the output of script 'test-2legged' when fetching from 'beta' ARkit. It seems model is uploaded successfully, but some parsing post-work failed. I guess the response format is also changed in the beta version. Is there a beta version of 'test-2legged' scripts (and other Scene Preparation scripts)?
Please comments, Thanks.

This is correct. My apologizes for this, I know we did not documented very well on the server changes.
This update6 assumes you are using the new server under beta right now. The scripts and update 3 are using the legacy server. Note that the 2 servers are not necessarily compatible and store the data in different places, so make sure to always use the same server in Unity as the one you used to prepare the scene. When we will switch everyone to the new server, we will transfer the data from the legacy server to the new server cloud storage.
The Update3 package will still be able to read scenes from the new server, as we make sure the old Unity code stays compatible.
Note as well you need to use SafeBase64 encoded string everywhere. I saw in your description that you are using base64 encoded (not safe). The new server will be more strict of parameters and format, so I encourage you to test your scripts/code on the beta server.
Last, I am working on a new Unity code update, and documentation which will be released next week. Make sure to use this version - it adds support for 3legged, automatic 2/3legged token refresh, and more. If you got scenes failing, please contact me directly and share your models and URN. I'll either test it on my development environment, or look into our log files for the reason to fail. My email address is my first name at autodesk.com

Thank you Cyrille for your help!! I am replying you here as it's easier to insert images.
I replaced the function 'xbase64encode()' with 'xbase64safeencode()', and now it works! However it seems for some model it still responds some error and in that case it cannot be loaded in Unity. (as the image below). I checked the script and I think all the encoding are using SafeBase64. Any clue of that? Or is that caused by my model?
BTW, the loading performance is greatly improved than the legacy version!! It looks almost the same as the web client. Huge Thanks for that!
Good to know that there is going to be an update next week. Yes I will test it and get back to you later.

Related

Banno OATH Cannot GET /v0/oidc/auth

Completely working Banno simple-plugin-example using one AWS Linux server with NodeJS copied to be transitioned to work under a Microsoft IIS server with NodeJS and URL Rewrites and all that entails basically worked out; but fails when it gets to actual process of OATH apparently as getting a "Cannot GET /v0/oidc/auth" response. Tried a number of ideas; but looking for some ideas to try.
I'm unable to reproduce the behavior that you saw, which makes me wonder if you ran into a temporary blip.
Assuming that we're talking about the latest version (commit c8775db2e3d9ecb4ce9ca708475d81d5936adf0e) of the Simple Plugin Example, then there are a few things to check and/or try.
It'll be good to check that the environment value in your config.js is correct. The config-EXAMPLE.js in the repo uses https://digital.garden-fi.com which matches up with the Garden demo financial institution. However, if you're not running this with a Client ID and Client Secret that's from Garden (i.e. this is with a different financial institution) then you'll have to change that environment value as appropriate for your financial institution.
It'll be good to double-check that the Client ID and Client Secret match up with your External Application which is configured for your plugin.
If you're running the Simple Plugin Example locally, then you can try navigating to the http://localhost:8080/dynamic URL which is expected by the plugin when the code is run locally. This is a good way to figure out if the sample code itself is running as expected.
Assuming the above is fine, it'll be good to double-check the "URL Rewrites" which you mentioned...it's unclear what those URL rewrites are doing, but it's possible that you have some code which is interfering with what the sample code is expecting.

Derivatives API Java Client Role Enums

We have recently updated to the latest forge-api-java-client jar.
There are currently issues when calling /modelderivative/v2/designdata/{urn}/metadata during a PDF upload.
As the request object cannot be mapped into the Manifest response due to errors with unknown enums being returned for ManifestChildren.RoleEnum
Manifest -> ManifestDerivative -> ManifestChildren -> RoleEnum
I have been able to work around this issue by adding the four missing enums (leaflet, leaflet-zip, pdf-strings, pdf-page) to the jar and building it locally.
I have searched and cannot find any release notes around these new enums/response objects, and was wondering if I could get pointed in the right location for these changes so I can keep an eye on future updates.
Also I would like to confirm that there are not other changes in the recent updates that may affect other Manifest responses we have not yet seen.
Thank you for any help.
Thank you for bringing that up. The leaflet/pdf roles have been around for a while but I don't see them documented anywhere, either. I'll talk to the Model Derivative team and make sure that the roles are documented.
As for the Java SDK, please submit a Github issue or a pull request to https://github.com/Autodesk-Forge/forge-api-java-client and we'll take a look at it.

How to re-process an existing Autodesk file with updated version?

We have a scenario where Box(box.com) has multiple versions for same file and we need to update and process the current version of file in our application.
Please let me know the process to upload new file version in same bucket and process it.
Currently, we are unable to render the updated Autodesk file view. It is still showing the old file view.
You can simply upload a new version of the file using the same bucketKey/objectKey pair, first make sure that you are using x-ads-force set to true in the header of your /POST job request.
The viewer is caching the data when loading a model, so once the translation is done, you also need to make sure you are clearing your cache or testing in incognito session.
See that article for more details: I Make Changes and Nothing Happens
Hope that helps.

Uploading attachment to Asana

I'm trying to add some functionality to an internal Access database that will automatically create tasks on Asana.
My VBA experience is somewhat limited but by examining various code samples online and tinkering I've been able to POST tasks with all the necessary data and GET info back.
But I'm now struggling with being able to upload file attachments to a task. I'm not sure how to go about it.
Leaving the content type as application/x-www-form-urlencoded which works for the normal POST statements when creating tasks and just pointing the send command to a file location using doesn't work and results in an error of "file is not an object", I'm guessing this is because all that's contained in the send command is a file=path pair.
Do I need to encode the file at all, if so how?
I'm hoping someone can point me in the right direction.
Thanks.
You can check out how curl does it, but I believe it needs to be multipart/form-data - I would strongly recommend using a library rather than doing the encoding manually, since there are often subtle gotchas.
Basically, it works a lot like a standard form upload from a web browser.
Hope that helps!

How to configure Netbeans code entry point when you use mod-rewriting

I am developing a website in PHP and I am using mod-rewrite rules. I want to use the Netbeans Run Configuration (under project properties) to set code entry points that looks like http://project/news or http://project/user/12
It seems Netbeans have a problem with this and needs an entry point to a physical file like http://project/user.php?id=12
Has anyone found a good way to work around this?
I see your question is a bit old, but since it has no answer, I will give you one.
What I did to solve the problem, was to give netbeans what it wants in terms of a valid physical file, but provide my controller (index.php in this case) with the 'data' to act correctly. I pass this data using a query parameter. Using your example of project being the web site domain and user/12 as the URL, use the following in the NetBeans Run Configuration and arguments boxes. netbeans does not need the ? as it inserts that automatically, see the complete url below the input boxes
Project URL: http://project
Index File: index.php *(put your controller name here)*
Arguments: url=user/12
http://project/index.php?url=user/12
Then in your controller (index.php in this example), test for the url query param and if it exists parse it instead of the actual Server Request, as you would do normally.
I also do not want the above URL to be publically accessible. So, by using an IS_DEVELOPER define, which is true only for configured developer IP addresses, I can control who has access that special url.
If you are trying to debug specific pages, alternatively, you can set the NetBeans run configuration to:
http://project/
and debug your project, but you must run through your home page once and since the debugger is now active, just navigate to http://project/user/12 in your browser and NetBeans will debug at that entry point. I found passing through my home page every time a pain, so I use the technique above.
Hopefully that provides enough insight to work with your project. It has worked good for me and if you need more detail, just ask.
EDIT: Also, one can make the Run Configuration Project URL the complete url http://project/user/12 and leave the Index File and Arguments blank and that works too without any special code in controller. (tested in NetBeans 7.1). I think I will start using this method.