[solved]Find centre of irregular/asymmetric drawing

Use this forum to ask questions about how to do things in QCAD.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
thelasercutter01
Junior Member
Posts: 24
Joined: Fri Jan 13, 2023 2:12 pm

[solved]Find centre of irregular/asymmetric drawing

Post by thelasercutter01 » Mon Jul 10, 2023 2:17 pm

I hope this should be easier but I just can't see an obvious way!

So I cut various patterns using my laser, mostly regular, but sometimes irregular (sample attached) shapes (from wood/metal) and to hang on the wall I create a hole. For asymmetric patterns (like a rectangle) you just find centre and there you go. What I am struggling is for irregular shapes how can I ensure before laser cutting where I create the holes in the right place. What I don't want is to physically to laser cut stuff than workout where the best place to put a hole is. I would rather have it worked it out in the program itself.

Is there something in QCAD that can help?

Any guidance will be really appreciated.

OS: Windows 11
QCAD Version: 3.27.8.0 (3.27.8)
Attachments
CenterofMass.dxf
(98.24 KiB) Downloaded 160 times
Last edited by thelasercutter01 on Mon Jul 10, 2023 3:30 pm, edited 2 times in total.

User avatar
andrew
Site Admin
Posts: 9063
Joined: Fri Mar 30, 2007 6:07 am

Re: Find centre of irregular/asymmetric drawing

Post by andrew » Mon Jul 10, 2023 2:49 pm

There's a third party tool in the Misc menu that should be able to do that:

1. Right-click on the contour and choose "Auto Create Polyline"
2. Misc > Information > 2D Centroid > Area Centroid

CVH
Premier Member
Posts: 3481
Joined: Wed Sep 27, 2017 4:17 pm

Re: Find centre of irregular/asymmetric drawing

Post by CVH » Mon Jul 10, 2023 3:12 pm

thelasercutter01 wrote:
Mon Jul 10, 2023 2:17 pm
Is there something in QCAD that can help?
Yes there is ... Centroids, or better: The center of mass of a 2D enclosed area.

Unfortunally it is not implemented for chains of individual drawing entities.
There was already a placeholder for a contour or a number of contours but I did not develop that any further ... Yet.
Singular, not self crossing, closed contours of many selected entities is kinda a problematic matter. :(

You need to convert the geometrically closed shape to a closed polyline.
In this case one can double click on one of the shapes of the contour.
QCAD will then select all that are connected.

Now type 'O' and 'C' what is the shortcut key sequence for Draw .. Polyline .. Polyline from selection.
The selection is merged into a single polyline and the selection is cleared.

When selecting this polyline again it should be reported as enclosing an area of 2618.5 units squared ... mm²

Now go to Misc .. Information .. 2D Centroids .. Area Centroid (A selection is required).
This will add the center of mass at (76.167271338552600, 41.883902997899560) and textual information.
About 2.145825.. units away from your circle at (78, 43) :wink:

How the textual information is formatted depends on your information and dimension settings.
The full floating point data is added as custom properties of the Centroid marker shape.
Select it and scroll down in the Property Editor.

The uniform area density is 'undefined' by default what results in a unit density.
Activate the Centroids Listener and change the density in whatever it is expressed per mm².
The point mass value will adapt.
De-activate (toggle) the Centroids Listener when you don't have any further use for it anymore.

Regards,
CVH
Last edited by CVH on Mon Jul 10, 2023 5:42 pm, edited 1 time in total.

thelasercutter01
Junior Member
Posts: 24
Joined: Fri Jan 13, 2023 2:12 pm

Re: Find centre of irregular/asymmetric drawing

Post by thelasercutter01 » Mon Jul 10, 2023 3:30 pm

Thank you very much Andrew and CVH, that's exactly what I needed. It works like a treat :)

CVH
Premier Member
Posts: 3481
Joined: Wed Sep 27, 2017 4:17 pm

Re: [solved]Find centre of irregular/asymmetric drawing

Post by CVH » Mon Jul 10, 2023 3:43 pm

thelasercutter01 wrote:
Mon Jul 10, 2023 3:30 pm
Thank you very much Andrew and CVH, that's exactly what I needed. It works like a treat
Much appreciated.

Remark that Centroids can handle much more than polylines with only line-segments.
It also auto-closes open shapes including arcs, ellipse arcs, splines, ... with a straight line.
Aside of 'Areas' there is also a 'Wire' variant for infinitely thin wires.
When the length exceeds the diameter by a larger enough factor then the results are quite OK.

Much time, testing and effort went into getting the best values considering the limits of the double floating point notation.
But you probably are not interested in the numbers beyond the third or the forth decimal :lol:

Regards,
CVH
Last edited by CVH on Mon Jul 10, 2023 4:46 pm, edited 1 time in total.

thelasercutter01
Junior Member
Posts: 24
Joined: Fri Jan 13, 2023 2:12 pm

Re: [solved]Find centre of irregular/asymmetric drawing

Post by thelasercutter01 » Mon Jul 10, 2023 4:35 pm

Thanks for the additional info CVH. Good to know. thanks again :)

Post Reply

Return to “QCAD 'How Do I' Questions”