UPDATE: Centroids 0.31
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
UPDATE: Centroids 0.31
Hi all,
again about the missing links: Centroids.
*** EDIT ***
For the latest version v0.32 refer to:
https://qcad.org/rsforum/viewtopic.php?f=30&t=8970
*** EDIT ***
I started a new topic because it are now 3 Addons in one package:
- Area centroid of surfaces with uniform density. (v0.31)
- Wire centroid of infinite small wires with uniform density. (v0.31)
- Summing markers of the above weighted by their individual density. (v0.11)
For snapshots/releases of QCAD Professional later than 3.26.4 only.
In the earlier releases, centroids for shapes with holes were already possible with a hatched area.
Then one has two distinct densities: one apple/unit² or zero apples/unit².
Now it is possible to retrieve the center of mass of e.g. a plywood shape with a lead insert somewhere.
... With a wire sticking out if that would be the case.
Or a paper kite with steel wiring.
To exploit this, one assigns a real world density to the custom property of the markers.
Then one sums these by selection. The tool excludes non markers and the Maths will do the rest.
Remark that a uniform wire centroid can't really replace a bend tube or bar what are in fact 3D shapes.
Still, given the scale, it can be a good approximation.
For more details about the fixes and changes I like to refer to the changelog: Rather proud of the almost exact full ellipse circumference in addition to some closed forms for ellipses.
*** EDIT ***
Updated to v0.32
Version 0.31 was downloaded 33 times.
*** EDIT ***
Following the adoption by Andrew they appear in the Misc .. Information menu.
Really sorry for those who endorsed the placement under the Information menu and toolbars.
Not many will really need them at hand that often. (See downloads)
The Addons are donated to the QCAD project 'as is', Andrew may include it in a next release.
Immediate installation:
Users that have installed earlier versions manually are advised to remove the added folders and files.
Ensure that the next path exists in your installation folder:
... QCAD\scripts\Misc\MiscInformation (QCAD or QCADCAM or whatever path that is used)
Copy over the files from the zip to that path.
The folder structure is mandatory, for reference: the changelog should be located here:
... QCAD\scripts\Misc\MiscInformation\InfoCentroids\ChangeLog.txt
Folder and file naming and the placement are quite logic.
Win users may require admin rights.
The shortcut 'IM' was already taken ... Reverted to "AM", "WM" and "CM".
aka: Area center of Mass, Wire(s) center of Mass and Combine centers of Mass
Let's say that this release is a more complete work.
More accurate and neater for sure.
Regards,
CVH
again about the missing links: Centroids.
*** EDIT ***
For the latest version v0.32 refer to:
https://qcad.org/rsforum/viewtopic.php?f=30&t=8970
*** EDIT ***
I started a new topic because it are now 3 Addons in one package:
- Area centroid of surfaces with uniform density. (v0.31)
- Wire centroid of infinite small wires with uniform density. (v0.31)
- Summing markers of the above weighted by their individual density. (v0.11)
For snapshots/releases of QCAD Professional later than 3.26.4 only.
In the earlier releases, centroids for shapes with holes were already possible with a hatched area.
Then one has two distinct densities: one apple/unit² or zero apples/unit².
Now it is possible to retrieve the center of mass of e.g. a plywood shape with a lead insert somewhere.
... With a wire sticking out if that would be the case.
Or a paper kite with steel wiring.
To exploit this, one assigns a real world density to the custom property of the markers.
Then one sums these by selection. The tool excludes non markers and the Maths will do the rest.
Remark that a uniform wire centroid can't really replace a bend tube or bar what are in fact 3D shapes.
Still, given the scale, it can be a good approximation.
For more details about the fixes and changes I like to refer to the changelog: Rather proud of the almost exact full ellipse circumference in addition to some closed forms for ellipses.
*** EDIT ***
Updated to v0.32
Version 0.31 was downloaded 33 times.
*** EDIT ***
Following the adoption by Andrew they appear in the Misc .. Information menu.
Really sorry for those who endorsed the placement under the Information menu and toolbars.
Not many will really need them at hand that often. (See downloads)
The Addons are donated to the QCAD project 'as is', Andrew may include it in a next release.
Immediate installation:
Users that have installed earlier versions manually are advised to remove the added folders and files.
Ensure that the next path exists in your installation folder:
... QCAD\scripts\Misc\MiscInformation (QCAD or QCADCAM or whatever path that is used)
Copy over the files from the zip to that path.
The folder structure is mandatory, for reference: the changelog should be located here:
... QCAD\scripts\Misc\MiscInformation\InfoCentroids\ChangeLog.txt
Folder and file naming and the placement are quite logic.
Win users may require admin rights.
The shortcut 'IM' was already taken ... Reverted to "AM", "WM" and "CM".
aka: Area center of Mass, Wire(s) center of Mass and Combine centers of Mass
Let's say that this release is a more complete work.
More accurate and neater for sure.
Regards,
CVH
Last edited by CVH on Tue Dec 14, 2021 8:04 am, edited 2 times in total.
Re: UPDATE: Centroids 0.31
1. The installation description fails in my case on a QCAD Version 3.26.4.13 and isn't logical. Unneeded subdirectories, Double menu entry's etc. ...
... yes, I realized why that happened.
2.
... yes, I realized why that happened.
2.
Sounds interesting but I'm zu dummzumzum. This tools (except Area Centroid) are not intuitive and there is no explanation at all how they are supposed to work. If somebody knows how to master this tools please enlighten me.CVH wrote: ↑Sat Nov 20, 2021 3:57 pmNow it is possible to retrieve the center of mass of e.g. a plywood shape with a lead insert somewhere.
... With a wire sticking out if that would be the case.
Or a paper kite with steel wiring.
To exploit this, one assigns a real world density to the custom property of the markers.
Then one sums these by selection. The tool excludes non markers and the Maths will do the rest.
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Re: UPDATE: Centroids 0.31
Great,
the Area Centroid without shortcut is a 'so said compiled' copy that can not be removed by me/us.
The price to pay for shifting it around, fiddling with groups and widgets.
It's all fine when Andrew does that once, or more ... Then the change is immediate, every time.
For us it is a round trip. Centroids as package was released just after Snapshot 3.26.4.13 ...
It is always too late and too early at the same instant, sorry for that.
You may want to disable the old one in the App.Prefs tool section for now.
Clearing visibility and commands.
For some reason the new Addons are not listed under the Misc/Information section ...
WM sums centroid markers by their location, uniform area/length times their individual density.
Have a look at the custom properties of the odd inner shape of a marker.
The result is a sum of weights and a weighted position.
The tool doesn't care about what is in selection as long as it finds multiple markers.
At present I am not convinced that it should revert to all with no selection.
Some examples: First we set up the uniform density centroids.
Then we set up their local density and apply those values as custom density for each marker.
Finally, we can retrieve the total mass and the center of mass by summing weighted ...
... All as a 2D representation of a 3D problem.
With clever manipulations we can tackle pretty complex problems.
Regards,
CVH
- petevick
- Premier Member
- Posts: 392
- Joined: Tue May 19, 2020 9:34 am
- Location: North Norfolk coast UK
Re: UPDATE: Centroids 0.31
The only problem doing that is that it removes both entries
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Qcad Pro 3.29.6
Linux Mint 21.2 Cinnamon, Qcad Pro 3.29.6
Re: UPDATE: Centroids 0.31
Ok - now I know where to play with. Thanks.
Question: Is there a way that I can change the decimal and thousands separators? It is confusing if you normally don't use them on that given way. We and a few other countries use them reversed ...
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Re: UPDATE: Centroids 0.31
@ petevick
As we learned now the tool "InfoAreaCentroid" exist already in QCAD ...
If the shortcut AM is missing - Application Preferences / Tool Setting can fix that ...
Try instead to delete the folder "InfoAreaCentroid" in CVH's download.
As we learned now the tool "InfoAreaCentroid" exist already in QCAD ...
If the shortcut AM is missing - Application Preferences / Tool Setting can fix that ...
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Re: UPDATE: Centroids 0.31
It seems to be a bigger mess at your sides ...
All I can add at this moment, is that when you initiate the latest version of 'AM' it reports its version (v0.31) as a verification.
Each time we learn a little more.
With little steps, one by one.
Already happy with your interest in evaluating it.
Regards,
CVH
- petevick
- Premier Member
- Posts: 392
- Joined: Tue May 19, 2020 9:34 am
- Location: North Norfolk coast UK
Re: UPDATE: Centroids 0.31
Yep, that did the trick Husky
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Qcad Pro 3.29.6
Linux Mint 21.2 Cinnamon, Qcad Pro 3.29.6
Re: UPDATE: Centroids 0.31
Still zu dumzumzum ...
What I tested:
Selected the wire,
launched Wire centroid,
selected marker,
Property Editor displays Custom Property's,
Value "Weighted" unchanged!!!
How do I get the Weight ...
... and why is there no "Height/Length/Diameter" field? Or at least a cross-section field.
... and why do I not get a Marker for "Sum centroids weighted"
... and why do I don't get Custom Property's for "Area Centroid" (wasn't that part of the last QCAD Snapshot?
What surprised me is that Area and Weighted is identical? Coincidence?
... or even Length could be identical with Weighted? I guess I have to dig out my pocket calculator ....
I did - was that wrong?
What I tested:
Selected the wire,
launched Wire centroid,
selected marker,
Property Editor displays Custom Property's,
Changed "Density" from 1 to 0.0137,
Value "Weighted" unchanged!!!
How do I get the Weight ...
... and why is there no "Height/Length/Diameter" field? Or at least a cross-section field.
... and why do I not get a Marker for "Sum centroids weighted"
... and why do I don't get Custom Property's for "Area Centroid" (wasn't that part of the last QCAD Snapshot?
What surprised me is that Area and Weighted is identical? Coincidence?
... or even Length could be identical with Weighted? I guess I have to dig out my pocket calculator ....
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Re: UPDATE: Centroids 0.31
Husky,
Custom properties are plain text fields in QCAD, like a memo ... a note.
There is nothing inherited to them like e.g. the 'Length' property of an arc entity.
For arcs, the length property will adapt when one changes: radius or start or end angle ... All properties related to that arc shape.
The custom property 'Weighted' is the recorded result (area/length) for a uniform density of 1.00 of the shape(s) in question.
All condensed in an infinite small point. How the shape(s) looked liked is of no meaning anymore.
A weighted value ... Not to be confused with a weight, meaning the mass.
The location of that point is recorded as the X and the Y value.
There is no link to the shape(s) either and the text values will not adapt to any change applied on that/those shape(s) afterwards.
If you translate the marker as entity that will make no change to the recorded text in the custom properties ...
Recording the calculated results is way more convenient than that the user has to write them down for later usage.
Believe me when I say that while developing I did that several hundreds times and more.
The mass of an object is 'Weighted' times 'Density' and remark that both are unit-less.
For areas, 'Weighted' is in squared units and 'Density' would then be in mass/squared units.
For wires that would be units and mass/unit.
In both cases the product is a mass.
Such a product for one to a few should be easy enough to calculate yourself.
1515.298units long times 0.0137apples/length unit = 20.7595826 apples
The value to weigh with remains 1515.298... (units long), one can still use a steel wire having another density than the 1,5mm² copper wire.
It gets more complicated when combining several centroid results.
Total mass is straightforward: The sum of all the products 'Weighted' times 'Density'.
X & Y on the other hand are combined weighted.
The running sum of Xn times its mass, and that divided by the overall mass. The same for Y values.
Currently CM requires two or more markers to be combined.
I'll change its action for 1 selected marker so that it reports the simple mass product.
You probably removed the newer art of the 0.31 release.
I think that only Andrew can solve this mess for the next snapshot/release of QCAD.
(Update was committed 1 hour ago, thanks Andrew)
Yep, my QCAD scripting projects folder is called 'Crazy' ...
Early adoption CM version 0.11 ... Still twisting my mind over that.
We can't really mix 'Weighted' values, 'Density' and total mass.
- What would be the combined density value for the Kite in the example file?
Even as an average density, that would have no valid meaning at all.
The average density over [Amm² + Lmm] with unit ...
A point mass located at position X/Y. Again combinable with others
At the moment CM v0.11 beats dragging data to a spreadsheet.
Don't really understand the question(s) ... A centroid is an infinite small point.
As if all the mass is condensed in one single point in space.
And a point has no dimensions, right?
True that you have to come up with the local 2D density yourself, similar as in the steel insert example.
Including the required units conversions for the gathered material specific data.
It is not a 3D tool and a material properties list is out of the question.
Now I am going to let rest my center of mass.
Regards,
CVH
Re: UPDATE: Centroids 0.31
Yes I know but I thought you came up with something fancy. Never mind.
I admit that I was obviously under a wrong impression. Why? If I see an example drawing with Density (Paper/Cooper) field and weight annotation than I assume it is calculated by the new add on. That was one of the reason for you to promote this add on, or not? As I learned now it turns out it was calculated by hand.
The other thing: Why a Marker, produced by the add on, creates a preset Field (Custom Property) for Density with a value of 1 (what is plain wrong) will stay a mystery to me. In my opinion empty filled fields serves a user better than a field with a wrong value. How will a user figure out (after a month or so working on this drawing) if this field was automatically and wrong filed by an Add on or manually filed on purpose by the user? And what makes you thinking that "Density" is a field what every user needs.
Question: For what is this confusing language good?
1. In the Custom Property's you call it "Weighted:". For the same "thing"in the drawing you use the term "Total length:". Same "thing" should have the same name - or not?
2. If I explode the Kite Polyline and select the lines for "Area Centroid" then a error message pops up that I have a multiple selection. Well, yes I know that but why isn't the tool working? Maybe a warning could help which tells me that I only can use Polylines ...
3. I assume it makes cense to me to stop further investigation until the tool is fully integrated in a next QCAD snapshot ...
However - the whole centroid thing is a great addition to QCAD. Well done! The till now misleading "Density" thing has room for improvements.
I'll wait and see!
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Re: UPDATE: Centroids 0.31
There is no need to shift this conversation to a PM level. Please stop PM me!
In short - the tool is not working as expected. It makes no sense to me to play with a broken tool.
Example: You told me in PM:
New drawing,
Selected two marker!
CM
Result in Command line:
Command: sumcentroid
Centroids weighted sum script (v0.12) by CVH
One marker selected, point mass = 1515.3
For the records - two marker were selected!
Same test in your example drawing.
Result in Command line:
Command: sumcentroid
Centroids weighted sum script (v0.12) by CVH
Weighted mass (2): 23.9596
Combined mass centroid position: (1000.0000000000000, 222.06533962930012)
Your example drawing - deleted original marker - created two new marker (AM, WM)
Result in Command line:
Command: sumcentroid
Centroids weighted sum script (v0.12) by CVH
One marker selected, point mass = 1515.2982
Did I mention that AM doesn't creates Custom Property's at all.
Do you now understand why I did this statement?
In short - the tool is not working as expected. It makes no sense to me to play with a broken tool.
Example: You told me in PM:
Nope - no "complex" math is done if you test it in a new drawing.CVH wrote:Tue Nov 23, 2021 5:58 amLocal densities, yes, the more complex math is done by the tool.
For the Kite, select both markers and hit CM, the result will be the values in green(lime).
The weighted point will be where the green(lime) arrow is pointing to.
Same for the insert with a compound density or any amount of selected markers.
New drawing,
Selected two marker!
CM
Result in Command line:
Command: sumcentroid
Centroids weighted sum script (v0.12) by CVH
One marker selected, point mass = 1515.3
For the records - two marker were selected!
Same test in your example drawing.
Result in Command line:
Command: sumcentroid
Centroids weighted sum script (v0.12) by CVH
Weighted mass (2): 23.9596
Combined mass centroid position: (1000.0000000000000, 222.06533962930012)
Your example drawing - deleted original marker - created two new marker (AM, WM)
Result in Command line:
Command: sumcentroid
Centroids weighted sum script (v0.12) by CVH
One marker selected, point mass = 1515.2982
Did I mention that AM doesn't creates Custom Property's at all.
Do you now understand why I did this statement?
With other words - I'm out until a revised edition is in the next QCAD update / Snapshot available.
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Re: UPDATE: Centroids 0.31
All,
An everlasting misconception, I think.
There might be a language barrier too.
The mass of objects is expressed in kg or lbs or ...
The weight of objects is expressed in Newtons.
Putting an object on a balance would read the acting force divided by (about) 9.81(m/s²).
In fact, the readout is the object its mass instead of its weight.
Then we say that the object its weight is so much in kg or lbs or ... What is the mass ...
In general we don't mind that at all.
Here we use "weight" in yet another meaning.
'Weighted' is how much that point will weigh in further calculation, the weight of its other properties.
For convenience unit-less so we can mix areas and lengths according the type of the centroid.
https://en.wikipedia.org/wiki/Weighted_arithmetic_mean
https://en.wikipedia.org/wiki/Weight_function
'Density' is again unit-less and must also be expressed according the type.
The area or length for a single centroid is simply equal to its unit-less 'Weighted' value.
But we can't really say that the point is 123.45km long or 123.45in² wide ...
The centroid labels diversify on the used type, instead of displaying a plain and dull number.
Somewhat similar in Command History info messages.
Any correction or replacement for the term 'Weighted' is welcome.
I would also gladly adopt any replacement for 'Density' in the sense of:
The 'Local (compound) relative surface mass density' for the AM tool
or the 'Local (compound) relative linear mass density' for the WM tool.
Regards,
CVH
An everlasting misconception, I think.
There might be a language barrier too.
The mass of objects is expressed in kg or lbs or ...
The weight of objects is expressed in Newtons.
Putting an object on a balance would read the acting force divided by (about) 9.81(m/s²).
In fact, the readout is the object its mass instead of its weight.
Then we say that the object its weight is so much in kg or lbs or ... What is the mass ...
In general we don't mind that at all.
Here we use "weight" in yet another meaning.
'Weighted' is how much that point will weigh in further calculation, the weight of its other properties.
For convenience unit-less so we can mix areas and lengths according the type of the centroid.
https://en.wikipedia.org/wiki/Weighted_arithmetic_mean
https://en.wikipedia.org/wiki/Weight_function
'Density' is again unit-less and must also be expressed according the type.
The area or length for a single centroid is simply equal to its unit-less 'Weighted' value.
But we can't really say that the point is 123.45km long or 123.45in² wide ...
The centroid labels diversify on the used type, instead of displaying a plain and dull number.
Somewhat similar in Command History info messages.
Any correction or replacement for the term 'Weighted' is welcome.
I would also gladly adopt any replacement for 'Density' in the sense of:
The 'Local (compound) relative surface mass density' for the AM tool
or the 'Local (compound) relative linear mass density' for the WM tool.
Regards,
CVH
Last edited by CVH on Tue Nov 23, 2021 10:19 am, edited 2 times in total.
Re: UPDATE: Centroids 0.31
Please undelete or re-install the content of the updated script folder for AM.
I encourage you to avoid the broken (old) version that has no shortcut listed.
Regards,
CVH