Friday, September 30, 2011

Mechanical Engineering Useful Software in Linux

So, as usual, I've no wrote in this space for a long time, but today, as my daughter sleeps like a baby (10 months :P), I've got the time for some writings..
So since my last post, I've acquired a new 13" laptop to replace the good old asus eee 701, I needed a small, fast and good pc for some of my engineering work.
Just in short lines the PC is an Acer Travelmate 8371, and Linux Mint Debian Edition runs very smooth.... only one thing does not work at all, and that is the fingerprint reader, which I don't care at all.. One of the most important things for me in laptops is battery (6 hours) and suspend (all ACPI events works out of the box. Even the intel wireless card work without problems...So I'm very pleased with this little and robust machine...
So, back on the post title.... As I acquired this machine mainly for work, I started filling it up with software that I use on my day to day work (I work for a Portuguese big HVAC contractor, and own my own consulting company), and as you may think, I spend a lot of my time working...
So, starting from the basis...
1 - My desktop, the wood one, is full of interesting stuff, drawings, notes, specifications, catalogs, databooks, material samples, a real mess... so sometimes finding the calculator is hard... so I use the most powerful calculator on Linux... And that is Qcalculate (check the repositories)... Imagine this common situation for me, as manufacturers that I work with around the world all work in different units....
Pressure drop calculation:
- Heat Exchanger - 40kPa
- 3 way valve - 1 bar
- Pipes - 2 mca
etc etc...
So, normally to do this calculation and getting the result in bar, for instance, or you have a good datasheet, or you use qcalculate... just by typing....
"(40kPa+1bar+2mca) to bar" you get the fine answer "1,5960828 bars", note that the mca (column of water meters, very used here) is not one of supplied conversions, but you can program any conversion you want, Qalculate has a big database of units, currency conversion (automatic update of exchange rates), math functions, variables, phisycal constants, etc, etc.... It has capability of solving equations, plot functions, a lot of interesting stuff for you engineers to explore...

2 - So, in the CAD area, I've written a lot about this, but a list of the better ones available native:
Bricscad (Comercial, Autocad Clone),
- Varicad (3D based, for me its the best CAD software available for Linux)
Draftsight (free, Autocad Clone, but no Autolisp),
Ares Commander (the father of Draftsight, comercial, full featured),
 - Freecad (very good, sound promissing),
- QCAD (released a new version, looks a lot better and is cheap)
- Medusa4 (free personal version, very good commercial software)
And you have a lot of others, but for some reason to me are not worthy to be in this list, but here is a link to an updated regularly list of CAD software on Linux I recommend this list, I go there to take a look at the news very often... (thank you)
Remember that I'm writing about software that I really used or use for production purposes, so my opinions are not from a inexperienced person on this type of software.... I've been working with cad software since 1996 :)....

3 - On number 3 we have a non native Linux software, but as they support Linux through wine (and I've bought a license, cough, cough).... I'm talking about SF Pressure Drop 7.0 (7.15 version don't work) a full package software to calculate pressure drop in pipes. It has a full database of pipes, accessories, valves, etc, etc, it also has a full database of fluids (liquids and gases) with all the temperature and pressure properties, states, etc, etc. I also allows you to calculate pumps, reservoirs empty times, economical pipe diameter, etc etc.. It is very complete and deserves a look.
I finish this small review with a screenshot...

4 - I work with a lot of PDF files from OEM's, clients, tables from books, etc, etc, etc... and a lot of times I've to markup those to present to consultants, or simply to note something useful... So I'm talking about PDF annotation and manipulation.
I work with 2 software:
For Annotation I use Xournal (it's on every repository), and it allows me to do something like...

It has a shape recognizer that allow you to do straight lines, and squares, rectangles, circles, etc, etc... Files are saved with .xoj extension, and you can export them to PDF with the annotations, very useful, as it saves a lot of unnecessary printing...
For manipulation I use PDFChain (in repositories also). In the past I used PDFSam, but it is slower to work with due to the interface... So PDFChain allow me to crop, rotate, split and merge PDF's.
5 - On number 5 is Elmer+Gmsh (both on Debian Testing repositories), the software I use to make CFD calculations. I've started using them recently, and as I'm not very familiar, I'll take the option to just talk about the tricks to make them work with DXF files for complex layouts, and the rest of physical and equation stuff you will have to take a look at the software tutorials.... (beside that I'm a lot of rusty in finite element calculation)
So in the first time you draw something on draftsight for instance.... Save it as dxf.... Import it with Gmsh.... Create the mesh... and save mesh as "Mesh - Gmsh MSH (*.msh)" choose version 2 ASCII and "Save All".
Now the trick (that took me a all night to figure this out), open the generated file with a text editor and simply replace the "." (dots) with "," (commas), somehow Elmer mess things up...
Import mesh into Elmer, model the problem, and in the final you can have a result like this...

The above image represents the air speed inside a HVAC plenum, it was just a test, as the problem was not very well formulated, but you can get a idea of what this is capable...
6 - Other software that worth a look (in the repositories)
- Crunchbang - a less powerful calculator the qalculate
- Octave - Matlab Clone
- PSPP - SPSS clone (statistics) - Never tried it
- Electric - Draw electric Schematics (I've tried but I'm a mech engineer... )

So this is it for now.... and as I'm short on time, feel free to follow me on this social networks:
Twitter - @ECA_Engenharia - @pirolocito
We can have a nice talk on a short spare time... And remember, linux is easy....

Thursday, June 23, 2011

#! Crunchbang Statler - Enable Suspend Button on Exit

A few moons ago, I posted how to create a button for #! for suspend the computer on exit, but in those days, Crunchbang was based on Ubuntu, and the software worked diferent.

In the present time, Crunchbang is debian based, so things change a little

The "Exit" command on the openbox main menu opens several buttons so one can choose, those command are:

Cancel, Logout, Reboot and Shutdown

So suspend is out of the list.... those commands are all commands for gdm-control, but gdm-control for suspend is only possible after doing logout, but I wanted to suspend inside the session, so we have to do the trick in other way...

After taking a look at xfce-power-manager, it has suspend function, and after a litle dbus introspection, I found the correct message ( for dbus that does the trick once xfce-power-manager api supports freedesktop directives (I'm not an expert on any of these things, I just catched some lines here and there)


dbus-send \
--session \
--dest=org.freedesktop.PowerManagement \
--type=method_call \
--print-reply \
--reply-timeout=2000 \
/org/freedesktop/PowerManagement \

So, for our How-to....

1 - on a command line sudo gedit /usr/bin/openbox-logout

2 - Change the file where bold text is the new text to add


#!/usr/bin/env python


import pygtk


import gtk

import os


class DoTheLogOut:


    # Cancel/exit

    def delete_event(self, widget, event, data=None):


        return False


    # Logout

    def logout(self, widget):

        os.system("openbox --exit")


    # Reboot

    def reboot(self, widget):

        os.system("gdm-control --reboot && openbox --exit")


    # Shutdown

    def shutdown(self, widget):

        os.system("gdm-control --shutdown && openbox --exit")


    # Suspend

    def suspend(self, widget):

        os.system("dbus-send --session --dest=org.freedesktop.PowerManagement --type=method_call --print-reply --reply-timeout=2000 /org/freedesktop/PowerManagement org.freedesktop.PowerManagement.Suspend")


    def __init__(self):

        # Create a new window

        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)

        self.window.set_title("Exit? Choose an option:")



        self.window.connect("delete_event", self.delete_event)



        # Create a box to pack widgets into

        self.box1 = gtk.HBox(False, 0)



        # Create cancel button

        self.button1 = gtk.Button("_Cancel")


        self.button1.connect("clicked", self.delete_event, "Changed me mind :)")

        self.box1.pack_start(self.button1, True, True, 0)


        # Create logout button

        self.button2 = gtk.Button("_Log out")


        self.button2.connect("clicked", self.logout)

        self.box1.pack_start(self.button2, True, True, 0)


        # Create reboot button

        self.button3 = gtk.Button("_Reboot")


        self.button3.connect("clicked", self.reboot)

        self.box1.pack_start(self.button3, True, True, 0)


        # Create shutdown button

        self.button4 = gtk.Button("_Shutdown")


        self.button4.connect("clicked", self.shutdown)

        self.box1.pack_start(self.button4, True, True, 0)


        # Create suspend button

        self.button5 = gtk.Button("Sus_pend")


        self.button5.connect("clicked", self.suspend)

        self.box1.pack_start(self.button5, True, True, 0)




def main():



if __name__ == "__main__":

    gogogo = DoTheLogOut()


3 - Save the file, and there you go


Hope this is any good for anyone, as it is for me... You can always configure xfce-power-manager to suspend when you do some action, as "close lid" "press power button" etc, etc....

Friday, June 3, 2011

Treepad Alternative - Cherrytree

After a few months I'm back on my writings... My 7 months old daughter take my breath and my time away...

So today I'll be writing about a wonderful project from an Italian programmer, named Giuseppe (aka Giuspen).

As you may notice from the title, Cherrytree is a Treepad alternative, a hierarchical note taking application, and a very good one. It has a lot of advantages comparing to treepad:

1 - It's Open Source and Linux is supported natively
2 - It supports Images, tables and other rich text features
3 - Export to html
4 - Import from treepad and other alike
5 - Syntax highlighting
6 - Save all stuff in a single file

The project is supported by various translators (including me in Portuguese, not completed yet), and others are welcome.

The application runs real fast, can be docked to notification area, and it opens the last saved file. Recently it also allows multiple instances.

Giuspen, has a lot of ideas for making Cherrytree even better. If I could code as good as he, sure I'll give him a boost in Cherrytree, the program I use everyday for taking personal notes, and for work.

Finally one last taught about cherrytree.... What if Debian or Ubuntu packed it in repositories? I believe it would be great for most users that are not aware of this wonderful piece of software.
Made in Portugal