On 6/7/2013 3:37 PM, Peter Jensen wrote:
>   As mentioned, Rockhopper also has a HAL graph visualizer.  It would
>      be simple enough to divorce this from the web server, but right now
>      I'll leave that as an exercise for the reader;-)

Since Peter's Python coding style is so much better than mine, I'll push 
this thought forward so others can share the experience:-)

0) get Rockhopper and install supporting packages, notably graphviz and 
pygraphviz (see 
http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Rockhopper_Web_Server), but 
you've already done that, right?

1) have LinuxCNC running and loaded with a HAL configuration (this is 
necessary so all the .hal files have already been parsed and loaded into 
memory so Peter's code can access the data needed).

2) in a terminal window, make sure the environment variable PATH 
includes the path to your LinuxCNC binaries and the environment variable 
PYTHONPATH includes the path to your LinuxCNC python interface. For 
example, I have been building run-in-place installations from git pulls 
in a linuxcnc-dev directory in my home directory, kreed, so this step means

PATH=/home/kreed/linuxcnc-dev/bin:<other paths>

and

PYTHONPATH=/home/kreed/linuxcnc-dev/lib/python:<possibly other paths>

The easy way to set the environment variables is to source the script 
provided in the distribution (for run-in-place, that is) of the LinuxCNC 
you are running. This means invoking

. <path to LinuxCNC scripts subdirectory>/rip-environment

where the above is typed "dot space" and so on.

In my case, this means invoking

. /home/kreed/linuxcnc-dev/scripts/rip-environment

3) execute the command

  python <path to Rockhopper directory>/MakeHALGraph.py <name of output 
svg file>

So, for example, since I placed the Rockhopper directory in my home 
directory

python /home/kreed/Rockhopper/MakeHALGraph.py fancyschmanzy.svg

generates a file fancyschmanzy.svg file in the current working directory 
from the HAL configuration in my running instance of LinuxCNC.

4) enjoy

---

Obviously one doesn't need to use fully qualified file and directory 
names but I wanted to be error on the side of being pedantic rather than 
cryptic. Obviously, all this could be turned into a self contained, 
do-all script, placed on the desktop with a cool Penguin-related icon, etc.

To make Peter's script read from .hal files independently of LinuxCNC 
would take some work. For my own hal2html, which could read from either 
.hal files or a running LinuxCNC, I write my own naive parser for 
reasons I explained, but one could be bold and hook into the existing 
parser in halcmd. To borrow a phrase from Peter, "I'll leave that as an 
exercise for the reader."

Finally, I have to say this focus on HAL graphs is detracting from the 
other very nice pages that Rockhopper presents to the user. The LinuxCNC 
Configuration Page, for example, is a joy when it comes to examining 
.ini files. Props.

Regards,
Kent


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to