14

Is it possible to position a circle in inkscape using the center? I'm designing a shape for a laser cutter and the circles are to outline mounting holes. Each hole is around 3.2mm.

I know one way is to just subtract the radius whenever positioning them. But I've got a large number of holes and it will increase the chances of error greatly (Instead of positioning at (14,14), I'll be positioning it at (12.4,12.4).

This is the only thread I could find on this topic and sadly doesn't have an answer. Does anyone know if there's any way to do this?

EDIT: Just to clarify, I want to be able to position the holes exactly using the x and y values using the lower left hand corner of the sheet as the origin.

  • Have you considered using something like Sketchup for this instead? This sounds like more a task for CAD software than vector illustration software. – DA01 Sep 14 '15 at 3:24
12

Create

To draw a circle centering a starting point rather than within a box we can press Shift while drawing. For square ration (cicrle rather than ellipse) we can press Ctrl in addition.

To help starting at a specific node we may enable snapping to cusp nodes or to a grid.

Move

To move a circle by its center we need to temporarily transfrom it to an arc (in path mode drag the round arc handle). We can then snap the circle's center to e.g. cusp nodes, or to a grid by dragging the circle from its center.

enter image description here

The arc can then be transformed to a circle again by clicking "make whole" (enter image description here) when in path mode.

Manually edit x/y-position

To manually edit the precice circle center position we have to select an object to then open the XML-editor (ShiftCtrlX) where we can freely edit the center values cx and cy by giving any value and then press set.

enter image description here

  • Sorry, I should have clarified that because I'm positioning everything using the x and y values using the lower left corner as the origin, I need to be able to enter a value directly in mm. Object snapping to center works even without converting it to an arc. – Plasty Grove Sep 13 '15 at 10:34
  • @PlastyGrove: see edit. – Takkat Sep 13 '15 at 11:22
7

This is sort of a makeshift solution but it may work for you.

  1. Create a bunch of equally identical circles (e.g., all with a diameter of 3.2 mm).
  2. Position them without offset wherever you want a hole.
  3. Select all circles and move them so they are correctly positioned (e.g., by 1.6 mm in each direction), using object → transform → move. To ease selecting the circles and avoid missing one, you can create the circles in their own layer.
  4. If you want some circles to have a different size, either use object → transform → scale (which preserves the centre) or create a correctly sized circle and use the existing one to position it using the align and distribute tab.
  • Thanks for pointing out the transform option, I think that's a good idea. This will work, but again, I need to be careful that I select all the holes before I click on transform. I'm only concerned about the chance of an error occurring. – Plasty Grove Sep 13 '15 at 10:40
  • @PlastyGrove: I made an edit addressing your concern. – Wrzlprmft Sep 13 '15 at 11:04
5

If you have lots of circles and like to position them by value, counting distances from bottom up, you should probably use a scripting language or a spreadsheet program like LibreOffice-Calc or Excel, a classical text editor with extendet search-replace engine or a combination of those.

Probably you have the values already in an easy machine parsable form like a plain list of values (x, y, radius).

Then you can subtract the y-value with a formula from the pagesize. Or you create them and flip your drawing in the end vertically.

In an editor, you may use very basic SVG-code to define a circle:

 <circle cx="50" cy="50" r="40" stroke="none" fill="red" />

After opening it with inkscape and saving it, it will be transformed to a much more complicated format, with relative coordinates. But from a table of values in a CSV file you can easily produce hundrets of circles (I did so).

So you can save an empty SVG file, insert your circles with an editor before the closing tag, reopen it with inkscape and edit it further as needed.

3

As of Inkscape 0.92.2, a control point is placed at the center of circles, allowing the center to be snapped to a grid intersection point or other features. See this video for a brief demonstration.

2

Others have covered your origin point problem quite well.

To position objects by their centre, you should

  1. draw horizontal and vertical construction lines that intersect at the circle centres. Initially, just draw them as constrained lines (ctrl + draw), then set the coordinates in the box at the top of the screen
  2. Draw your circles at the right size, again using the coordinates at the top. It might be quicker to create one, then duplicate it.
  3. Enable Snapping, particularly to path intersections (path intersection snap icon) and object rotation centres (rotation centre snap icon).
  4. Drag your circle to the intersecting construction lines, and its centre will snap to the precise intersection.

Don't forget to set Tools / Geometric Bounding Box in Preferences to get the objects the ‘right’ size; if you use the default Visual Bounding Box, your object size takes line width into account. You might not want this, though even laser cutters have a kerf width …

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.