Macro to compute center of mass
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Macro to compute center of mass
Wow, are there any screenshots of the features available ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: Macro to compute center of mass
We are part of the technology transfer program for lightweight engineering funded by German Federal Ministry for Economic Affairs and Climate Action.
Re: Macro to compute center of mass
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: Macro to compute center of mass
New Release: Version 0.7.0 is officially available.
Here is the changelog, apart from the internal code changes:
Here is the changelog, apart from the internal code changes:
- New: Searchbar for solids
- New: Reworked import function to improve external bill of materials (BOM) import with better input tolerance. Caption "weight" has to be changed to "mass" if you want to import mass from an old file export of the macro.
- New: Mass can be set zero to exclude solid from calculation and visualization
- Fix: Behaviour of default value spin and "Apply to all"
- Fix: Preserve original solids color when "New" button pressed
- the calculation time FreeCAD takes for each call of .Volume and .CenterOfGravity (.CenterOfMass in FreeCAD 0.19 respectively) and
- searching the valid shape for these calls from depending objects and getting its global placement in the assembly.
We are part of the technology transfer program for lightweight engineering funded by German Federal Ministry for Economic Affairs and Climate Action.
Re: Macro to compute center of mass
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Macro to compute center of mass
Hello,
I am trying this macro on a project and not sure if I missed something as I am having issues and I cannot find a location to enter the bug reports. I have gone through the Wiki and cannot find the answers.
I am using the appimage and there are no materials in the drop down list. I get an error message when I select the material icon.
This may be related to how the macro is installed or do I have to create my own material list using the Material workbench?
On Linux, at least, the appimage runs in a different directory every time it is started. So, if the Addon manager installs files to be used later into this directory, they are lost when the appimage is closed. I have run into this with desktops in the past.
Second issue is I ran this code and for the centre of mass, I am getting negative numbers and the reference box is NOT around the model as per the image. The mass calculated is very close to my calculations but my CoM is -766.9500669679464 -189.58632323493663 365.92027040536425
For reference the base of the image is 500mm X 500mm and the angle iron is 1830mm high.
There is nothing on the wiki to explain what these numbers are or where the zero reference is.
I am trying this macro on a project and not sure if I missed something as I am having issues and I cannot find a location to enter the bug reports. I have gone through the Wiki and cannot find the answers.
I am using the appimage and there are no materials in the drop down list. I get an error message when I select the material icon.
Code: Select all
10:20:27 Traceback (most recent call last):
10:20:27 File "/home/robin/.local/share/FreeCAD/Macro/CenterOfMass.FCMacro", line 737, in on_pushButton_editMaterial
10:20:27 MaterialEditor.openEditor()
10:20:27 File "/tmp/.mount_FreeCApt8LLo/usr/Mod/Material/MaterialEditor.py", line 950, in openEditor
10:20:27 editor = MaterialEditor(obj, prop)
10:20:27 File "/tmp/.mount_FreeCApt8LLo/usr/Mod/Material/MaterialEditor.py", line 72, in __init__
10:20:27 self.widget = FreeCADGui.PySideUic.loadUi(filePath + "Resources" + os.sep + "ui" + os.sep + "materials-editor.ui")
10:20:27 File "<string>", line 4, in <module>
10:20:27 RuntimeError: Cannot open file
On Linux, at least, the appimage runs in a different directory every time it is started. So, if the Addon manager installs files to be used later into this directory, they are lost when the appimage is closed. I have run into this with desktops in the past.
Second issue is I ran this code and for the centre of mass, I am getting negative numbers and the reference box is NOT around the model as per the image. The mass calculated is very close to my calculations but my CoM is -766.9500669679464 -189.58632323493663 365.92027040536425
For reference the base of the image is 500mm X 500mm and the angle iron is 1830mm high.
There is nothing on the wiki to explain what these numbers are or where the zero reference is.
Re: Macro to compute center of mass
I did some tests. The issue is related to where the macro is reading the locations of the different solids. The project I am working on and the image I provided is assembled using Assembly 4. The various LCS's for joining of the items are not all referenced to the same point, depending on the original item.
Items are joined by different LCS's and then assembled. The macro doesn't take this into account in its present form.
I just did a test with two items. Drawn as one solid, the CofM was where it should have been. Drawn as two items and then assembled in Assembly 4, the bounding box is referenced to one of the items and CofM is indicated in that box and not even close to the true CofM. See my quickly created example.
Items are joined by different LCS's and then assembled. The macro doesn't take this into account in its present form.
I just did a test with two items. Drawn as one solid, the CofM was where it should have been. Drawn as two items and then assembled in Assembly 4, the bounding box is referenced to one of the items and CofM is indicated in that box and not even close to the true CofM. See my quickly created example.
Re: Macro to compute center of mass
I didn't see that there is a thread about GlobalPlacement. I believe that the issue I am having is related to that discussion.
Re: Macro to compute center of mass
Thank you for providing your information about the errors you experienced with the macro.
A huge part of the macro deals with workarounds to unify different data structures and body formats. Unfortunately, at the moment the case of App::Link cannot be covered in most situations because of the topic you already stumbled across.
A huge part of the macro deals with workarounds to unify different data structures and body formats. Unfortunately, at the moment the case of App::Link cannot be covered in most situations because of the topic you already stumbled across.
It seems you are using a development version. The new material system as well as the default Assembly workbench are not yet included in the macro.
We are part of the technology transfer program for lightweight engineering funded by German Federal Ministry for Economic Affairs and Climate Action.