Visualizing hal nets with graphviz

More
14 years 11 months ago #14592 by kostas
I'm learning some python and I needed a quick hack to get a visual map on hal nets, so I made this little python script that reads input from "halcmd show" and outputs a graphviz file. Maybe you will find it useful.

You need to:
1) install graphviz, using "sudo apt-get install graphviz"
2) download the hal_sigs_graphviz.py attachment in a directory of your choice.
3) make a shell script inside the same dir, with the following lines in it and run it:
Code:
halcmd -s show pin | grep "==" > pin.out halcmd -s show sig | grep -v "^$" > sig.out python hal_sigs_graphviz.py > gv.in dot -Tpng gv.in > gv.png

Attached is an example of what I get when running it with my (stepconf generated) hal configuration I use on my first cnc router. Tables are components and circles are nets.

I will probably add more features like colors and some fine tuning on how graphviz outputs the image, when I find some time to learn more about this excellent application. But it's probably good enough for a quick visualization as it is now.
The following user(s) said Thank You: TurBoss, ikkuh, Muecke

Please Log in or Create an account to join the conversation.

More
14 years 11 months ago #14594 by kostas
Forum does not let me attach a .py file, so I renamed it as .txt. You need to rename it back as a .py

I also had to resize the image file.

File Attachment:

File Name: hal_sigs_graphviz.txt
File Size:2.3 KB
image missing http://www.linuxcnc.org/media/kunena/attachments/legacy/images/gv_resized.png
The following user(s) said Thank You: tjtr33, TurBoss, Muecke

Please Log in or Create an account to join the conversation.

More
4 years 7 months ago #238609 by Muecke
-- DE --
DANKE für das kleine jedoch sehr Effiziente Tool.

Es hilft mir sehr die HAL Daten einzuordnen was ich erstelle oder auch nicht image missing /media/kunena/emoticons/laughing.png.

DANKE, machen Sie weiter so!

Beim Ausführen hatte ich Probleme, mir war nicht bewusst das LinuxCNC gestartet sein muss. Es wird die Aktuelle HAL von LinuxCNC dargestellt.

-- EN --
THANK YOU for the small but very efficient tool.

It helps me a lot to classify the HAL data what I create or not image missing /media/kunena/emoticons/laughing.png.

THANK YOU, keep up the good work!

I had problems running it, I wasn't aware that LinuxCNC had to be started. The current HAL of LinuxCNC is displayed.
The following user(s) said Thank You: kostas

Please Log in or Create an account to join the conversation.

More
4 years 7 months ago - 4 years 6 months ago #238783 by Muecke
                      
Last edit: 4 years 6 months ago by Muecke.

Please Log in or Create an account to join the conversation.

More
1 year 7 months ago #324928 by pgf
I took the liberty of upgrading the original python, posted above, from python2 to python3. Attached.  Somehow the filename got changed somewhere along the way.  Sorry 'bout that.
The following user(s) said Thank You: kostas, tommylight

Please Log in or Create an account to join the conversation.

More
1 year 7 months ago #325079 by kostas
Hey, nice to know that this has been used by someone!

Please Log in or Create an account to join the conversation.

Time to create page: 0.518 seconds
Powered by Kunena Forum