Info Workbench - Help with icons please.

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
mario52
Posts: 2804
Joined: Wed May 16, 2012 2:13 pm

Re: Info Workbench - Help with icons please.

Postby mario52 » Sat Jul 27, 2013 7:25 pm

hi
I downloaded your new version but FreeCAD disappears after a refresh! (Vista sp2 / freecad 0.13 1828)
I would like to see the name of the selected object ex: Edge3

Code: Select all

# -*- coding: utf-8 -*-
# Liste les composantes Edge d'un objet
# List the Edge of an object components
sel = FreeCADGui.Selection.getSelection() # Sélectionnez un objet avec la souris
for j in enumerate(sel[0].Shape.Edges):
    name = "Edge%d" % (j[0]+1)
    #fillets.append(name)
    print name
a function to determine the inclination of a line with 2 vectors in the xy, yz, zx plan

Code: Select all

# -*- coding: utf-8 -*-
# inclinaison d'un objet sélectionné

from math import sqrt, pi, sin, cos, asin, acos, atan, atan2, degrees

def angle2(vecteur_x1,vecteur_y1,vecteur_x2,vecteur_y2,mode):
# calcul de l'inclinaison d'une ligne à partir de deux Vecteurs
# si "mode" = 1 alors affichage en degrès sinon en radian
    try:
        deltaX = vecteur_x2 - vecteur_x1
        deltaY = vecteur_y2 - vecteur_y1
        if mode ==1:
            angle = degrees(atan2(deltaY,deltaX)) # degrès
        else:
            angle = atan2(deltaY,deltaX)          # radian
        return angle
    except:
        return "-"

sel = FreeCADGui.Selection.getSelection() 
mode = 1   # 1=degrès  0=radian
try:
    print "Plan xy ",angle2(sel[0].Shape.Vertexes[0].Point[0],sel[0].Shape.Vertexes[0].Point[1],sel[0].Shape.Vertexes[1].Point[0],sel[0].Shape.Vertexes[1].Point[1],mode)
    print "Coor xy [",sel[0].Shape.Vertexes[0].Point[0]," ",sel[0].Shape.Vertexes[0].Point[1],"] , [",sel[0].Shape.Vertexes[1].Point[0]," ",sel[0].Shape.Vertexes[1].Point[1],"]"
except:
    None
    print
try:
    print "Plan yz ",angle2(sel[0].Shape.Vertexes[0].Point[1],sel[0].Shape.Vertexes[0].Point[2],sel[0].Shape.Vertexes[1].Point[1],sel[0].Shape.Vertexes[1].Point[2],mode)
    print "Coor yz [",sel[0].Shape.Vertexes[0].Point[1]," ",sel[0].Shape.Vertexes[0].Point[2],"] , [",sel[0].Shape.Vertexes[1].Point[1]," ",sel[0].Shape.Vertexes[1].Point[2],"]"
except:
    None
    print
try:
    print "Plan zx ",angle2(sel[0].Shape.Vertexes[0].Point[2],sel[0].Shape.Vertexes[0].Point[0],sel[0].Shape.Vertexes[1].Point[2],sel[0].Shape.Vertexes[1].Point[0],mode)
    print "Coor zx [",sel[0].Shape.Vertexes[0].Point[2]," ",sel[0].Shape.Vertexes[0].Point[0],"] , [",sel[0].Shape.Vertexes[1].Point[2]," ",sel[0].Shape.Vertexes[1].Point[0],"]"
except:
    None
print  
and for converting a second window in inch...
I had expected also the BoundBox
PS:Why use 2 separate buttons and do not all put in the same window ?
mario
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 10:06 pm

Hello, already add the names of the faces and the edges (they were there, just had to show them), also fix the buttons.

About the BoundBox, you want an icon to display in the 3D view as does the object data tab, or definitive characteristics of BoundBox with:

Code: Select all

import FreeCADGui
import Part
s = Gui.Selection.getSelectionEx()
s = Part.Solid(p)
s.BoundBox
With respect to the units was thinking of doing a Macro convertor units and add an interface with pyqt.

I made a new video showing the progress. http://www.youtube.com/watch?v=broSW9iuU9s

I think the best will make a roadmap of what to do:

example:
- Icons
- Export to txt
- Position and solid angle
A new tool to vertex and edges
- Position of vertex
- Difference of position and distance between vertices
- Angle between two edges
- Show the principal axes of inertia
- Make the module multilanguage (Yorik, if you have a guide on how to do it step by step would be great)

Since I did me an account on GitHub, I have to learn to use it and so can handle the code from there, what do you think?

Tomorrow I test in Windows, to see what the problem mario52.
We can discuss the roadmap here or in a new post?
Sorry for my bad English
Attachments
Info.zip
CODE
(6.85 KiB) Downloaded 103 times
Ing. Gomez Lucio
Scope Ingenieria (scopeingenieria.com)
User avatar
yorik
Site Admin
Posts: 11645
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 10:37 pm

psicofil wrote:Since I did me an account on GitHub, I have to learn to use it and so can handle the code from there, what do you think?
Yes that is the best way to do, you can keep your stuff in sync with the latest master version of freecad, and at the same time you can publish your stuff there, and it is very easy for other people to test your work (no need to download, unzip, etc).

To make multilanguage support:

1) add this add the beginning of each file that contains translatable text:

Code: Select all

from DraftTools import translate
2) change all texts like this:

Code: Select all

"This is my nice text!"
becomes:

Code: Select all

translate("info","This is my nice text!")
3) install package pyqt4-dev-tools on your system, or, if you are on windows, I'm not sure how to do but you need a program called pylupdate (or pylupdate4) and run pylupdate4 from your module directory, like this:

Code: Select all

pylupdate4 *.py -ts info.ts
This will crawl through all your .py files, and grab all the strings that are inside a translate() function, and copy them into a info.ts file. It is important that the name of your .ts file is the same name as in the translate() function

Basically that is all you need to do yourself. After that, we put the info.ts on crowdin, and let people translate it. When we have enough translations, I'll show you how to load those translations at module start, but it's easy, just a matter of adding this at module start:

Code: Select all

FreeCADGui.addLanguagePath(FreeCAD.ConfigGet("AppHomePath")+"/Mod/Path/To/Your/Translations")
User avatar
psicofil
Posts: 154
Joined: Thu Dec 15, 2011 11:02 pm

Re: Info Workbench - Help with icons please.

Postby psicofil » Mon Jul 29, 2013 10:39 pm

I made ​​new progress:
Thanks to yorik we can export the results to a. Txt.

But I've been thinking, because there is a lot of information to show, how about if we divide the options:

1) Data of solid geometry (area, volume, length, position, rotation)
2) physical properties (density (data that enters the user), mass, moments of inertia,principal moments of inertia, principal axes of inertia (if the axes are symmetry or not))
3) Info about the solid (name, type, bound box, name the faces, vertices and lines that compose it, childrens)
4) Data geometric faces and lines (area, length, direction)
5) Data on vertices (position, distance in x, y, z, distance to another vertex)

What do you think? any more information?

sorry for my bad English
Ing. Gomez Lucio
Scope Ingenieria (scopeingenieria.com)
mario52
Posts: 2804
Joined: Wed May 16, 2012 2:13 pm

Re: Info Workbench - Help with icons please.

Postby mario52 » Tue Jul 30, 2013 9:52 am

Hi
This is what I am doing (provisional presentation)
voila ce que je suis en train de faire (présentation provisoire)

Image

PS: the "inclination of a selected object" formula above I would like to a confirmation on the name "XY, YZ, ZX plane" and the accuracy of the display of the form onscreen (I doubt it!)
PS: pour la formule "inclinaison d'un objet sélectionné" plus haut je voudrais une confirmation sur la dénomination " plan XY, YZ, ZX " et la justesse de l'affichage de la forme à l'écran (je doute !)
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 » Sun Aug 25, 2013 12:03 am

Good job Mario, sorry for delay in reply, yesterday I finally finished of the university exams. We see that you are a very good programmer qt, hope your module info this soon available :P . Personally I think it is better to divide the information, because all together can be confusing and the user will be missed.
I Upload a video so you can see the option to save to txt, for suggestions :arrow: . http://www.youtube.com/watch?v=edXMhbL3WJA
I created an account on github and I could compile the module info on Linux, please someone can test on Linux in addition to Windows.
https://github.com/psicofil/InfoModule

Also I have an icon for the information areas and vertexes:
Image

I do not think it is necessary an option to save in txt, in the case of areas and vertexes, so which eliminates that option.

The next step is to do multilanguage

regards. Sorry for my bad English
Ing. Gomez Lucio
Scope Ingenieria (scopeingenieria.com)
User avatar
psicofil
Posts: 154
Joined: Thu Dec 15, 2011 11:02 pm

Re: Info Workbench - Help with icons please.

Postby psicofil » Fri Aug 30, 2013 4:17 am

Hello everyone.Thanks to Marian Gaudix (http://www.taringa.net/marianxs) has made a couple of icons for the module info :D . Here they are, what they look better :?:
first pair of icons:

Image Image

second pair of icons:

Image Image

The first icon is for the physical properties and the second for geometric properties of surfaces and vertexes
Everyone has SVG format and are sized 64x64. (Here only went up the images in PNG, so they can see them)
Sorry for my bad english.
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 » Fri Aug 30, 2013 4:21 am

They look nice, the problem is they don't follow the FreeCAD guidelines. They would look totally out of place.
User avatar
yorik
Site Admin
Posts: 11645
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Info Workbench - Help with icons please.

Postby yorik » Fri Aug 30, 2013 1:54 pm

It is true that they are a bit different in style than the rest of the freecad icons, but as a workbench icon think it's not too important...
One thing I think, though: Workbench icons appear as 16x16px in the workbenches dropdown list. Maybe the white symbol on the icons will be hard to recognize at that resolution...
User avatar
psicofil
Posts: 154
Joined: Thu Dec 15, 2011 11:02 pm

Re: Info Workbench - Help with icons please.

Postby psicofil » Sun Sep 01, 2013 8:21 am

OK I'll work a bit more on the icons. thanks
Ing. Gomez Lucio
Scope Ingenieria (scopeingenieria.com)