Info Workbench - Help with icons please.

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Info Workbench - Help with icons please.

Post by keithsloan52 »

Having recently completed an Open University course which covered the Monti Carlo method of integration. I thought it would be a good project to use it to calculate Volumes, Center of Mass, Moment of Inertia etc for FreeCAD

As to the best laid plans of mice and men I then found out that FreeCAD and OCC already provide functions for the above.

So anyway I have done my first FreeCAD module that implements some information functions as a WorkBench called Info.
i.e. On selecting an object or objects the Volume and Surface Area are calculated.

For a single selected object the Center of Mass and Moment of Inertia about the Centre of Mass are displayed.

It would be great if somebody with more graphics talent than me design some icons for the module. At present it
purloins them from the OpenSCAD module.

Thanks to Sebastian Hoogen for answering all my questions

Anyway you can download from http://www.sloan-home.co.uk/FreeCAD/Info/Info.html

I am open to suggestions on what additional function could be added.
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: Info Workbench - Help with icons please.

Post by jriegel »

Nice module! Thanks
I would integrate it into the Part module, and later into Assembly (which is IMO the right place).
Stop whining - start coding!
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Info Workbench - Help with icons please.

Post by jmaustpc »

Hi Keith
There is an existing icon in "Part" work bench which I imagine you could use for this, or similar, function.

See
/freecad/src/Mod/Part/Gui/Resources/icons/Part_ShapeInfo.svg

I think this is an import missing functionality in freecad, I know it is there in Python, but I mean as a gui tool. Would be great if you put it in Part work bench as a gui tool, as Jurgen said.

regards

Jim
User avatar
psicofil
Posts: 154
Joined: Thu Dec 15, 2011 11:02 pm

Re: Info Workbench - Help with icons please.

Post by psicofil »

Hi keithsloan52, excelent work..
You could also add the function "length" of the object ? and could also be useful "StaticMoments" Object (Both are available from python) ..;) ..On the other hand I also think it should go in the module part.
Looking at the website of Tango style icons, I found these two that maybe can serve ..

Image Image

Other tango style icons can be found here:http://commons.wikimedia.org/wiki/Tango_icons or of FreeCAD https://sourceforge.net/apps/mediawiki/ ... le=Artwork
Ing. Gomez Lucio
Scope Ingenieria (scopeingenieria.com)
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Info Workbench - Help with icons please.

Post by keithsloan52 »

Thanks for the comments and suggestions

I am working on a different project at the moment nothing to do with FreeCAD.
Hope to get back to this before not too long.

Keith
User avatar
psicofil
Posts: 154
Joined: Thu Dec 15, 2011 11:02 pm

Re: Info Workbench - Help with icons please.

Post by psicofil »

Hello, I made some modifications to the module info. I clarify that I am not a programmer, only a bit of python and pyqt. I share a video with the modifications and the code. Basically add more details and some corrections, and another option for data surfaces and edges. Now the module displays the following options if you select a solid:
- Volume
- Area
- Perimeter
- Mass-center
- Matrix of Moments of Inertia (about COM without rotation about the axis of coordinates)
- Principal Moments of Inertia and the vectors of the principal axis of inertia

If you select an area (or several) or edges (or several)
- Length
- Area

Video: http://www.youtube.com/watch?v=SRSp0-P5 ... e=youtu.be

Sorry, for my bad English
Attachments
Info.zip
CODE
(6.04 KiB) Downloaded 304 times
Ing. Gomez Lucio
Scope Ingenieria (scopeingenieria.com)
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Info Workbench - Help with icons please.

Post by NormandC »

That's great work! :)

The surface area tool and edge length are very nice.

Thanks!

I wonder if it would be possible to make this module multilingual and that it adopts the system language.

We need different icons too!
mario52
Veteran
Posts: 4690
Joined: Wed May 16, 2012 2:13 pm

Re: Info Workbench - Help with icons please.

Post by mario52 »

Hi
great work
I was preparing the same thing with refresh
I was more the name of objects, converter, density, angle xy, yz, xz of the object
If you could add it would be nice

my to Sorry, for my bad English
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
User avatar
psicofil
Posts: 154
Joined: Thu Dec 15, 2011 11:02 pm

Re: Info Workbench - Help with icons please.

Post by psicofil »

Update the code to add the functions:
-- refresh
-- Name of the selected object
Update module icon

Later I will see how it works multilanguage, because I do not know how. And also how to add icons in the toolbar
We must also make a cleaner code.
For density is always 1 [kg / mm ^ 3], at least until ready module materials. Another option would be to ask before density and then do the math correct mass and moments of inertia.
Other useful things might be a button that prints the results in a. txt file.
Select vertexes and know their coordinates, and if I select 2 vertexes to know the differences of distances on each axis (Dx, Dy, Dz)
If someone with more experience in programming wants to help is welcome :ugeek:

Sorry, for my bad English
Attachments
Info.zip
(6.96 KiB) Downloaded 263 times
Ing. Gomez Lucio
Scope Ingenieria (scopeingenieria.com)
User avatar
yorik
Founder
Posts: 13659
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Info Workbench - Help with icons please.

Post by yorik »

Very good work! This module is becoming very interesting!
Outputting to a text file is not hard, there is a ready-to-use qt dialog, that you can use like this:

Code: Select all

from PyQt4 import QtGui
filename = QtGui.QFileDialog.getOpenFileName(QtGui.qApp.activeWindow(),'Save a text file','*.txt')
myfile = open(filename)
myfile.write("some string\n")
myfile.write("something else")
myfile.close()
Making things multilingual is a bit harder, because you must create special translation files, etc. But if you are interested to do it I can explain more step-by-step.
Post Reply