ImageGear .NET - Updated
Getting Started with ImageGear CAD
User Guide > How to Work with... > CAD > Getting Started with ImageGear CAD
This section provides information about the following:

CAD Samples and Tutorials

Our CAD sample will help you get started using ImageGear's CAD capabilities.

This section also provides step-by-step CAD tutorials, which show you how to create a new ImageGear project using the CAD component:

ImageGear.Formats.CAD Namespace

The ImageGear.Formats.CAD namespace allows you to load, save, and process CAD files. It also allows the rasterization of DWG, DXF, and DGN files, by converting them to bitmaps, and provides you with the ability to convert the file into SVG or PDF format. Both rasterization and conversion output will maintain any changes made to the CADCamera associated with the ImGearCADPage.

To enable the ImageGear.Formats.CAD Namespace in your project, specify the following directive:

C#
Copy Code
using ImageGear.Formats.CAD;
VB.NET
Copy Code
Imports ImageGear.Formats.CAD

CAD Dependencies

You can use our NuGet packages to ensure you have met all required dependencies or run the Deployment Packaging Wizard (DPW) specifying the exact dependencies needed.

NuGet Packages

NuGet packages make it easy to add, remove, and update libraries and tools in Visual Studio projects that use the .NET Framework. See NuGet Packages for more information.

Deployment Packaging Wizard

  1. To ensure that you have all the required library files, run the Deployment Packaging Wizard located at …\Accusoft\ImageGear.NET v24\Licensing\Deployment\[x86,x64]\DPW.exe
    For more information, see Deployment Packaging Wizard.
  2. Please ensure that your Visual Studio build environment is set properly. This can be checked or changed by the following:
    1. From the project properties:
      • On the Build tab, check/change the Platform target property to the appropriate x86/x64. At the top, also make sure the Platform property is set to the same.
      • On the Build tab, in the Output section, make sure Output path property is pointing to the same location as your dlls, i.e., bin\RunTime\NET\
      • On the Debug tab, check/change the Platform property to the correct platform.
    2. Select Build from the pull down menus, and click Configuration Manager…
      • Check/change the Active solution platform property to the correct x86/x64 platform.
      • Click Close.
  3. You will also need to have the Microsoft Visual C++ CRT 10.0 (x86) installed. Corresponding links to VS2010/VS2010SP1 C++ Redistributable Packages are:
    https://www.microsoft.com/en-us/download/details.aspx?id=5555
    https://www.microsoft.com/en-us/download/details.aspx?id=14632
    https://www.microsoft.com/en-us/download/details.aspx?id=8328
    https://www.microsoft.com/en-us/download/details.aspx?id=13523
    For more information, see Distributing PDF and PS Fonts and Libraries with an Application.
  4. You can also pass in the direct location of the CAD resource files as a parameter of the CreateDWGFormatCreateDXFFormat, and CreateDGNFormat methods. For a modified code example, please see the following:
    C#
    Copy Code
    ImGearFileFormats.Filters.Add(ImGearCAD.CreateDWGFormat(@"C:\Users\Public\Documents\Accusoft\ImageGear.NET v24\Bin\x86"));
    ImGearFileFormats.Filters.Add(ImGearCAD.CreateDXFFormat(@"C:\Users\Public\Documents\Accusoft\ImageGear.NET v24\Bin\x86"));
    ImGearFileFormats.Filters.Add(ImGearCAD.CreateDGNFormat(@"C:\Users\Public\Documents\Accusoft\ImageGear.NET v24\Bin\x86"));
    VB.NET
    Copy Code
    ImGearFileFormats.Filters.Add(ImGearCAD.CreateDWGFormat(@"C:\Users\Public\Documents\Accusoft\ImageGear.NET v24\Bin\x86"))
    ImGearFileFormats.Filters.Add(ImGearCAD.CreateDXFFormat(@"C:\Users\Public\Documents\Accusoft\ImageGear.NET v24\Bin\x86"))
    ImGearFileFormats.Filters.Add(ImGearCAD.CreateDGNFormat(@"C:\Users\Public\Documents\Accusoft\ImageGear.NET v24\Bin\x86"))
  5. For a WEB application, you can pass the location of CAD binaries and resources directly in the web.config file of the application: 
    Copy Code
    <appSettings>
      ......
      <add key="igCadResources" value="C:\Users\Public\Documents\Accusoft\ImageGear.NET v24\Bin\x86" />
      <add key="igBinaries" value="C:\Users\Public\Documents\Accusoft\ImageGear.NET v24\Bin\x86" />
    </appSettings>
  6. For more information about working with the web.config file, see ASP.NET Web.Config Editor Application

CAD Object Lifetime

All CAD objects that require disposal handle disposal within their destructor. Therefore, users should not need to worry about calling Dispose whenever they want to clean up after they’re done using a CAD object. However, it is generally good practice to do so.