├── thumbnail.gif ├── media ├── inventor │ └── references.png ├── webapp │ ├── ngrok_setup.png │ ├── visual_code_restore.png │ └── visual_studio_settings.png ├── autocad │ └── nuget_autocad.png └── revit │ └── reference_path.png ├── sample files ├── max_sample_file.max ├── revit_sample_file.rvt ├── autocad_sample_file.dwg └── inventor_sample_file.ipt ├── forgesample ├── appsettings.json ├── wwwroot │ ├── bundles │ │ ├── UpdateDWGParam.zip │ │ ├── UpdateIPTParam.zip │ │ ├── UpdateMAXParam.zip │ │ └── UpdateRVTParam.zip │ ├── index.html │ └── js │ │ └── ForgeDesignAutomation.js ├── appsettings.Development.json ├── forgesample.csproj ├── Program.cs ├── Startup.cs ├── Controllers │ ├── OAuthController.cs │ └── DesignAutomationController.cs └── README.md ├── UpdateMAXParam ├── packages.config ├── UpdateMAXParam.bundle │ └── PackageContents.xml ├── Properties │ └── AssemblyInfo.cs ├── README.md ├── UpdateMAXParam.csproj └── Command.cs ├── updateRVTParam ├── packages.config ├── UpdateRVTParam.bundle │ ├── PackageContents.xml │ └── Contents │ │ └── Autodesk.Forge.Sample.DesignAutomation.Revit.addin ├── Properties │ └── AssemblyInfo.cs ├── README.md ├── UpdateRVTParam.csproj └── Commands.cs ├── UpdateIPTParam ├── UpdateIPTParam.Inventor.addin ├── UpdateIPTParam.X.manifest ├── PackageContents.xml ├── Properties │ └── AssemblyInfo.cs ├── PluginServer.cs ├── README.md ├── SampleAutomation.cs └── UpdateIPTParam.csproj ├── UpdateDWGParam ├── packages.config ├── UpdateDWGParam.bundle │ └── PackageContents.xml ├── Properties │ └── AssemblyInfo.cs ├── README.md ├── UpdateDWGParam.csproj └── Commands.cs ├── README.md ├── LICENSE ├── designautomation.sln └── .gitignore /thumbnail.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk-Forge/learn.forge.designautomation/HEAD/thumbnail.gif -------------------------------------------------------------------------------- /media/inventor/references.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk-Forge/learn.forge.designautomation/HEAD/media/inventor/references.png -------------------------------------------------------------------------------- /media/webapp/ngrok_setup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk-Forge/learn.forge.designautomation/HEAD/media/webapp/ngrok_setup.png -------------------------------------------------------------------------------- /media/autocad/nuget_autocad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk-Forge/learn.forge.designautomation/HEAD/media/autocad/nuget_autocad.png -------------------------------------------------------------------------------- /media/revit/reference_path.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk-Forge/learn.forge.designautomation/HEAD/media/revit/reference_path.png -------------------------------------------------------------------------------- /sample files/max_sample_file.max: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk-Forge/learn.forge.designautomation/HEAD/sample files/max_sample_file.max -------------------------------------------------------------------------------- /sample files/revit_sample_file.rvt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk-Forge/learn.forge.designautomation/HEAD/sample files/revit_sample_file.rvt -------------------------------------------------------------------------------- /media/webapp/visual_code_restore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk-Forge/learn.forge.designautomation/HEAD/media/webapp/visual_code_restore.png -------------------------------------------------------------------------------- /sample files/autocad_sample_file.dwg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk-Forge/learn.forge.designautomation/HEAD/sample files/autocad_sample_file.dwg -------------------------------------------------------------------------------- /sample files/inventor_sample_file.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk-Forge/learn.forge.designautomation/HEAD/sample files/inventor_sample_file.ipt -------------------------------------------------------------------------------- /media/webapp/visual_studio_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk-Forge/learn.forge.designautomation/HEAD/media/webapp/visual_studio_settings.png -------------------------------------------------------------------------------- /forgesample/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Warning" 5 | } 6 | }, 7 | "AllowedHosts": "*" 8 | } 9 | -------------------------------------------------------------------------------- /forgesample/wwwroot/bundles/UpdateDWGParam.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk-Forge/learn.forge.designautomation/HEAD/forgesample/wwwroot/bundles/UpdateDWGParam.zip -------------------------------------------------------------------------------- /forgesample/wwwroot/bundles/UpdateIPTParam.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk-Forge/learn.forge.designautomation/HEAD/forgesample/wwwroot/bundles/UpdateIPTParam.zip -------------------------------------------------------------------------------- /forgesample/wwwroot/bundles/UpdateMAXParam.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk-Forge/learn.forge.designautomation/HEAD/forgesample/wwwroot/bundles/UpdateMAXParam.zip -------------------------------------------------------------------------------- /forgesample/wwwroot/bundles/UpdateRVTParam.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk-Forge/learn.forge.designautomation/HEAD/forgesample/wwwroot/bundles/UpdateRVTParam.zip -------------------------------------------------------------------------------- /UpdateMAXParam/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /forgesample/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Error", 5 | "System": "Error", 6 | "Microsoft": "Error" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /updateRVTParam/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /UpdateIPTParam/UpdateIPTParam.Inventor.addin: -------------------------------------------------------------------------------- 1 | 2 | 3 | {c803510f-2486-4dd7-b477-a236127d25ed} 4 | {c803510f-2486-4dd7-b477-a236127d25ed} 5 | UpdateIPTParam 6 | a UpdateIPTParam 7 | UpdateIPTParam.dll 8 | -------------------------------------------------------------------------------- /UpdateDWGParam/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /UpdateIPTParam/UpdateIPTParam.X.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /forgesample/forgesample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | netcoreapp3.1 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /updateRVTParam/UpdateRVTParam.bundle/PackageContents.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /updateRVTParam/UpdateRVTParam.bundle/Contents/Autodesk.Forge.Sample.DesignAutomation.Revit.addin: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Modify Window Parameters 5 | Autodesk.Forge.Sample.DesignAutomation.Revit.Commands 6 | Revit for Design Automation 7 | Revit for Design Automation 8 | AlwaysVisible 9 | .\UpdateRVTParam.dll 10 | 000BD853-36E4-461f-9171-C5ACEDA4E723 11 | ADSK 12 | Autodesk, Inc, www.autodesk.com 13 | 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # learn.forge.designautomation 2 | 3 | ## Description 4 | 5 | This sample is (will be) part of the [Learn Forge](http://learnforge.autodesk.io) tutorials. 6 | 7 | It includes 5 modules: 8 | 9 | - .NET Framework plugins for **[AutoCAD](UpdateDWGParam/)**, **[Inventor](UpdateIPTParam/)**, **[Revit](UpdateRVTParam/)** and **[3dsMax](UpdateMAXParam/)**. See each readme for plugin details. 10 | - .NET Core web interface to invoke Design Automation v3 and show results. See [readme](forgesample/) for more information. 11 | 12 | The `designautomation.sln` include all 4 bundles and the webapp, you may unload those project that are not of interest. The `BUILD` action copy all files to the bundle folder, generate a .zip and copy to the webapp folder. It requires [7-zip](https://www.7-zip.org/) tool. 13 | -------------------------------------------------------------------------------- /forgesample/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore; 2 | using Microsoft.AspNetCore.Hosting; 3 | using Autodesk.Forge.Core; 4 | using Autodesk.Forge.DesignAutomation; 5 | 6 | namespace forgeSample.Controllers 7 | { 8 | public class Program 9 | { 10 | public static void Main(string[] args) 11 | { 12 | CreateHostBuilder(args).ConfigureAppConfiguration(builder => 13 | { 14 | builder.AddForgeAlternativeEnvironmentVariables(); 15 | }).ConfigureServices((hostContext, services) => 16 | { 17 | services.AddDesignAutomation(hostContext.Configuration); 18 | }).Build().Run(); 19 | } 20 | 21 | public static IWebHostBuilder CreateHostBuilder(string[] args) => 22 | WebHost.CreateDefaultBuilder(args) 23 | .UseStartup(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /UpdateDWGParam/UpdateDWGParam.bundle/PackageContents.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /UpdateIPTParam/PackageContents.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Forge Platform 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /UpdateMAXParam/UpdateMAXParam.bundle/PackageContents.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /forgesample/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Builder; 2 | using Microsoft.AspNetCore.Hosting; 3 | using Microsoft.AspNetCore.Mvc; 4 | using Microsoft.Extensions.DependencyInjection; 5 | using Microsoft.Extensions.Hosting; 6 | 7 | namespace forgeSample 8 | { 9 | public class Startup 10 | { 11 | // This method gets called by the runtime. Use this method to add services to the container. 12 | // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 13 | public void ConfigureServices(IServiceCollection services) 14 | { 15 | services.AddMvc(options => options.EnableEndpointRouting = false).SetCompatibilityVersion(CompatibilityVersion.Version_3_0).AddNewtonsoftJson(); 16 | services.AddSignalR().AddNewtonsoftJsonProtocol(opt=> { 17 | opt.PayloadSerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore; 18 | }); 19 | } 20 | 21 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 22 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 23 | { 24 | app.UseRouting(); 25 | app.UseEndpoints(routes => 26 | { 27 | routes.MapHub("/api/signalr/designautomation"); 28 | }); 29 | 30 | app.UseFileServer(); 31 | app.UseMvc(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /UpdateDWGParam/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("learnforge.autodesk.io")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Autodesk Forge")] 13 | [assembly: AssemblyCopyright("Copyright © 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f17bdce4-8cd6-4daf-b57a-3a4b8137d736")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /UpdateIPTParam/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("UpdateIPTParam")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Autodesk Inc.")] 11 | [assembly: AssemblyProduct("UpdateIPTParam")] 12 | [assembly: AssemblyCopyright("Copyright © Autodesk Inc. 2019")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(true)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("f1c9d7e2-53a8-4e4e-af9e-931ca891715d")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /updateRVTParam/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("learnforge.autodesk.io")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Autodesk")] 12 | [assembly: AssemblyProduct("learnforge.autodesk.io")] 13 | [assembly: AssemblyCopyright("Copyright © 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("9a402f71-d386-4e2d-9582-1e99ce87206d")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /UpdateMAXParam/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("3ds Max sample plugin for learnforge.autodesk.io")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Autodesk Developer Network Samples")] 12 | [assembly: AssemblyProduct("Autodesk Forge")] 13 | [assembly: AssemblyCopyright("Copyright © Autodesk Developer Network Samples 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f4551f57-a240-4e18-a1c9-9e8f2134f10d")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("2019.0.0.0")] 36 | [assembly: AssemblyFileVersion("2019.0.0.0")] 37 | -------------------------------------------------------------------------------- /updateRVTParam/README.md: -------------------------------------------------------------------------------- 1 | # learn.forge.designautomation - Revit 2 | 3 | ![Platforms](https://img.shields.io/badge/Plugins-Windows-lightgray.svg) 4 | ![.NET](https://img.shields.io/badge/.NET%20Framework-4.7-blue.svg) 5 | [![Revit](https://img.shields.io/badge/Revit-2019-lightblue.svg)](http://developer.autodesk.com/) 6 | 7 | ![Basic](https://img.shields.io/badge/Level-Basic-blue.svg) 8 | 9 | # Description 10 | 11 | Revit plugin that updates the `width` and `height` of a Windows Family Instance. 12 | 13 | # Setup 14 | 15 | ## Prerequisites 16 | 17 | 1. **Visual Studio** 2017 18 | 2. **Revit** 2019 required to compile changes into the plugin 19 | 3. **7z zip** requires to create the bundle ZIP, [download here](https://www.7-zip.org/) 20 | 21 | ## References 22 | 23 | This Revit plugin requires **RevitAPI** and **DesignAutomationBridge** references. The `Reference Paht` option should point to the folder. 24 | 25 | ![](../media/revit/reference_path.png) 26 | 27 | ## Build 28 | 29 | Under **Properties**, at **Build Event** page, the following `Post-build event command line` will copy the DLL into the `\UpdateRVTParam.bundle/Content\` folder, create a `.ZIP` (using [7z](https://www.7-zip.org/)) and copy to the Webapp folder. 30 | 31 | ``` 32 | xcopy /Y /F $(TargetDir)*.dll $(ProjectDir)UpdateRVTParam.bundle\Contents\ del /F $(ProjectDir)..\forgesample\wwwroot\bundles\UpdateRVTParam.zip "C:\Program Files\7-Zip\7z.exe" a -tzip $(ProjectDir)../forgesample/wwwroot/bundles/UpdateRVTParam.zip $(ProjectDir)UpdateRVTParam.bundle\ -xr0!*.pdb 33 | ``` 34 | 35 | # Further Reading 36 | 37 | - [My First Revit Plugin](https://knowledge.autodesk.com/support/revit-products/learn-explore/caas/simplecontent/content/my-first-revit-plug-overview.html) 38 | - [Revit Developer Center](https://www.autodesk.com/developer-network/platform-technologies/revit) 39 | 40 | ## License 41 | 42 | This sample is licensed under the terms of the [MIT License](http://opensource.org/licenses/MIT). Please see the [LICENSE](LICENSE) file for full details. 43 | 44 | ## Written by 45 | 46 | Naveen Kumar, [Forge Partner Development](http://forge.autodesk.com) -------------------------------------------------------------------------------- /UpdateIPTParam/PluginServer.cs: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Autodesk, Inc. All rights reserved 3 | // Written by Forge Partner Development 4 | // 5 | // Permission to use, copy, modify, and distribute this software in 6 | // object code form for any purpose and without fee is hereby granted, 7 | // provided that the above copyright notice appears in all copies and 8 | // that both that copyright notice and the limited warranty and 9 | // restricted rights notice below appear in all supporting 10 | // documentation. 11 | // 12 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 13 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 14 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 15 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 16 | // UNINTERRUPTED OR ERROR FREE. 17 | ///////////////////////////////////////////////////////////////////// 18 | 19 | using System; 20 | using System.Diagnostics; 21 | using System.Reflection; 22 | using System.Runtime.InteropServices; 23 | using Inventor; 24 | 25 | namespace UpdateIPTParam 26 | { 27 | [Guid("c803510f-2486-4dd7-b477-a236127d25ed")] 28 | public class PluginServer : ApplicationAddInServer 29 | { 30 | // Inventor application object. 31 | private InventorServer _inventorServer; 32 | 33 | public dynamic Automation { get; private set; } 34 | 35 | public void Activate(ApplicationAddInSite addInSiteObject, bool firstTime) 36 | { 37 | Trace.TraceInformation(": UpdateIPTParam (" + Assembly.GetExecutingAssembly().GetName().Version.ToString(4) + "): initializing... "); 38 | 39 | // Initialize AddIn members. 40 | _inventorServer = addInSiteObject.InventorServer; 41 | Automation = new SampleAutomation(_inventorServer); 42 | } 43 | 44 | public void Deactivate() 45 | { 46 | Trace.TraceInformation(": UpdateIPTParam: deactivating... "); 47 | 48 | // Release objects. 49 | Marshal.ReleaseComObject(_inventorServer); 50 | _inventorServer = null; 51 | 52 | GC.Collect(); 53 | GC.WaitForPendingFinalizers(); 54 | } 55 | 56 | public void ExecuteCommand(int CommandID) 57 | { 58 | // obsolete 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /UpdateIPTParam/README.md: -------------------------------------------------------------------------------- 1 | # learn.forge.designautomation - Inventor 2 | 3 | ![Platforms](https://img.shields.io/badge/Plugins-Windows-lightgray.svg) 4 | ![.NET](https://img.shields.io/badge/.NET%20Framework-4.7-blue.svg) 5 | [![Inventor](https://img.shields.io/badge/Inventor-2019-lightblue.svg)](http://developer.autodesk.com/) 6 | 7 | ![Basic](https://img.shields.io/badge/Level-Basic-blue.svg) 8 | 9 | # Description 10 | 11 | Inventor plugin that updates the `width` and `height` param of a Part. 12 | 13 | # Setup 14 | 15 | ## Prerequisites 16 | 17 | 1. **Visual Studio** 2017 18 | 2. **Inventor** 2019 required to compile changes into the plugin 19 | 3. **7z zip** requires to create the bundle ZIP, [download here](https://www.7-zip.org/) 20 | 21 | ## References 22 | 23 | This Inventor plugin requires **Autodesk.Inventor.Interop** reference, which should resolve from the system GAC. If not, right-click on **References**, then **Add** > **References**, then add it from the follwing folder: `C:\Program Files\Autodesk\Inventor 2019\Bin\Public Assemblies`. 24 | 25 | ![](../media/inventor/references.png) 26 | 27 | ## Build 28 | 29 | Under **Properties**, at **Build Event** page, the following `Post-build event command line` will copy the DLL into the `\UpdateIPTParam.bundle/Content\` folder, create a `.ZIP` (using [7z](https://www.7-zip.org/)) and copy to the Webapp folder. 30 | 31 | ``` 32 | xcopy /Y /F $(TargetDir)*.dll $(ProjectDir)UpdateIPTParam.bundle\Contents\ del /F $(ProjectDir)..\forgesample\wwwroot\bundles\UpdateIPTParam.zip "C:\Program Files\7-Zip\7z.exe" a -tzip $(ProjectDir)../forgesample/wwwroot/bundles/UpdateIPTParam.zip $(ProjectDir)UpdateIPTParam.bundle\ -xr0!*.pdb 33 | ``` 34 | 35 | ## Debug Locally 36 | 37 | Please review this section of the [My First Plugin Tutorial](https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/simplecontent/content/lesson-2-programming-overview-autodesk-inventor.html). 38 | 39 | # Further Reading 40 | 41 | - [My First Inventor Plugin](https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/simplecontent/content/my-first-inventor-plug-overview.html) 42 | - [Inventor Developer Center](https://www.autodesk.com/developer-network/platform-technologies/inventor) 43 | 44 | ## License 45 | 46 | This sample is licensed under the terms of the [MIT License](http://opensource.org/licenses/MIT). Please see the [LICENSE](LICENSE) file for full details. 47 | 48 | ## Written by 49 | 50 | Chandra Shekar, [Forge Partner Development](http://forge.autodesk.com) -------------------------------------------------------------------------------- /UpdateDWGParam/README.md: -------------------------------------------------------------------------------- 1 | # learn.forge.designautomation - AutoCAD 2 | 3 | ![Platforms](https://img.shields.io/badge/Plugins-Windows-lightgray.svg) 4 | ![.NET](https://img.shields.io/badge/.NET%20Framework-4.7-blue.svg) 5 | [![AutoCAD](https://img.shields.io/badge/AutoCAD-2019-lightblue.svg)](http://developer.autodesk.com/) 6 | 7 | ![Basic](https://img.shields.io/badge/Level-Basic-blue.svg) 8 | 9 | # Description 10 | 11 | AutoCAD plugin that updates the `width` and `height` of a Dynamic Block. 12 | 13 | # Setup 14 | 15 | ## Prerequisites 16 | 17 | 1. **Visual Studio** 2017 18 | 2. **AutoCAD** 2019 required to compile changes into the plugin 19 | 3. **7z zip** requires to create the bundle ZIP, [download here](https://www.7-zip.org/) 20 | 21 | ## References 22 | 23 | This AutoCAD plugin requires **AcCoreMgd** and **AcDbMgd** references, which should restore from NuGet. If not, right-click on **References**, then **Manage NuGet Packages**, search for _AutoCAD.NET_ and add `AutoCAD.NET Core`. 24 | 25 | ![](../media/autocad/nuget_autocad.png) 26 | 27 | ## Build 28 | 29 | Under **Properties**, at **Build Event** page, the following `Post-build event command line` will copy the DLL into the `\UpdateDWGParam.bundle/Content\` folder, create a `.ZIP` (using [7z](https://www.7-zip.org/)) and copy to the Webapp folder. 30 | 31 | ``` 32 | xcopy /Y /F $(TargetDir)*.dll $(ProjectDir)UpdateDWGParam.bundle\Contents\ del /F $(ProjectDir)..\forgesample\wwwroot\bundles\UpdateDWGParam.zip "C:\Program Files\7-Zip\7z.exe" a -tzip $(ProjectDir)../forgesample/wwwroot/bundles/UpdateDWGParam.zip $(ProjectDir)UpdateDWGParam.bundle\ -xr0!*.pdb 33 | ``` 34 | 35 | ## Debug Locally 36 | 37 | Please review this section of the [My First Plugin Tutorial](https://knowledge.autodesk.com/support/autocad/learn-explore/caas/simplecontent/content/lesson-4-debugging-your-code-for-my-first-autocad-plug.html). The plugin should load and work on AutoCAD 2019 desktop. 38 | 39 | To better emulate the Design Automation approach, it's better to debug with AutoCAD Console. [This blog post describes how to use it](https://adndevblog.typepad.com/autocad/2012/04/getting-started-with-accoreconsole.html). 40 | 41 | # Further Reading 42 | 43 | - [My First AutoCAD Plugin](https://knowledge.autodesk.com/support/autocad/learn-explore/caas/simplecontent/content/my-first-autocad-plug-overview.html) 44 | - [AutoCAD Developer Center](https://www.autodesk.com/developer-network/platform-technologies/autocad) 45 | 46 | ## License 47 | 48 | This sample is licensed under the terms of the [MIT License](http://opensource.org/licenses/MIT). Please see the [LICENSE](LICENSE) file for full details. 49 | 50 | ## Written by 51 | 52 | Madhukar Moogala [@galakar](https://twitter.com/galakar), [Forge Partner Development](http://forge.autodesk.com) -------------------------------------------------------------------------------- /forgesample/Controllers/OAuthController.cs: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Autodesk, Inc. All rights reserved 3 | // Written by Forge Partner Development 4 | // 5 | // Permission to use, copy, modify, and distribute this software in 6 | // object code form for any purpose and without fee is hereby granted, 7 | // provided that the above copyright notice appears in all copies and 8 | // that both that copyright notice and the limited warranty and 9 | // restricted rights notice below appear in all supporting 10 | // documentation. 11 | // 12 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 13 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 14 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 15 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 16 | // UNINTERRUPTED OR ERROR FREE. 17 | ///////////////////////////////////////////////////////////////////// 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | using System.Linq; 22 | using System.Threading.Tasks; 23 | using Microsoft.AspNetCore.Mvc; 24 | using Autodesk.Forge; 25 | 26 | namespace forgeSample.Controllers 27 | { 28 | [ApiController] 29 | public class OAuthController : ControllerBase 30 | { 31 | // As both internal & public tokens are used for all visitors 32 | // we don't need to request a new token on every request, so let's 33 | // cache them using static variables. Note we still need to refresh 34 | // them after the expires_in time (in seconds) 35 | private static dynamic InternalToken { get; set; } 36 | 37 | /// 38 | /// Get access token with internal (write) scope 39 | /// 40 | public static async Task GetInternalAsync() 41 | { 42 | if (InternalToken == null || InternalToken.ExpiresAt < DateTime.UtcNow) 43 | { 44 | InternalToken = await Get2LeggedTokenAsync(new Scope[] { Scope.BucketCreate, Scope.BucketRead, Scope.BucketDelete, Scope.DataRead, Scope.DataWrite, Scope.DataCreate, Scope.CodeAll }); 45 | InternalToken.ExpiresAt = DateTime.UtcNow.AddSeconds(InternalToken.expires_in); 46 | } 47 | 48 | return InternalToken; 49 | } 50 | 51 | /// 52 | /// Get the access token from Autodesk 53 | /// 54 | private static async Task Get2LeggedTokenAsync(Scope[] scopes) 55 | { 56 | TwoLeggedApi oauth = new TwoLeggedApi(); 57 | string grantType = "client_credentials"; 58 | dynamic bearer = await oauth.AuthenticateAsync( 59 | GetAppSetting("FORGE_CLIENT_ID"), 60 | GetAppSetting("FORGE_CLIENT_SECRET"), 61 | grantType, 62 | scopes); 63 | return bearer; 64 | } 65 | 66 | /// 67 | /// Reads appsettings from web.config 68 | /// 69 | public static string GetAppSetting(string settingKey) 70 | { 71 | return Environment.GetEnvironmentVariable(settingKey).Trim(); 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /UpdateIPTParam/SampleAutomation.cs: -------------------------------------------------------------------------------- 1 | using Inventor; 2 | using Newtonsoft.Json; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Runtime.InteropServices; 7 | using System.Threading; 8 | 9 | namespace UpdateIPTParam 10 | { 11 | [ComVisible(true)] 12 | public class SampleAutomation 13 | { 14 | private InventorServer m_server; 15 | public SampleAutomation(InventorServer app) { m_server = app; } 16 | 17 | public void Run(Document doc) 18 | { 19 | try 20 | { 21 | // update parameters in the doc 22 | ChangeParameters(doc); 23 | 24 | // generate outputs 25 | var docDir = System.IO.Path.GetDirectoryName(doc.FullFileName); 26 | 27 | // save output file 28 | var documentType = doc.DocumentType; 29 | if (documentType == DocumentTypeEnum.kPartDocumentObject) 30 | { 31 | // the name must be in sync with OutputIpt localName in Activity 32 | var fileName = System.IO.Path.Combine(docDir, "outputFile.ipt"); 33 | 34 | // save file 35 | doc.SaveAs(fileName, false); 36 | } 37 | } 38 | catch (Exception e) { LogTrace("Processing failed: {0}", e.ToString()); } 39 | } 40 | 41 | /// 42 | /// Change parameters in Inventor document. 43 | /// 44 | /// The Inventor document. 45 | /// JSON with changed parameters. 46 | public void ChangeParameters(Document doc) 47 | { 48 | var theParams = GetParameters(doc); 49 | 50 | Dictionary parameters = JsonConvert.DeserializeObject>(System.IO.File.ReadAllText("params.json")); 51 | foreach (KeyValuePair entry in parameters) 52 | { 53 | try 54 | { 55 | Parameter param = theParams[entry.Key.ToLower()]; 56 | param.Expression = entry.Value; 57 | } 58 | catch (Exception e) { LogTrace("Cannot update {0}: {1}", entry.Key, e.Message); } 59 | } 60 | doc.Update(); 61 | } 62 | 63 | /// 64 | /// Get parameters for the document. 65 | /// 66 | /// Parameters. Throws exception if parameters are not found. 67 | private static Parameters GetParameters(Document doc) 68 | { 69 | var docType = doc.DocumentType; 70 | switch (docType) 71 | { 72 | case DocumentTypeEnum.kAssemblyDocumentObject: 73 | var asm = doc as AssemblyDocument; 74 | return asm.ComponentDefinition.Parameters; 75 | case DocumentTypeEnum.kPartDocumentObject: 76 | var ipt = doc as PartDocument; 77 | return ipt.ComponentDefinition.Parameters; 78 | default: 79 | throw new ApplicationException(string.Format("Unexpected document type ({0})", docType)); 80 | } 81 | } 82 | 83 | /// 84 | /// This will appear on the Design Automation output 85 | /// 86 | private static void LogTrace(string format, params object[] args) { Trace.TraceInformation(format, args); } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /updateRVTParam/UpdateRVTParam.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {9A402F71-D386-4E2D-9582-1E99CE87206D} 8 | Library 9 | Properties 10 | Autodesk.Forge.Sample.DesignAutomation.Inventor 11 | UpdateRVTParam 12 | v4.8 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | ..\packages\Autodesk.Forge.DesignAutomation.Revit.2021.0.0\lib\net48\DesignAutomationBridge.dll 36 | 37 | 38 | ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll 39 | 40 | 41 | ..\..\..\..\..\..\..\Program Files\Autodesk\Revit 2019\RevitAPI.dll 42 | False 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | xcopy /Y /F "$(TargetDir)*.dll" "$(ProjectDir)UpdateRVTParam.bundle\Contents\" 62 | del /F "$(ProjectDir)..\forgesample\wwwroot\bundles\UpdateRVTParam.zip" 63 | "C:\Program Files\7-Zip\7z.exe" a -tzip "$(ProjectDir)../forgesample/wwwroot/bundles/UpdateRVTParam.zip" "$(ProjectDir)UpdateRVTParam.bundle\" -xr0!*.pdb 64 | 65 | -------------------------------------------------------------------------------- /UpdateDWGParam/UpdateDWGParam.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {F17BDCE4-8CD6-4DAF-B57A-3A4B8137D736} 8 | Library 9 | Properties 10 | Autodesk.Forge.Sample.DesignAutomation.AutoCAD 11 | UpdateDWGParam 12 | v4.6 13 | 512 14 | true 15 | 16 | 17 | 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | ..\packages\AutoCAD.NET.Core.20.0.0\lib\45\AcCoreMgd.dll 37 | False 38 | 39 | 40 | ..\packages\AutoCAD.NET.Model.20.0.0\lib\45\AcDbMgd.dll 41 | False 42 | 43 | 44 | ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | xcopy /Y /F "$(TargetDir)*.dll" "$(ProjectDir)UpdateDWGParam.bundle\Contents\" 66 | del /F "$(ProjectDir)..\forgesample\wwwroot\bundles\UpdateDWGParam.zip" 67 | "C:\Program Files\7-Zip\7z.exe" a -tzip "$(ProjectDir)../forgesample/wwwroot/bundles/UpdateDWGParam.zip" "$(ProjectDir)UpdateDWGParam.bundle\" -xr0!*.pdb 68 | 69 | -------------------------------------------------------------------------------- /UpdateMAXParam/README.md: -------------------------------------------------------------------------------- 1 | # learn.forge.designautomation - 3ds Max 2 | 3 | ## Tutorial to prepare a 3ds Max .NET Application bundle that can be consumed in Forge Design Automation 4 | 5 | ### Step 1: Build a .NET 3ds Max assembly. C++, Python, and MAXScript are also supported. 6 | 7 | Note that Design Automation cannot have any user interaction requirements. For .NET programs, the easiest way to automate them is to make a static class and then execute the functions from MAXScript. In this example, you will find the automation command in the .\learn.forge.designautomation\UpdateMAXParam\UpdateMAXParam.bundle\da_script.ms 8 | 9 | The example is provided here: .\learn.forge.designautomation\UpdateMAXParam 10 | 11 | 12 | ### Step 2: Test your application locally. You can use the 3ds Max Batch tool for this. 13 | 14 | The 3ds Max desktop software already includes a tool called 3ds Max Batch. This tool allows local automation of tasks and is a good way to test your automation before using the Design Automation system. See here for the 3ds Max 2019 Batch details: http://help.autodesk.com/view/3DSMAX/2019/ENU/?guid=GUID-0968FF0A-5ADD-454D-B8F6-1983E76A4AF9 15 | 16 | Anything that runs in the 3ds Max Batch tool is possible to run in the 3ds Max Design Automation engine. You can also include plug-ins that can be automated. Typically, you would provide a MAXScript that would execute the automation, but the code itself could live in a C++ or a .NET plug-in. Of course, the MAXScript could also contain the automation code. The Design Automation API also supports the ability to pass parameters into the script code, that can also be passed into the automation code. This will allow very flexible work-flows with the ability to provide configurations and data to the automation job. For example, you could have a configurator website that takes information from your customer, then using 3ds Max Design Automation you could auto-generate a max model to give back to your customer. Using other Forge APIs, you could also preview the model using the Forge Model Derivative service and the Forge Viewer. 17 | 18 | 19 | ### Step 3: Building the AppPackage .bundle 20 | 21 | The "Autoloader" plugin mechanism simplifies deployment of your plugin applications to Forge Design Automation. This allows you to deploy your plugins using the simple package format (a folder structure with a .bundle extension) along with an XML file placed in the root of the folder structure. The XML file contains metadata that describes the components of your plugin inside the folder structure, and how they should be loaded. 22 | 23 | Full reference of [PackageContents.xml](https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2015/ENU/AutoCAD-Customization/files/GUID-BC76355D-682B-46ED-B9B7-66C95EEF2BD0-htm.html) and [Bundle](https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2015/ENU/AutoCAD-Customization/files/GUID-40F5E92C-37D8-4D54-9497-CD9F0659F9BB-htm.html) structure. 24 | 25 | 1. Create a UpdateMAXParameters.bundle folder within same project folder 26 | 27 | 2. Create a Contents folder within UpdateMAXParameters.bundle, this contains module of our UpdateParameters application. 28 | 29 | 3. Create a PackageContents.xml, this contains metadata of the application module to loaded by Forge Design Automation. See the example file here: .\learn.forge.designautomation\UpdateMAXParam\UpdateMAXParam.bundle\PackageContents.xml. 30 | 31 | 4. Wrap the UpdateMAXParameters.bundle into a zip file. This can be done in the "post build event" setting using the zip tool of your choice (for example, [7z zip tool](https://www.7-zip.org/)). See the example project .\learn.forge.designautomation\UpdateMAXParam\UpdateMAXParam.csproj file in the PostBuildEvent section. 32 | 33 | -------------------------------------------------------------------------------- /updateRVTParam/Commands.cs: -------------------------------------------------------------------------------- 1 | using Autodesk.Revit.ApplicationServices; 2 | using Autodesk.Revit.Attributes; 3 | using Autodesk.Revit.DB; 4 | using DesignAutomationFramework; 5 | using Newtonsoft.Json; 6 | using System.Collections.Generic; 7 | using System.IO; 8 | 9 | namespace Autodesk.Forge.Sample.DesignAutomation.Revit 10 | { 11 | [Transaction(TransactionMode.Manual)] 12 | [Regeneration(RegenerationOption.Manual)] 13 | public class Commands : IExternalDBApplication 14 | { 15 | //Path of the project(i.e)project where your Window family files are present 16 | string OUTPUT_FILE = "OutputFile.rvt"; 17 | 18 | public ExternalDBApplicationResult OnStartup(ControlledApplication application) 19 | { 20 | DesignAutomationBridge.DesignAutomationReadyEvent += HandleDesignAutomationReadyEvent; 21 | return ExternalDBApplicationResult.Succeeded; 22 | } 23 | 24 | private void HandleDesignAutomationReadyEvent(object sender, DesignAutomationReadyEventArgs e) 25 | { 26 | LogTrace("Design Automation Ready event triggered..."); 27 | e.Succeeded = true; 28 | EditWindowParametersMethod(e.DesignAutomationData.RevitDoc); 29 | } 30 | 31 | private void EditWindowParametersMethod(Document doc) 32 | { 33 | InputParams inputParameters = JsonConvert.DeserializeObject(File.ReadAllText("params.json")); 34 | 35 | //Modifying the window parameters 36 | //Open transaction 37 | using (Transaction trans = new Transaction(doc)) 38 | { 39 | trans.Start("Update window parameters"); 40 | 41 | //Filter for windows 42 | FilteredElementCollector WindowCollector = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Windows).WhereElementIsNotElementType(); 43 | IList windowIds = WindowCollector.ToElementIds() as IList; 44 | 45 | foreach (ElementId windowId in windowIds) 46 | { 47 | Element Window = doc.GetElement(windowId); 48 | FamilyInstance FamInst = Window as FamilyInstance; 49 | FamilySymbol FamSym = FamInst.Symbol; 50 | SetElementParameter(FamSym, BuiltInParameter.WINDOW_HEIGHT, inputParameters.Height); 51 | SetElementParameter(FamSym, BuiltInParameter.WINDOW_WIDTH, inputParameters.Width); 52 | } 53 | 54 | //To save all the changes commit the transaction 55 | trans.Commit(); 56 | } 57 | 58 | //Save the updated file by overwriting the existing file 59 | ModelPath ProjectModelPath = ModelPathUtils.ConvertUserVisiblePathToModelPath(OUTPUT_FILE); 60 | SaveAsOptions SAO = new SaveAsOptions(); 61 | SAO.OverwriteExistingFile = true; 62 | 63 | //Save the project file with updated window's parameters 64 | LogTrace("Saving file..."); 65 | doc.SaveAs(ProjectModelPath, SAO); 66 | } 67 | 68 | public ExternalDBApplicationResult OnShutdown(ControlledApplication application) 69 | { 70 | return ExternalDBApplicationResult.Succeeded; 71 | } 72 | 73 | private void SetElementParameter(FamilySymbol FamSym, BuiltInParameter paraMeter, double parameterValue) 74 | { 75 | FamSym.get_Parameter(paraMeter).Set(parameterValue); 76 | } 77 | 78 | public class InputParams 79 | { 80 | public double Width { get; set; } 81 | public double Height { get; set; } 82 | } 83 | 84 | /// 85 | /// This will appear on the Design Automation output 86 | /// 87 | private static void LogTrace(string format, params object[] args) { System.Console.WriteLine(format, args); } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /UpdateMAXParam/UpdateMAXParam.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 9.0.30729 7 | 2.0 8 | {FE45C541-D216-4792-983D-3100BA9F3F4F} 9 | Library 10 | Properties 11 | Autodesk.Forge.Sample.DesignAutomation.Max 12 | UpdateMAXParam 13 | v4.7.1 14 | 512 15 | 16 | 17 | 18 | 19 | 3.5 20 | publish\ 21 | true 22 | Disk 23 | false 24 | Foreground 25 | 7 26 | Days 27 | false 28 | false 29 | true 30 | 0 31 | 1.0.0.%2a 32 | false 33 | false 34 | true 35 | 36 | 37 | 38 | true 39 | bin\Debug 40 | DEBUG;TRACE 41 | full 42 | prompt 43 | AllRules.ruleset 44 | 45 | 46 | bin\Release\ 47 | TRACE 48 | true 49 | pdbonly 50 | prompt 51 | AllRules.ruleset 52 | 53 | 54 | 55 | $(ADSK_3DSMAX_x64_2019)\Autodesk.Max.dll 56 | False 57 | 58 | 59 | ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | xcopy /Y /F "$(TargetDir)*.dll" "$(ProjectDir)UpdateMAXParam.bundle\Contents\" 80 | del /F "$(ProjectDir)..\forgesample\wwwroot\bundles\UpdateMAXParam.zip" 81 | "C:\Program Files\7-Zip\7z.exe" a -tzip "$(ProjectDir)../forgesample/wwwroot/bundles/UpdateMAXParam.zip" "$(ProjectDir)UpdateMAXParam.bundle\" -xr0!*.pdb 82 | 83 | 90 | -------------------------------------------------------------------------------- /designautomation.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29418.71 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "forgesample", "forgesample\forgesample.csproj", "{AFBF1E9B-9949-4DFC-8D5E-9EF8D5347AC1}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateRVTParam", "updateRVTParam\UpdateRVTParam.csproj", "{9A402F71-D386-4E2D-9582-1E99CE87206D}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateDWGParam", "updateDWGParam\UpdateDWGParam.csproj", "{F17BDCE4-8CD6-4DAF-B57A-3A4B8137D736}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateMAXParam", "UpdateMAXParam\UpdateMAXParam.csproj", "{FE45C541-D216-4792-983D-3100BA9F3F4F}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateIPTParam", "UpdateIPTParam\UpdateIPTParam.csproj", "{687A75D9-9B7D-42B7-9BE7-64893FE58F1B}" 15 | EndProject 16 | Global 17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 18 | Debug|Any CPU = Debug|Any CPU 19 | Debug|x64 = Debug|x64 20 | Release|Any CPU = Release|Any CPU 21 | Release|x64 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 24 | {AFBF1E9B-9949-4DFC-8D5E-9EF8D5347AC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {AFBF1E9B-9949-4DFC-8D5E-9EF8D5347AC1}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {AFBF1E9B-9949-4DFC-8D5E-9EF8D5347AC1}.Debug|x64.ActiveCfg = Debug|Any CPU 27 | {AFBF1E9B-9949-4DFC-8D5E-9EF8D5347AC1}.Debug|x64.Build.0 = Debug|Any CPU 28 | {AFBF1E9B-9949-4DFC-8D5E-9EF8D5347AC1}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {AFBF1E9B-9949-4DFC-8D5E-9EF8D5347AC1}.Release|Any CPU.Build.0 = Release|Any CPU 30 | {AFBF1E9B-9949-4DFC-8D5E-9EF8D5347AC1}.Release|x64.ActiveCfg = Release|Any CPU 31 | {AFBF1E9B-9949-4DFC-8D5E-9EF8D5347AC1}.Release|x64.Build.0 = Release|Any CPU 32 | {9A402F71-D386-4E2D-9582-1E99CE87206D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {9A402F71-D386-4E2D-9582-1E99CE87206D}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {9A402F71-D386-4E2D-9582-1E99CE87206D}.Debug|x64.ActiveCfg = Debug|Any CPU 35 | {9A402F71-D386-4E2D-9582-1E99CE87206D}.Debug|x64.Build.0 = Debug|Any CPU 36 | {9A402F71-D386-4E2D-9582-1E99CE87206D}.Release|Any CPU.ActiveCfg = Release|Any CPU 37 | {9A402F71-D386-4E2D-9582-1E99CE87206D}.Release|Any CPU.Build.0 = Release|Any CPU 38 | {9A402F71-D386-4E2D-9582-1E99CE87206D}.Release|x64.ActiveCfg = Release|Any CPU 39 | {9A402F71-D386-4E2D-9582-1E99CE87206D}.Release|x64.Build.0 = Release|Any CPU 40 | {F17BDCE4-8CD6-4DAF-B57A-3A4B8137D736}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 41 | {F17BDCE4-8CD6-4DAF-B57A-3A4B8137D736}.Debug|Any CPU.Build.0 = Debug|Any CPU 42 | {F17BDCE4-8CD6-4DAF-B57A-3A4B8137D736}.Debug|x64.ActiveCfg = Debug|Any CPU 43 | {F17BDCE4-8CD6-4DAF-B57A-3A4B8137D736}.Debug|x64.Build.0 = Debug|Any CPU 44 | {F17BDCE4-8CD6-4DAF-B57A-3A4B8137D736}.Release|Any CPU.ActiveCfg = Release|Any CPU 45 | {F17BDCE4-8CD6-4DAF-B57A-3A4B8137D736}.Release|Any CPU.Build.0 = Release|Any CPU 46 | {F17BDCE4-8CD6-4DAF-B57A-3A4B8137D736}.Release|x64.ActiveCfg = Release|Any CPU 47 | {F17BDCE4-8CD6-4DAF-B57A-3A4B8137D736}.Release|x64.Build.0 = Release|Any CPU 48 | {FE45C541-D216-4792-983D-3100BA9F3F4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 49 | {FE45C541-D216-4792-983D-3100BA9F3F4F}.Debug|Any CPU.Build.0 = Debug|Any CPU 50 | {FE45C541-D216-4792-983D-3100BA9F3F4F}.Debug|x64.ActiveCfg = Debug|Any CPU 51 | {FE45C541-D216-4792-983D-3100BA9F3F4F}.Debug|x64.Build.0 = Debug|Any CPU 52 | {FE45C541-D216-4792-983D-3100BA9F3F4F}.Release|Any CPU.ActiveCfg = Release|Any CPU 53 | {FE45C541-D216-4792-983D-3100BA9F3F4F}.Release|Any CPU.Build.0 = Release|Any CPU 54 | {FE45C541-D216-4792-983D-3100BA9F3F4F}.Release|x64.ActiveCfg = Release|Any CPU 55 | {FE45C541-D216-4792-983D-3100BA9F3F4F}.Release|x64.Build.0 = Release|Any CPU 56 | {687A75D9-9B7D-42B7-9BE7-64893FE58F1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 57 | {687A75D9-9B7D-42B7-9BE7-64893FE58F1B}.Debug|Any CPU.Build.0 = Debug|Any CPU 58 | {687A75D9-9B7D-42B7-9BE7-64893FE58F1B}.Debug|x64.ActiveCfg = Debug|Any CPU 59 | {687A75D9-9B7D-42B7-9BE7-64893FE58F1B}.Debug|x64.Build.0 = Debug|Any CPU 60 | {687A75D9-9B7D-42B7-9BE7-64893FE58F1B}.Release|Any CPU.ActiveCfg = Release|Any CPU 61 | {687A75D9-9B7D-42B7-9BE7-64893FE58F1B}.Release|Any CPU.Build.0 = Release|Any CPU 62 | {687A75D9-9B7D-42B7-9BE7-64893FE58F1B}.Release|x64.ActiveCfg = Release|Any CPU 63 | {687A75D9-9B7D-42B7-9BE7-64893FE58F1B}.Release|x64.Build.0 = Release|Any CPU 64 | EndGlobalSection 65 | GlobalSection(SolutionProperties) = preSolution 66 | HideSolutionNode = FALSE 67 | EndGlobalSection 68 | GlobalSection(ExtensibilityGlobals) = postSolution 69 | SolutionGuid = {05F5CC9C-321D-41C1-9E7A-F799CF2B1EED} 70 | EndGlobalSection 71 | EndGlobal 72 | -------------------------------------------------------------------------------- /UpdateDWGParam/Commands.cs: -------------------------------------------------------------------------------- 1 | using Autodesk.AutoCAD.ApplicationServices.Core; 2 | using Autodesk.AutoCAD.DatabaseServices; 3 | using Autodesk.AutoCAD.Runtime; 4 | using Newtonsoft.Json; 5 | using System.IO; 6 | 7 | [assembly: CommandClass(typeof(UpdateDWGParam.Commands))] 8 | [assembly: ExtensionApplication(null)] 9 | 10 | namespace UpdateDWGParam 11 | { 12 | public class Commands 13 | { 14 | [CommandMethod("UpdateParam", CommandFlags.Modal)] 15 | public static void UpdateParam() 16 | { 17 | //Get active document of drawing with Dynamic block 18 | var doc = Application.DocumentManager.MdiActiveDocument; 19 | var db = doc.Database; 20 | 21 | // read input parameters from JSON file 22 | InputParams inputParams = JsonConvert.DeserializeObject(File.ReadAllText("params.json")); 23 | 24 | using (Transaction t = db.TransactionManager.StartTransaction()) 25 | { 26 | var bt = t.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; 27 | 28 | foreach (ObjectId btrId in bt) 29 | { 30 | //get the blockDef and check if is anonymous 31 | BlockTableRecord btr = (BlockTableRecord)t.GetObject(btrId, OpenMode.ForRead); 32 | if (btr.IsDynamicBlock) 33 | { 34 | //get all anonymous blocks from this dynamic block 35 | ObjectIdCollection anonymousIds = btr.GetAnonymousBlockIds(); 36 | ObjectIdCollection dynBlockRefs = new ObjectIdCollection(); 37 | foreach (ObjectId anonymousBtrId in anonymousIds) 38 | { 39 | //get the anonymous block 40 | BlockTableRecord anonymousBtr = (BlockTableRecord)t.GetObject(anonymousBtrId, OpenMode.ForRead); 41 | //and all references to this block 42 | ObjectIdCollection blockRefIds = anonymousBtr.GetBlockReferenceIds(true, true); 43 | foreach (ObjectId id in blockRefIds) 44 | { 45 | dynBlockRefs.Add(id); 46 | } 47 | } 48 | if (dynBlockRefs.Count > 0) 49 | { 50 | //Get the first dynamic block reference, we have only one Dyanmic Block reference in Drawing 51 | var dBref = t.GetObject(dynBlockRefs[0], OpenMode.ForWrite) as BlockReference; 52 | UpdateDynamicProperties(dBref, inputParams); 53 | } 54 | } 55 | } 56 | t.Commit(); 57 | } 58 | LogTrace("Saving file..."); 59 | db.SaveAs("outputFile.dwg", DwgVersion.Current); 60 | } 61 | 62 | /// 63 | /// This updates the Dyanmic Blockreference with given Width and Height 64 | /// The initial parameters of Dynamic Blockrefence, Width =20.00 and Height =40.00 65 | /// 66 | /// 67 | /// 68 | /// 69 | private static void UpdateDynamicProperties(BlockReference br, InputParams inputParams) 70 | { 71 | // Only continue is we have a valid dynamic block 72 | if (br != null && br.IsDynamicBlock) 73 | { 74 | // Get the dynamic block's property collection 75 | DynamicBlockReferencePropertyCollection pc = br.DynamicBlockReferencePropertyCollection; 76 | foreach (DynamicBlockReferenceProperty prop in pc) 77 | { 78 | switch (prop.PropertyName) 79 | { 80 | case "Width": 81 | prop.Value = inputParams.Width; 82 | break; 83 | case "Height": 84 | prop.Value = inputParams.Height; 85 | break; 86 | default: 87 | break; 88 | } 89 | } 90 | } 91 | } 92 | 93 | /// 94 | /// This will appear on the Design Automation output 95 | /// 96 | private static void LogTrace(string format, params object[] args) { Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(format, args); } 97 | } 98 | 99 | public class InputParams 100 | { 101 | public double Width { get; set; } 102 | public double Height { get; set; } 103 | } 104 | } -------------------------------------------------------------------------------- /forgesample/README.md: -------------------------------------------------------------------------------- 1 | # learn.forge.designautomation - ASP.NET Core 2 | 3 | ![Platforms](https://img.shields.io/badge/platform-Windows|MacOS-lightgray.svg) 4 | ![.NET](https://img.shields.io/badge/.NET%20Core-3.1-blue.svg) 5 | [![License](http://img.shields.io/:license-MIT-blue.svg)](http://opensource.org/licenses/MIT) 6 | 7 | [![oAuth2](https://img.shields.io/badge/oAuth2-v1-green.svg)](http://developer.autodesk.com/) 8 | [![Data-Management](https://img.shields.io/badge/Data%20Management-v1-green.svg)](http://developer.autodesk.com/) 9 | [![Design-Automation](https://img.shields.io/badge/Design%20Automation-v3-green.svg)](http://developer.autodesk.com/) 10 | 11 | ![Basic](https://img.shields.io/badge/Level-Basic-blue.svg) 12 | 13 | # Description 14 | 15 | Webapp interface that uses Design Automation to update the `width` and `height` param of DWG Dynamic Block (using AutoCAD), RVT Window Family instance (using Revit), IPT Part parameters (using Inventor) and 3DS ... (using 3dsMax). Also includes a `Clear Account` (remove all AppBundles and Activities) and `Define new Activity` based on the sample code. Uses ASP.NET Core SignalR to update the interface. 16 | 17 | See other projects for bundles. 18 | 19 | ## Thumbnail 20 | 21 | ![thumbnail](../thumbnail.gif) 22 | 23 | # Setup 24 | 25 | ## Prerequisites 26 | 27 | 1. **Forge Account**: Learn how to create a Forge Account, activate subscription and create an app at [this tutorial](http://learnforge.autodesk.io/#/account/). 28 | 2. **Visual Studio**: Either Community (Windows) or Code (Windows, MacOS). 29 | 3. **.NET Core** basic knowledge with C# 30 | 4. **ngrok**: Routing tool, [download here](https://ngrok.com/). 31 | 32 | ## Running locally 33 | 34 | Clone this project or download it. It's recommended to install [GitHub desktop](https://desktop.github.com/). To clone it via command line, use the following (**Terminal** on MacOSX/Linux, **Git Shell** on Windows): 35 | 36 | git clone https://github.com/autodesk-forge/learn.forge.designautomation 37 | 38 | **ngrok** 39 | 40 | When a `Workitem` completes, **Design Automation** can notify our application. As the app is running locally (i.e. `localhost`), it's not reacheable from the internet. `ngrok` tool creates a temporary address that channels notifications to our `localhost` address. 41 | 42 | After [download ngrok](https://ngrok.com/), run `ngrok http 3000 -host-header="localhost:3000"`, then copy the `http` address into the `FORGE_WEBHOOK_URL` environment variable (see next). For this sample, do not use the `https` address. 43 | 44 | ![](../media/webapp/ngrok_setup.png) 45 | 46 | **Visual Studio** (Windows): 47 | 48 | Right-click on the project, then go to **Debug**. Adjust the settings as shown below. 49 | 50 | ![](../media/webapp/visual_studio_settings.png) 51 | 52 | **Visual Sutdio Code** (Windows, MacOS): 53 | 54 | Open the `webapp` folder (only), 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. 55 | 56 | ![](../media/webapp/visual_code_restore.png) 57 | 58 | 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: 59 | 60 | ```json 61 | "env": { 62 | "ASPNETCORE_ENVIRONMENT": "Development", 63 | "ASPNETCORE_URLS" : "http://localhost:3000", 64 | "FORGE_CLIENT_ID": "your id here", 65 | "FORGE_CLIENT_SECRET": "your secret here", 66 | "FORGE_WEBHOOK_URL": "http://1234.ngrok.io", 67 | }, 68 | ``` 69 | 70 | **How to use this sample** 71 | 72 | Open `http://localhost:3000` to start the app, if first time, click on `Define Activity`, enter new `width` & `height` values, select the input file (use from **sample files** folder), select the `Activity` and, finally, `Start workitem`. 73 | 74 | # Further Reading 75 | 76 | Documentation: 77 | 78 | - [Design Automation v3](https://forge.autodesk.com/en/docs/design-automation/v3/developers_guide/overview/) 79 | - [Data Management](https://forge.autodesk.com/en/docs/data/v2/reference/http/) used to store input and output files. 80 | 81 | Other APIs: 82 | 83 | - [.NET Core SignalR](https://docs.microsoft.com/en-us/aspnet/core/signalr/introduction?view=aspnetcore-3.1) 84 | 85 | ### Tips & Tricks 86 | 87 | This sample uses .NET Core and works fine on both Windows and MacOS, see [this tutorial for MacOS](https://github.com/augustogoncalves/dotnetcoreheroku). You still need Windows debug the AppBundle plugins. 88 | 89 | ### Troubleshooting 90 | 91 | 1. **error setting certificate verify locations** error: may happen on Windows, use the following: `git config --global http.sslverify "false"` 92 | 93 | ## License 94 | 95 | This sample is licensed under the terms of the [MIT License](http://opensource.org/licenses/MIT). Please see the [LICENSE](LICENSE) file for full details. 96 | 97 | ## Written by 98 | 99 | Augusto Goncalves [@augustomaia](https://twitter.com/augustomaia), [Forge Partner Development](http://forge.autodesk.com) -------------------------------------------------------------------------------- /UpdateIPTParam/UpdateIPTParam.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {687A75D9-9B7D-42B7-9BE7-64893FE58F1B} 8 | Library 9 | Properties 10 | UpdateIPTParam 11 | UpdateIPTParam 12 | v4.7 13 | 512 14 | 15 | 16 | 17 | ..\..\packages 18 | ..\packages 19 | 20 | 21 | true 22 | full 23 | false 24 | bin\Debug\ 25 | DEBUG;TRACE 26 | prompt 27 | 4 28 | 29 | 30 | pdbonly 31 | true 32 | bin\Release\ 33 | TRACE 34 | prompt 35 | 4 36 | 37 | 38 | 39 | False 40 | True 41 | $(PackagePath)\autodesk\autodesk.inventor.interop.dll 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | PreserveNewest 63 | 64 | 65 | 66 | 67 | 12.0.2 68 | 69 | 70 | 1.0.0-beta3 71 | 72 | 73 | 74 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | xcopy /Y /F "$(ProjectDir)PackageContents.xml" "$(TargetDir)\Bundle\$(MSBuildProjectName).bundle\" 90 | xcopy /Y /F "$(TargetDir)*.*" "$(TargetDir)\Bundle\$(MSBuildProjectName).bundle\Contents\" 91 | del /F "$(ProjectDir)..\forgesample\wwwroot\bundles\UpdateIPTParam.zip" 92 | "C:\Program Files\7-Zip\7z.exe" a -tzip "$(ProjectDir)../forgesample/wwwroot/bundles/UpdateIPTParam.zip" "$(TargetDir)\bundle\$(MSBuildProjectName).bundle\" -xr0!*.pdb 93 | 94 | 95 | -------------------------------------------------------------------------------- /forgesample/wwwroot/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Autodesk Forge - Design Automation 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 36 | 37 |
38 |
39 |
40 |
41 | 42 | 43 |
44 |
45 | 46 | 47 |
48 | 49 |
50 | 51 | 52 |
53 |
54 | 55 | 56 |
57 |

58 |
59 |
60 |

61 |             
62 |
63 |
64 | 65 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /forgesample/wwwroot/js/ForgeDesignAutomation.js: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Autodesk, Inc. All rights reserved 3 | // Written by Forge Partner Development 4 | // 5 | // Permission to use, copy, modify, and distribute this software in 6 | // object code form for any purpose and without fee is hereby granted, 7 | // provided that the above copyright notice appears in all copies and 8 | // that both that copyright notice and the limited warranty and 9 | // restricted rights notice below appear in all supporting 10 | // documentation. 11 | // 12 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 13 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 14 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 15 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 16 | // UNINTERRUPTED OR ERROR FREE. 17 | ///////////////////////////////////////////////////////////////////// 18 | 19 | $(document).ready(function () { 20 | prepareLists(); 21 | 22 | $('#clearAccount').click(clearAccount); 23 | $('#defineActivityShow').click(defineActivityModal); 24 | $('#createAppBundleActivity').click(createAppBundleActivity); 25 | $('#startWorkitem').click(startWorkitem); 26 | 27 | startConnection(); 28 | }); 29 | 30 | function prepareLists() { 31 | list('activity', '/api/forge/designautomation/activities'); 32 | list('engines', '/api/forge/designautomation/engines'); 33 | list('localBundles', '/api/appbundles'); 34 | } 35 | 36 | function list(control, endpoint) { 37 | $('#' + control).find('option').remove().end(); 38 | jQuery.ajax({ 39 | url: endpoint, 40 | success: function (list) { 41 | if (list.length === 0) 42 | $('#' + control).append($('