Sample of Windows Service by Design Automation API
(Formely AutoCAD I/O)
Description
Windows service sample to plot a drawing placed in a folder to PDF using Design Automation API
Thumbnail
Industry Background
- an utility to convert AutoCAD drawing to PDF automatically on the background.
Setup
Dependencies
- Download and install Visual Studio. In the latest test, Visual Studio version is 2017.
- Get the auxiliary library project design.automation-.net-library
Prerequisites
- Forge Account: Learn how to create a Forge Account, activate subscription and create an app at this tutorial. Make sure to select the service Design Automation.
- Make a note with the credentials (client id and client secret) of the app.
- as mentioned in Dependencies, ensure to build the auxiliary library project and get the binary dll.
Running locally
- Open the project. Restore the packages of the project by [NuGet](https://www.nuget.org/. The simplest way is
- VS2012: Projects tab >> Enable NuGet Package Restore. Then right click the project>>"Manage NuGet Packages for Solution" >> "Restore" (top right of dialog)
- VS2013/VS2015/2017: right click the project>>"Manage NuGet Packages for Solution" >> "Restore" (top right of dialog)
- Add other missing references and the library ofdesign.automation-.net-library
- In the project settings, provide the following details:
- Path to a local folder in your system that contains AutoCAD drawings.
- Design Automation Client Id
- Design Automation Client Secret
- Bucket name in your AWS S3 Storage
- Open “App.Config” file and provide AWS credentials. This will allow the sample project to access S3 storage in your AWS profile.
- Build the sample project
- Install the windows service using “installutil” in the command line of Visual Studio. To do this open Visual studio command prompt and run : installutil < path to PlotToPDFService.exe >
- Start the windows service. To do this from the Run windows, type services.msc and look for Plot2PDFService and start it.
- You may need to switch to "[Log on local system account" of the service if you hit an error of "Access Denied".
- Copy any drawing to the watched folder (C:\Temp by default). After some time, a PDF of the same name should be available in the watched folder.
Known Issues
- as of writing, Design Automation of Forge is released with version 2. Odata is used with .NET project. In futher version, OData might not be used.
Further Reading
License
These samples are licensed under the terms of the MIT License. Please see the LICENSE file for full details.
Written by
Balaji Ramamoorthy updated by Xiaodong Liang