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.

Please Log in 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.

Attachment hal_sigs_graphviz.txt not found

Please Log in 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 .

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 .

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.

Please Log in to join the conversation.

More
4 years 7 months ago #238783 by Muecke
                      

Please Log in 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.

Please Log in 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 to join the conversation.

More
1 year 7 months ago #325091 by pgf
I didn't say I'd used it. ;-)

Okay, okay, I did! It's definitely more useful for looking at small sections of the HAL.
The whole thing is a little too much for the tool, but if there's a subset that you're trying to understand better, it's definitely useful.

Thanks for writing it -- I found it because I was setting out to do the exact same thing, also using graphviz, but decided I should look around to see what was already available. You saved me a bunch of work!

paul

Please Log in to join the conversation.

Time to create page: 0.188 seconds
Powered by Kunena Forum