Arcs to Circles Qcad Script Tested on QT5 & QT6

Arcs to Circles – Simple QCAD Script

Hi everyone,

I put together a small QCAD script that may be useful to others who occasionally need to convert arcs into full circles.

The script is called Arcs to Circles (arcs2circles.js). It takes any selected Arc entities and replaces them with full Circle entities using the exact same centre and radius.

I originally put this together because I quite often receive customer-supplied SVG or poorly created DXF files where geometry that should really be a circle has been supplied as one or more arcs. Manually fixing these can be a bit tedious, especially when there are quite a few of them.

This script makes the process much quicker — simply select the arcs and run the script.

What it does

  • Converts selected Arc entities into full 360° Circle entities.
  • Uses the original arc’s centre and radius.
  • Only processes the arcs that are currently selected.
  • The original start and end angles are discarded, since the resulting entity is a complete circle.

Accessing the Script

The script can be run from:

Misc > Draw > Convert Arcs to Circles

I’ve also assigned it the following shortcut:

AZ — “Arcs Zap” :grin:

So for me, the workflow is simply select the unwanted arcs and press AZ.

Multiple Arcs Making Up the Same Circle

One thing to be aware of is that sometimes two or more arcs make up what is effectively the same circle.

Because each arc is converted individually, this can result in duplicate circle entities being created on top of each other.

If this happens, simply run:

MD — “Detect Duplicates”

and remove the duplicate entities.

Important note

The newly created circles are placed on the currently active layer rather than the original arc’s layer. As a result, they will also use the visual attributes of the active layer, such as colour, linetype and lineweight.

So this is really intended as a quick geometry-conversion tool rather than a complete attribute-preserving replacement.

Installation

Place the script files into:

qcad/scripts/Misc/MiscDraw/arcs2circles/

For example, on Linux:

/home/john/opt/qcadcam-3.33.0-pro-linux-qt6-x86_64/scripts/Misc/MiscDraw/arcs2circles/

Usage

  1. Select the arcs you want to convert.
  2. Run Misc > Draw > Convert Arcs to Circles, or use the AZ shortcut.
  3. The selected arcs will be replaced with full circles on the current active layer.
  4. If multiple arcs represented the same circle, run MD — Detect Duplicates and remove the duplicates.

It’s a fairly simple script, but it has already saved me quite a bit of time when dealing with some of the DXF/SVG files that come in from customers.

Hopefully it might be useful to someone else as well.

Cheers,
John Hyslop
PS Thank you PeteVick for doing some testing on this :slight_smile:

A2C_v1.1.zip (4.2 KB)

1 Like