1. Products
  2.   CAD
  3.   .NET
  4.   CADability
 
  

Create & Manage CAD Drawings via Free C# .NET Library

Open Source C# .NET CAD Library for Creating, Reading, Rendering and Manipulating AutoCAD 2D & 3D Drawings & Models using .NET Free API.

What is CADability Library?

Computer-Aided Design (CAD) software is an essential tool in industries such as architecture, engineering, and manufacturing. While many commercial CAD solutions exist, open-source alternatives offer developers the flexibility to build customized applications without licensing constraints. One such powerful open-source library is CADability, available on GitHub. The CADability Library is an open-source C# library designed to simplify the development of CAD applications. It offers a wide range of functionalities, including geometric modeling, parametric design, file import/export, and 3D visualization. The library is modular and extensible, making it an ideal choice for developers who want to create custom CAD tools or integrate CAD capabilities into existing applications.

CADability provides a robust set of features for handling CAD files, making it an excellent choice for developers building custom CAD software. Some of its key features include reading and writing various CAD file formats, 2D and 3D Geometry Processing, Vector Graphics Rendering, performing CAD transformations and intersections, CAD curve/surface operations, functionality Customization supports and so on. The library enables parametric design, allowing developers to define relationships between geometric elements. The library is completely free to use and modify, making it accessible to developers of all levels. By exploring the library's features and experimenting with the provided code example, you can gain a deeper understanding of how to leverage CADability in your own projects.

Previous Next

Getting Started with CADability

The easiest way to install CADability is by using GitHub. Please use the following command for a smooth installation.

Clone CADability GitHub repository

git clone https://github.com/FriendsOfCADability/CADability.git

You can also install it manually; download the latest release files directly from GitHub repository.

Create 3D CAD Model via .NET API

The open source CADability library makes it easy for software developers to create a simple 3D model using C# .NET Library CADability. It is also possible to load existing diagrams, edit CAD diagrams, convert it to other diagrams and so on. Let’s walk through a simple example of creating a 3D CAD model. In this example, developers can create a basic rectangular prism and export it as an STL file inside C# applications.

How to Create a Rectangular Prism via .NET Library?

using CADability;
using CADability.GeoObject;
using CADability.Shapes;
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        // Create a new project
        Project project = new Project();

        // Define the dimensions of the rectangular prism
        double length = 50.0;
        double width = 30.0;
        double height = 20.0;

        // Create a rectangular prism
        Box box = Box.Construct(length, width, height);
        project.Add(box);

        // Export the model as an STL file
        string filePath = "rectangular_prism.stl";
        using (FileStream stream = new FileStream(filePath, FileMode.Create))
        {
            project.Export(stream, FileType.STL);
        }

        Console.WriteLine("3D model created and exported successfully!");
    }
}

Work with CAD File Formats via .NET

The open source CADability library has provided complete support a variety of file formats for importing and exporting 3D CAD models inside .NET applications. This includes popular formats like STEP, IGES, and STL, making it easy to integrate the library with other CAD tools and workflows. CADability allows software developers to read and write different CAD file formats, ensuring seamless interoperability. Here is an example that shows how software developers can load a DXF file inside .NET applications.

How to Load a DXF File via C# .NET Library?

using CADability.CAD;

string filePath = "example.dxf";
CADFile cadFile = new CADFile(filePath);
cadFile.Load();
// Saving a CAD File
cadFile.Save("output.dxf");

CAD Drawings Rendering via C# Library

For visualization, the open source CADability library provides rendering functionalities that enable developers to display CAD objects on a graphical interface. It includes tools for rendering vector-based graphics, making it useful for visualization. The following simple example demonstrates how software developers can create a simple CAD viewer using .NET commands.

How to Create a Simple CAD Viewer inside C# .NET Apps?

using CADability.UserInterface;
// Create a simple CAD viewer
CADability.UserInterface.ModelView modelView = new ModelView();
modelView.SetModel(cadFile.Model);

Geometric Modeling via C# .NET

CADability provides a wide range of geometric modeling capabilities, allowing developers to create complex 3D shapes with ease. The library supports various geometric primitives such as points, lines, curves, and surfaces. It also includes advanced features like Boolean operations, filleting, and chamfering.