Git Product home page Git Product logo

forge-configurator-inventor's Introduction

DEPRECATED

This repository has been deprecated and all its content was moved to the new one located here https://github.com/autodesk-platform-services/aps-configurator-inventor

Forge Configurator Inventor

Demo application showcasing Configuration with Design Automation for Inventor

thumbnail

Architecture

thumbnail

Prerequisites

Web Application

  1. .NET Core 3.1
  2. Node.js
    Important note: In Node.js even releases are stable, and odd-numbered versions are unstable. That's said we won't support or guarantee the work of the application using the odd-numbered Node.js versions. Currently the latest version we support is the even version v16.13.2. Unless version v18 will be released we are not supporting versions newer than v16.
  3. (recommended) Visual Studio Code with extensions:

App Bundles

  1. Autodesk Inventor 2021
  2. Visual Studio 2019

Run sample for the first time

  1. Clone repository

  2. Create a forge app at https://forge.autodesk.com/, and select Design Automation API and Data Management API in the APIs section thumbnail

  3. Enter https://localhost:5001 as the callback URL

  4. Note the Client ID and Client Secret generated

  5. Specify Forge credentials using one of the following approaches:
    a) Set environment variables FORGE_CLIENT_ID and FORGE_CLIENT_SECRET
    b) Set environment variables Forge__ClientId and Forge__ClientSecret
    c) Make a copy of appsettings.Local.template.json in the WebApplication directory named appsettings.Local.json and replace the <clientId> and <clientSecret> in it
    d) (not on dev machine) Modify appsettings.json (or appsettings.<ENVIRONMENT>.json) with the template mentioned in c)
    e) Set environment variable 'set NODE_ENV=development'

  6. Make a copy of InventorBinFolder.props.template in the top AppBundles folder named InventorBinFolder.props and replace the PATH_TO_YOUR_INVENTOR_BIN string in it with your actual Inventor bin folder path, for example: C:\Program Files\Autodesk\Inventor 2021\Bin

  7. (Optional) Choose network configuration for your application. By default polling is enabled as it offers an easier way to setup and run the application. This is OK for locally run applications and debugging. However in production using the new callback option is highly recommended to conserve resources. In order to enable the callback option modify the Publisher section of the appsettings.json file. Change "CompletionCheck" value from "Polling" to "Callback" and set "CallbackUrlBase" url to your server URL or ngrok tunnel URL for a locally run application. To run and debug callbacks locally please refer to the ngrok section

  8. (Optional) Specify if access should be limited in WebApplication\appsettings.json. Set Enabled to true or false, and populate the Domains and Addresses fields with comma delimited lists such as ["autodesk.com", "company.com"] and ["[email protected]", "[email protected]"]

  9. Open the forge-configurator-inventor.sln file with Visual Studio 2019 and build the solution thumbnail
    This will also generate the zip files of all the app bundles that the web app will need to upload to the Design Automation server
    thumbnail
    When building the solution, make sure that all those app bundles got generated successfully thumbnail
    Now we have to initialize things both on the Design Automation server and locally. In the terminal (in Visual Studio or outside) navigate to the WebApplication folder and run dotnet run initialize=true thumbnail
    Once the output reaches the Now listening on: https://localhost:5001 line just open that URL in your browser
    Next time you'll also be able to start the app from the Visual Studio debugger. In the Debug drop-down menu select forge-configurator-inventor and start debugging thumbnail This time your browser should open up automatically showing the correct URL

Build

  • Building the projects also installs required packages (this can take several minutes).

Web Application and App Bundles

  • Open the forge-configurator-inventor.sln file with Visual Studio 2019 and build the solution

Web Application Alone

  • From a command prompt, go to the WebApplication directory, and run dotnet build.

(Optional) Update the npm packages

  • If you are not running the Application for the first time, but rather getting an update, you may need to install npm packages that were added since your last successfull run:
  1. Using command line go to WebApplication/ClientApp and run npm install. See Adding npm package for more information.

Run The Web Application Without Debugging

Clear and load initial data during app launch time

  • Create initial data: from the WebApplication directory, run dotnet run initialize=true
  • Clear data: from the WebApplication directory, run dotnet run clear=true
  • Clear and then load initial data: from the WebApplication directory, run dotnet run initialize=true clear=true
  • When the app finishes the initialization process it remains running and expects client calls. You can leave it running and follow by opening the site or stop it and move to the the Debugging section

Run after initial data is created

  • From a command prompt, go to the WebApplication directory, and run dotnet run

Open site

  • Navigate to https://localhost:5001
    • You may need to refresh the browser after it launches if you see the error This site can't be reached
    • If you see the error Your Connection is not private, click Advanced and then Proceed to localhost (unsafe). This is due a development certificate being used.

Debug The Web Application With VS Code

  1. Make sure that application is fully initialized, before you start debugging session. Please see the Clear and load initial data
  2. Open the repository root folder in VS Code
  3. In the Run tab, select the Server/Client configuration and click the "Start Debugging" (arrow) button
    • Some browser errors are normal, see open site
    • Disregard C# errors related to AppBundles in VS Code

Run/Debug Tests

Backend

  • Note that running the tests clears initialization data, so you will either need to change forge credentials before running them, or run the initializer again afterward. See Clear and load initial data...
  1. From Visual Studio 2019
    • Open Test Explorer and select tests to run or debug
  2. From Visual Studio Code
    • Open a test file in the WebApplication.Tests directory and click on either Run Test or Debug Test above one of the methods decorated with the [Fact] attribute. Or, above the class declaration click on either Run All Tests or Debug All Tests
  3. From the command line, in either the root or WebApplication.Tests directory run dotnet test

Frontend

  1. In Visual Studio Code, on the Run tab, select the Debug Jest All configuration and click the "Start Debugging" (arrow) button
    • Note that once you run the tests they will only run again if they changed since the last time
  2. Alternatively, using the command line go to WebApplication/ClientApp and execute npm test

UI Tests

  • For UI tests we are using CodeCeptJs framework. All tests are stored in ClientApp/src/ui-tests/ and we filter all files end with *_test.js.
  • Set environment variables SDRA_USERNAME and SDRA_PASSWORD for Sign-in workflow. We are using Autodesk Account credentials for Sign-in.
  • Set "embedded" : true In appsettings.Local.json file mentioned in Run sample for the first time 5c)
    • Also you can create a .env file in the WebApplication/ClientApp directory to define the environment variables - for more details follow this link: https://www.npmjs.com/package/dotenv
  • Note that the server needs to be running for these tests
  1. From the WebApplication/ClientApp directory:
    • For all UI tests Run this command: npx codeceptjs run or npm run uitest.
    • For particular file you can use this command: npx codeceptjs run src/ui-tests/<test file name>

Backend

We are using the forge service on the backend https://forge.autodesk.com/

.NET Core

We are using the latest version of .NET Core (3.1 at the time of writing) https://dotnet.microsoft.com/download/dotnet-core/3.1

The project was initally created using the command dotnet new react

Forge Design Automation

https://forge.autodesk.com/en/docs/design-automation/v3/developers_guide/overview/

C# SDK https://github.com/Autodesk-Forge/forge-api-dotnet-design.automation

We are using the Inventor and Revit engines.

OSS

Used for storing your designs. For communication with Forge Design Automation

https://forge.autodesk.com/en/docs/data/v2/developers_guide/overview/

C# SDK https://github.com/Autodesk-Forge/forge-api-dotnet-client

Client app

React

https://reactjs.org/

Redux

https://redux.js.org/

We are using redux-thunk for complex and asynchronous operations https://github.com/reduxjs/redux-thunk

Redux DevTool

In index.js replace

const store = createStoreWithMiddleware(mainReducer);

with

const store = createStoreWithMiddleware(mainReducer, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__());

Autodesk HIG React

https://github.com/Autodesk/hig

Table is not part of todays React HIG implementation so we will use https://github.com/Autodesk/react-base-table

How to

Add npm package to project

We are using npm.

  1. Using command line go to WebApplication/ClientApp and run npm install <package>
    • Note that packages are normally installed as part of the build, but only if the npm_modules directory is not found. This means that when new packages are added, WebApplication/ClientApp/npm install needs to be run again manually by other users (who did not add the new package).

Manually run linter

  • For JavaScript code: npm run lint
  • For CSS: npm run lint-css

Deploy

  • For an advanced example of CI/CD on AWS, see AWS-CICD
  • For a simple method of deploying to Azure, see Publish a Web app to Azure App Service using Visual Studio
    • First change WebApplication.Program.cs by removing the UseKestrel() statement
    • You will need to change the callback in your forge app to match the URL you deploy to.
  • Example of the real-life deploy of an FDA as an App Service

Project file zip encoding

  • Uploading your project file can cause the error "Project name or assembly contains unsupported characters". This problem typically happens when you use non Latin characters in your project file names and the zip file does not use UTF-8 encoding for the project file names.

  • This issue can be fixed by forcing your zip program of choice to zip the file with the UTF-8 encoding

  • For 7-zip, you can follow these simple steps:

    • After selecting your files for zipping, right-click them and select 7-zip from the context menu
    • Select option "Add to archive..."
    • On the very bottom you can see a text field labelled "Parameters:"
    • Write "cu" without the quotes into that field
    • Press ok
    • Name your resulting zip file
  • For more information on this issue please refer to the FDA troubleshooting page

Use ngrok for localhost callbacks

  • If you choose webhook callback network configuration for the application, you will need a way for the callbacks to get from the FDA servers to your local machine.
  • One of the tools that can assist you with this task is ngrok https://ngrok.com/
  • These steps should help you to set up an ngrok tunnel to your localhost:
    • Create a free ngrok account
    • Download the ngrok executable from https://dashboard.ngrok.com/get-started/setup
    • Unzip the executable
    • (Optional) put the path to the ngrok executable in your system path to make it accessible from everywhere
    • Notice section 2. of the download page. This contains your credentials and full authenticate command for you to copy paste
    • Use the full authentication command from previous step - this only needs to be done once
    • Run ngroc with the format of ngrok http port and set the port number the web application uses on your local machine
    • With default settings the command would look like this: ngrok http 5001
    • You are now ready to use and debug callbacks locally
    • If you experience issues running ngrok tunnel with the web application using https settings, the simple workaround is to switch the app to http mode (only for local use).
    • In order to set the callback URL for local development it is recomended to create an appsettings.Local.json file in the WebApplication directory (if you don't have it already) and then put following settings into it:
      {
        "Publisher": {
            "CompletionCheck": "Callback",
            "CallbackUrlBase": "<YOUR NGROK URL>"
        }
      }

Embedded mode

You can read about embedded mode here

forge-configurator-inventor's People

Contributors

adamenagy avatar ake133c avatar andersco avatar dc41f avatar dependabot[bot] avatar erymski avatar erymski-adsk avatar feravasica avatar houmicek avatar hradilm avatar mivasi avatar msimko81 avatar obergrd avatar pavelholecek avatar slavikz-centrum avatar t-hurtm avatar vasicem 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

forge-configurator-inventor's Issues

Not able to load Project List

Hi Good day, I have followed the setup described but currently am not able to load any projects.
Meaning, on the project tab the list is empty and I am seeing error messages like
"You don't have any drawings in your package."

Is there anything I am doing wrong, or how should I make sure the app sees the projects.

I am able to access the projects in the appsettings.json from my browser and can download them but I am not able to load them in the system.
please assist.
Thanks

Question- 3D DWG export

Hello,

I have a question which may be solved by someone who has more experience than I do.

I essentially want to be able to export a 3D DWG of my model. This DWG should also update as parameters change. Any help would be greatly appreciated.

Question

Hi, I'm looking for sample but more advance connected with Autodesk Vault. Configurator should now if duplicate part / assembly exist in Vault, then it should be reused. If part not exist in Vault, then part should get new name base on Vault schema names. Do you know any sample like that or are you able to draw a big picture of architecture - how drawing automation can connect to Vault during changes?

A bug in the model switcher in the toolbar

Hi, guys,

I've found a small bug. Active project in the ProjectAccountSwitcher component doesn't want to change in some cases.

  1. Change the active model using ProjectAccountSwitcher
  2. Go to the Projects tab
  3. Click on some project.

Expected: the active model is changed in the application toolbar, but it remains the same.

It could be fixed something like this as a workaround:

...
import { getActiveProject } from "../reducers/mainReducer";
...
export class ProjectSwitcher extends Component {
...
    render() {
        return (
            <ProjectAccountSwitcher
                defaultProject={this.props.projectList.activeProjectId}
                activeProject={null}
                activeLabel={this.props.activeProject?.label} // <- added this line
                projects={this.props.projectList.projects}
                projectTitle="Projects"
                onChange={this.onProjectChange}
            />
        );
    }
}

export default connect(function (store){
    return {
      projectList: store.projectList,
      activeProject: getActiveProject(store) // <- and this line
    };
  }, { fetchProjects, fetchParameters, updateActiveProject, updateActiveTabIndex, addLog, invalidateDrawing } )(ProjectSwitcher);

Or fix the ProjectAccountSwitcher component

Can not upload zip or ipt any file

Hello!When i try to upload ipt file got this error:System.Net.Http.HttpRequestException: 'The server returned the non-success status code 400 (Bad Request).
More error details:
{"activityId":["The activity FcuaA6cCAKd9jv7vmVBAcG8bR9NUZgBA.AdoptProject+alpha could not be found (Parameter 'activityId')"]}.'

I think design automation can not create or find activityId
screen1
await ProjectWork.AdoptAsync(_projectInfo,signedUploadedUrl) method can not give success response and exception image is under below
screen2

UserResolver.AnonymousBucket is not automatically created

When running the application locally, an exception is thrown due to a bucket not existing in OSS. After attaching the debugger, I was able to see that it is when trying to access the AnonymousBucket. The UserResolver.GetBucketAsync() has an argument for whether or not to try to create the requested bucket, but this logic is not used in the case of the AnonymousBucket. After creating this bucket manually, the exception is no longer thrown.

When i open to configurator from mobile device,Viewer's right side is white empty

Hello everyone!Hope you can help to me!My problem is actually mobile device view and view's problem is about to when first time open to my configurator website,A white space is being created on the right side of the viewer area.I don not know why and i tried to CSS's media query codes and something like these.But can not solve this view's problem.And there is a video

Meanwhile, i removed to some components on React view ui as you can see.But css or js codes did not change so much

Screen_Recording_20230510_165011_Chrome.1.mp4

Embedded Mode truncating URL

Running the embedded mode the following url was passed in: https://subseaxd-staging.mcdermott.com/api/pri/v1/configurator/project/600a6937e498fd4f20e666ec?projectId=-M73LyZXYLoHZk6j-ms3&subProjectId=-M73MRx2visv8-KjjmWX&assetId=-MQt6umRXpy29G1NyOMF

However the console reported the following:
2021-02-02 13:50:18.707 +00:00 [INF] downloading parameters from https://subseaxd-staging.mcdermott.com/api/pri/v1/configurator/project/600a6937e498fd4f20e666ec?projectId=-M73LyZXYLoHZk6j-ms3

What would cause this url to be truncated? It appears to be truncating at the &.

Unable to run App From Source

Hi,

I'm trying to run the app from the source but not able to run successfully. I followed all the instructions mentioned on GitHub. It doesn't do anything after the below line for a long time:
image

Any help is appreciated.

Not an issue - seeking help

Hi. Forgive me if this is in the wrong section, but I have a few questions that may be simple to answer for someone with more experience.

  1. What files must I modify to change the header to include my own styling?
  2. How can I add a "export as .stp" and "export as .dwg" option?

Thanks so much,
Paulo

Cannot create OSS bucket. Repeating

Trying to build for the first time and getting the error "Cannot create OSS bucket. Repeating" a few times then crashes. Curious if anyone was able to resolve this issue.
System.AggregateException: One or more errors occurred. (Error calling CreateBucket: {"reason":"Bucket already exists"})
---> Autodesk.Forge.Client.ApiException: Error calling CreateBucket: {"reason":"Bucket already exists"}

Azure deployment problem

https://stackoverflow.com/questions/69090973/autodesk-forge-configurator-inventor-azure-deployment-problem

I have troubles with deploying an app to Azure.

I started with https://github.com/Autodesk-Forge/forge-configurator-inventor repo. I managed to run it locally with no errors. I am able to login, upload my own zipped files, change parameters, export pdf and download it. Everything is fine. Now i want to publish app to azure.

App is currently running so You can check it out: https://pjk-config.azurewebsites.net

WHAT IS WRONG: I cannot upload any models after login. No error is displayed. If I make change in wrench or wheel model and update it, I won't happened either.

What I did:

created azure account,
changed callback url to my app (in my situation: "https://pjk-config.azurewebsites.net/"),
I changed WebApplication.Program.cs by removing the UseKestrel() statement ( please check that)
{
webBuilder.UseStartup();
var port = Environment.GetEnvironmentVariable("PORT");
// If deployed to a service like Heroku, need to listen on port defined in the environment, not the default one
if (!string.IsNullOrEmpty(port))
{
webBuilder.UseUrls("http://*:" + port);
Log.Logger.Information($"PORT environment variable defined to:{port}");
}
});
appsettings:

inviteonlymode - false
embedded mode - false
publisher settings: (but I see polling in output so I think something is missing)
"CompletionCheck": "Callback",
"CallbackUrlBase": "https://pjk-config.azurewebsites.net"

I deployed through VS 2019 with WebApplication right click - publish using this reference: https://docs.microsoft.com/en-us/visualstudio/deployment/quickstart-deploy-to-azure?view=vs-2019
If you need any additional info just let me know. I am fighting with this almost 30 days by my own. I am beginner and this is my first question on this page so I apologize for lack of precise information about my problem. Just tell me what you need and I will send it over.

spa development server

Hi, i get the below error, when i try to initialize:

couldn't start the spa development server with command 'npm start'

Thanks
Gopi

Text parameters quotas

Hello, is it possible to add automatic quotas to user text parameters values? How should I start? And help?

Current file ParametersExtractor.cs :
https://github.com/Autodesk-Forge/forge-configurator-inventor/blob/960c81a246cfa1d6f54296f3f729f748a6fbfd33/AppBundles/PluginUtilities/ParametersExtractor.cs

I should prevent errors and problems with text parameters changes.

Forum post i related to :
https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/error-when-changing-text-parameter-on-design-automation-api/td-p/10347153
and
https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/using-quote-marks-in-a-string-variable/m-p/7855301#M81978

I think everyone would benefit from this.

Cannot Sign In After Build/Run

I was able to build and run this application but I'm not able to sign in and upload my own models. I have already set invite only mode to false. I also tried setting it to true and adding my credentials to the Addresses array. Both have the same results (see attached image). I have very little experience with web applications so I'm sure that I did something wrong. Any ideas what it could be?

Forge Error

I do not know how to add projects.

Maybe a stupid question, but I'm new to this field. Everything is running, but I can't find how to add files or projects to this application, please tell me

Changing and reading the bom contents error

I found fault around here and here . Does not appear when compiling via visual studio, but detected as an error on vs code. The second problem can be solved simply by adding tostring at the end. But i don't know how to solve the first problem
image
image

Also, although I change the columns and compile the project, the incoming data does not change.

Download DWG

What should be the correct approach to add an option for exporting DWG from IDW?

Create SVF Plugin

Unable to convert to SVF with the given code in CreateSvfAutomation.cs. Getting the error " The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))". Is there any update with the code?

Always provide link to WorkItem report

At the moment you only get a link to the report if the WorkItem failed to update the model.
However, the update being "successful" does not mean it was "as expected" or "correct".
Best thing is to make the report always available.

how to get started with my own inventor files?

Hey,

i have some problems to get my own inventor files up and running.
I tried to adjust the /appsettings.json
"DefaultProjects": { "Projects": [ { "Url": "https://sdra-default-projects.s3.us-west-2.amazonaws.com/WrenchForm.zip", "TopLevelAssembly": "Wrench.iam", "Name": "Wrench" }, { "Url": "https://sdra-default-projects.s3.us-west-2.amazonaws.com/Wheel_multi_IDW.zip", "TopLevelAssembly": "WheelAssembly.iam", "Name": "Wheel" } ] },

and replaced the links, TopLevelAssembly and Names with my files but they never appear in the Webapp!

How can I get this to work?
Thanks

Formatting Error in Json not reported

Using the Embed = true if the json supplied is not formatted correctly the configurator errors out but nothing is reported in the console and an error report is not generated.

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.