Info Workbench - Help with icons please.

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
keithsloan52
Posts: 1031
Joined: Mon Feb 27, 2012 5:31 pm

Info Workbench - Help with icons please.

Postby keithsloan52 » Fri Nov 09, 2012 7:21 pm

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
Site Admin
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: Info Workbench - Help with icons please.

Postby jriegel » Mon Nov 12, 2012 9:39 am

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
Posts: 9566
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Info Workbench - Help with icons please.

Postby jmaustpc » Tue Nov 13, 2012 1:43 am

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.

Postby psicofil » Tue Nov 13, 2012 3:05 am

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
Posts: 1031
Joined: Mon Feb 27, 2012 5:31 pm

Re: Info Workbench - Help with icons please.

Postby keithsloan52 » Wed Nov 14, 2012 1:14 pm

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.

Postby psicofil » Sat Jul 27, 2013 3:13 am

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 195 times
Ing. Gomez Lucio
Scope Ingenieria (scopeingenieria.com)
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Info Workbench - Help with icons please.

Postby NormandC » Sat Jul 27, 2013 4:37 am

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
Posts: 2682
Joined: Wed May 16, 2012 2:13 pm

Re: Info Workbench - Help with icons please.

Postby mario52 » Sat Jul 27, 2013 12:23 pm

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, Dialog creation. My macros on Gist.github.
User avatar
psicofil
Posts: 154
Joined: Thu Dec 15, 2011 11:02 pm

Re: Info Workbench - Help with icons please.

Postby psicofil » Sat Jul 27, 2013 5:07 pm

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 166 times
Ing. Gomez Lucio
Scope Ingenieria (scopeingenieria.com)
User avatar
yorik
Site Admin
Posts: 11574
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Info Workbench - Help with icons please.

Postby yorik » Sat Jul 27, 2013 5:39 pm

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.