Convert Figma logo to code with AI

qcad logoqcad

QCAD - The Open Source 2D CAD. QCAD is a cross-platform CAD solution for Windows, macOS and Linux. It supports the DXF format and optionally the DWG format (through a proprietary plugin).

1,625
442
1,625
0

Top Related Projects

LibreCAD is a cross-platform 2D CAD program written in C++17. It can read DXF/DWG files and can write DXF/PDF/SVG files. It supports point/line/circle/ellipse/parabola/spline primitives. The user interface is highly customizable, and has dozens of translations.

24,091

This is the official source code of FreeCAD, a free and opensource multiplatform 3D parametric modeler.

OpenSCAD - The Programmers Solid 3D CAD Modeller

This is an active mirror of the KiCad development branch, which is hosted at GitLab (updated every time something is pushed). Pull requests on GitHub are not accepted or watched.

Parametric 2d/3d CAD

Quick Overview

QCAD is an open-source 2D CAD (Computer-Aided Design) software for Windows, macOS, and Linux. It provides a comprehensive set of tools for creating technical drawings, including support for DXF files, layers, and various drawing entities. QCAD is designed to be user-friendly and extensible through its scripting interface.

Pros

  • Cross-platform compatibility (Windows, macOS, Linux)
  • Extensive set of drawing and editing tools
  • Support for DXF file format, enabling interoperability with other CAD software
  • Extensible through scripting (ECMAScript)

Cons

  • Limited 3D capabilities compared to some other CAD software
  • Learning curve for new users unfamiliar with CAD concepts
  • Some advanced features are only available in the commercial version (QCAD Professional)

Code Examples

As QCAD is primarily a GUI-based application, there aren't many code examples to showcase. However, here are a few examples of QCAD's scripting capabilities using ECMAScript:

  1. Creating a simple line:
var doc = new RDocument(new RMemoryStorage(), new RSpatialIndexNavel());
var line = new RLineEntity(doc, new RLineData(new RVector(0,0), new RVector(100,100)));
doc.addEntity(line);
  1. Drawing a circle:
var doc = new RDocument(new RMemoryStorage(), new RSpatialIndexNavel());
var circle = new RCircleEntity(doc, new RCircleData(new RVector(50,50), 25));
doc.addEntity(circle);
  1. Adding text to a drawing:
var doc = new RDocument(new RMemoryStorage(), new RSpatialIndexNavel());
var text = new RTextEntity(
    doc,
    new RTextData(
        new RVector(0,0),
        new RVector(0,0),
        10,
        100,
        RS.VAlignTop,
        RS.HAlignLeft,
        RS.LeftToRight,
        RS.Exact,
        1,
        "Hello QCAD",
        "Arial",
        false,
        false,
        0,
        false
    )
);
doc.addEntity(text);

Getting Started

To get started with QCAD:

  1. Download and install QCAD from the official website: https://www.qcad.org/en/download
  2. Launch QCAD and familiarize yourself with the interface
  3. Start a new drawing or open an existing DXF file
  4. Use the drawing tools in the toolbar to create your design
  5. Save your work in DXF format for compatibility with other CAD software

For scripting:

  1. Open the ECMAScript console in QCAD (Tools > Scripts > ECMAScript Console)
  2. Enter your script in the console and press Run to execute
  3. Refer to the QCAD scripting documentation for more advanced usage and API details

Competitor Comparisons

LibreCAD is a cross-platform 2D CAD program written in C++17. It can read DXF/DWG files and can write DXF/PDF/SVG files. It supports point/line/circle/ellipse/parabola/spline primitives. The user interface is highly customizable, and has dozens of translations.

Pros of LibreCAD

  • Fully open-source and free software, ensuring long-term availability and community-driven development
  • Cross-platform compatibility (Windows, macOS, Linux) without limitations
  • Active community with frequent updates and contributions

Cons of LibreCAD

  • Less polished user interface compared to QCAD
  • Fewer advanced features and tools available out-of-the-box
  • Steeper learning curve for new users

Code Comparison

QCAD (C++):

RS_Entity* entity = container->firstEntity();
while (entity) {
    if (entity->isVisible() && !entity->isLocked()) {
        // Process entity
    }
    entity = container->nextEntity();
}

LibreCAD (C++):

for (auto entity : *container) {
    if (entity->isVisible() && !entity->getFlag(RS2::FlagLocked)) {
        // Process entity
    }
}

The code snippets show different approaches to iterating through entities. QCAD uses a while loop with explicit pointer manipulation, while LibreCAD employs a more modern range-based for loop. LibreCAD's approach is generally considered more readable and less error-prone.

24,091

This is the official source code of FreeCAD, a free and opensource multiplatform 3D parametric modeler.

Pros of FreeCAD

  • Full 3D parametric modeling capabilities
  • Supports a wider range of CAD applications (mechanical, architectural, etc.)
  • More extensive plugin ecosystem and customization options

Cons of FreeCAD

  • Steeper learning curve due to more complex features
  • Can be slower and more resource-intensive for simpler 2D drafting tasks
  • Less focused on traditional 2D CAD workflows

Code Comparison

FreeCAD (Python-based scripting):

import FreeCAD as App
import Part

doc = App.newDocument()
box = Part.makeBox(10, 10, 10)
doc.addObject("Part::Feature", "MyBox").Shape = box
doc.recompute()

QCAD (ECMAScript-based scripting):

include("scripts/Draw/Line/Line2P/Line2P.js");

var line = new Line2P(document);
line.setStartPoint(0, 0);
line.setEndPoint(100, 100);
line.execute();

FreeCAD offers more powerful 3D modeling capabilities and a broader range of applications, while QCAD focuses on efficient 2D drafting. FreeCAD uses Python for scripting, allowing for more complex operations, whereas QCAD uses ECMAScript for simpler 2D drawing tasks.

OpenSCAD - The Programmers Solid 3D CAD Modeller

Pros of OpenSCAD

  • Programmatic approach allows for parametric designs and complex geometry
  • Text-based format enables version control and collaboration
  • Free and open-source software with active community support

Cons of OpenSCAD

  • Steeper learning curve for non-programmers
  • Limited 2D drafting capabilities compared to traditional CAD software
  • Rendering can be slow for complex designs

Code Comparison

OpenSCAD:

module gear(teeth = 20, radius = 5) {
    circle(r = radius);
    for (i = [0:teeth-1]) {
        rotate(i * 360 / teeth) translate([radius, 0, 0]) square([2, 1]);
    }
}
gear();

QCAD (using its scripting API):

var doc = new RDocument();
var circle = new RCircleEntity(doc, new RCircleData(new RVector(0,0), 5));
doc.addEntity(circle);
for (var i = 0; i < 20; i++) {
    var angle = i * 2 * Math.PI / 20;
    var rect = new RRectangleEntity(doc, new RRectangleData(
        new RVector(5 * Math.cos(angle), 5 * Math.sin(angle)), 2, 1, angle));
    doc.addEntity(rect);
}

This is an active mirror of the KiCad development branch, which is hosted at GitLab (updated every time something is pushed). Pull requests on GitHub are not accepted or watched.

Pros of KiCad

  • More comprehensive EDA suite, including schematic capture, PCB layout, and 3D viewing
  • Larger and more active community, resulting in frequent updates and extensive documentation
  • Better support for complex, multi-layer PCB designs

Cons of KiCad

  • Steeper learning curve due to its more extensive feature set
  • Potentially overwhelming for simple 2D CAD tasks
  • Larger software footprint and potentially higher system requirements

Code Comparison

KiCad (C++):

void PCB_EDIT_FRAME::OnUpdateLayerPair( wxUpdateUIEvent& aEvent )
{
    LSET visible = GetBoard()->GetVisibleLayers();
    aEvent.Enable( visible.count() >= 2 );
}

QCAD (C++):

void RGraphicsViewImage::updateImage() {
    if (image.isNull()) {
        return;
    }
    graphicsView->scene()->update(boundingRect());
}

KiCad's code snippet demonstrates handling of layer visibility in PCB editing, while QCAD's code focuses on updating graphics views, reflecting their different primary purposes.

Parametric 2d/3d CAD

Pros of SolveSpace

  • 3D parametric modeling capabilities
  • Constraint-based sketching system
  • Smaller file size and faster performance

Cons of SolveSpace

  • Less extensive 2D drafting tools
  • Steeper learning curve for new users
  • Smaller community and fewer resources

Code Comparison

SolveSpace (C++):

void SolveSpaceUI::MenuFile(Command id) {
    switch(id) {
        case Command::NEW:
            NewFile();
            break;
        case Command::OPEN:
            OpenFile();
            break;
        // ...
    }
}

QCAD (C++):

void QC_ApplicationWindow::slotFileNew() {
    RS_DEBUG->print("QC_ApplicationWindow::slotFileNew()");
    fileNew(false);
}

void QC_ApplicationWindow::slotFileOpen() {
    RS_DEBUG->print("QC_ApplicationWindow::slotFileOpen()");
    fileOpen();
}

Both projects use C++ for their core functionality. SolveSpace employs a more compact switch-case structure for handling menu commands, while QCAD uses individual slot functions for each action. QCAD's code includes debug statements, indicating a focus on easier debugging and maintenance.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

QCAD - The Open Source 2D CAD

QCAD is a 2D CAD solution for Windows, macOS and Linux. Its core is developed in C++, based on the Qt tool kit. QCAD can be extended through a C++ plugin interface as well as through its very powerful and complete scripting interface (ECMAScript/JavaScript).

History

QCAD started as version 1 in October 1999 and has since evolved through version 2 (September 2003) and the current version 3 (July 2012 to present).

License

The QCAD 3 source code is released under the GPLv3 open source license. Script add-ons and C++ plugins are released under their respective licenses.

Compilation

Detailed compilation instructions for Windows, macOS and Linux can be found on our web site at:

http://www.qcad.org/en/component/content/article/78-qcad/111-qcad-compilation-from-sources