GithubHelp home page GithubHelp logo

autodesk-forge / forge-viewhubs Goto Github PK

View Code? Open in Web Editor NEW
25.0 7.0 16.0 26.19 MB

Build tree view of content: Using the jsTree library, this sample shows you how to build a basic tree view of Hubs, Projects, Folders and Items. Supports menus and reloading among other features

License: MIT License

C# 52.75% CSS 0.74% HTML 9.62% JavaScript 36.90%
csharp civil3d net-core autodesk-data-management autodesk-viewer autodesk-bim360

forge-viewhubs's Introduction

View models on hubs (BIM 360 or Fusion Team)

Platforms .NET License

oAuth2 Data-Management Viewer BIM-360

Intermediate

Description

This sample show a basic tree view with Hubs, Projects, Folders and Items. It does not use the ASP.NET native TreeView due its limitations, but the jsTree library, that have support for menus, reload, among other features. This sample is based on the Learn Forge tutorial.

The tree view will display personal enterprise (shared) hubs, with respective projects. For Civil 3D drawings with Alignments, the Alignment Design Check toolbar icon list aligments and compare its curves with a minimum radius value. The following image demonstrate a tipical tree view:

Thumbnail

thumbnail

Live version

forgedatamanagement.herokuapp.com

Setup

Prerequisites

  1. BIM 360 Account: (optional) must be Account Admin to add the app integration. Learn about provisioning.
  2. Forge Account: Learn how to create a Forge Account, activate subscription and create an app at this tutorial.
  3. Visual Studio: Either Community (Windows) or Code (Windows, MacOS).
  4. .NET Core basic knowledge with C#
  5. JavaScript basic knowledge with jQuery

Running locally

Clone this project or download it. It's recommended to install GitHub desktop. To clone it via command line, use the following (Terminal on MacOSX/Linux, Git Shell on Windows):

git clone https://github.com/Autodesk-Forge/forge-viewhubs

Visual Studio 2022 (Windows):

Right-click on the project, then go to Debug. Click on Open debug launch profiles UI. Adjust the settings as shown below.

Finally scroll down the same window to enable SSL and Anonymous Authentication. Make sure they are both checked.

Visual Code (Windows, MacOS):

Open the folder, at the bottom-right, select Yes and Restore. This restores the packages (e.g. Autodesk.Forge) and creates the launch.json file. See Tips & Tricks for .NET Core on MacOS.

ngrok

For webhooks service to send notifications to your localhost server, you may want to use ngrok. Check this link on how to configure ngrok. You can find more information on about ngrok here.

Environment variables

At the .vscode\launch.json, find the env vars and add your Forge Client ID, Secret and callback URL. Also define the ASPNETCORE_URLS variable. The end result should be as shown below:

"env": {
    "ASPNETCORE_ENVIRONMENT": "Development",
    "ASPNETCORE_URLS" : "http://localhost:3000",
    "FORGE_CLIENT_ID": "your id here",
    "FORGE_CLIENT_SECRET": "your secret here",
    "FORGE_CALLBACK_URL": "http://localhost:3000/api/forge/callback/oauth",
    "FORGE_WEBHOOK_URL": "your ngrok address", e.g https://34e2-105-27-239-221.in.ngrok.io 
},

Deployment

To deploy this application to Heroku, the Callback URL for Forge must use your .herokuapp.com address. After clicking on the button below, at the Heroku Create New App page, set your Client ID, Secret and Callback URL for Forge.

Deploy

Watch this video on how deploy samples to Heroku.

Further Reading

Documentation:

Tutorials:

Tips & Tricks

This sample uses .NET Core and works fine on both Windows and MacOS, see this tutorial for MacOS.

Troubleshooting

  1. Cannot see my BIM 360 projects: Make sure to provision the Forge App Client ID within the BIM 360 Account, learn more here. This requires the Account Admin permission.

  2. error setting certificate verify locations error: may happen on Windows, use the following: git config --global http.sslverify "false"

License

This sample is licensed under the terms of the MIT License. Please see the LICENSE file for full details.

Written by

Augusto Goncalves @augustomaia, Forge Partner Development

forge-viewhubs's People

Contributors

arrotech avatar augustogoncalves avatar cyrillef avatar jaylimboonkiat avatar joaomartins-callmejohn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

forge-viewhubs's Issues

Error : 400 - Invalid redirect_uri

Hi Augusto,
I'm new to Forge, all I did was download the csharp-example, change FORGE_CLIENT_ID and FORGE_CLIENT_SECRET. When I compile/run I get:
Oops
Error : 400 - Invalid redirect_uri
We're experiencing problems with the application configuration.
Connecting Application
Please try again later.
Then tried using the callback URL with my app, get the same message. Just using VS. Any suggestions?
Thanks,
Dan

Minimap location not correct

I tried using the minimap extension both through the demo and inside my own app but the output doesnt seem to be correct, I get a location in a nearby city. Also, when trying to use the geolocation extension activate(). The debug menu doesnt show up

This account doen't exist

Hi Augusto,

many thanks for this example.
I tried that and i faced a problem.
The response Status is Not Found. Errormessage = This account doesn't exist.

m_RestClient = new RestClient("https://developer.api.autodesk.com");
m_Request = new RestRequest("/hq/v1/accounts/{account_id}/users", Method.GET);
m_Request.AddParameter("account_id", CP.Forge.Utilities.Credentials.CompanyAccountID, ParameterType.UrlSegment);
m_Request.AddHeader("Authorization", "Bearer " + m_TokenResponse.Result.AccessToken);
m_Request.AddHeader("Content-Type", "application/json");
//request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = m_RestClient.Execute<CP.Forge.Utilities.AccessToken>(m_Request);

What is wrong.

I checked the BIM 360 account id several time and seems ok.

Cheers Jürgen

Application Configuration

I get error 400 invalid redirect uri. I've already defined the keys and my callback, but can't run the sample.

Which version of .NET Core?

I have tried 2.0.0 and 2.2.0 and they both give me many errors. I'm using VS2017 Community Edition.

One of the many errors:
1>Controllers\ModelDerivativeController.cs(23,28,23,31): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'Microsoft.AspNetCore' (are you missing an assembly reference?)

Thanks,
Joe

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.