Getting Z coordinates

9 views
Skip to first unread message

afaulco...@googlemail.com

unread,
Sep 22, 2008, 10:22:59 AM9/22/08
to pydot
Hi,

Just for fun, I'm trying to make a little Graphviz to PovRay
converter in Python. However, edges dont have z-coordinates.
Therefore, I want to get the Z-coordinates of the nodes at each end of
the edge and interpolate between them.

The problem is that I cant seem to get the Z coordinate of a node
more than once. I can read it fine when I place the node itself
(although I seem to get a lot of non-existent nodes), but then when I
loop over the edges I only get None for the z-attribute of the nodes
(either directly of via get_z()).

import pydot
data = pydot.graph_from_dot_file("data.dot")
for edge in data.get_edge_list():
print data.get_node(str(edge.get_source())).z
print data.get_node(str(edge.get_source())).get_z()

Any idea what the problem is? My dot file looks like:

digraph G {
graph [overlap=false, dim=3, dimen=3, bgcolor=transparent];
node [label="\N"];
graph [bb="0,0,519,489"];
n0 [label=11, style=filled, fontcolor=gray, fillcolor=black, z=80,
pos="65,423", width="0.75", height="0.51"];
n20 [label=12, style=filled, fontcolor=gray, fillcolor=black, z=76,
pos="254,222", width="0.75", height="0.51"];
n20 -> n0 [pos="e,80,407 239,238 206,273 126,359 87,400"];
}


Many Thanks!

Adam
Reply all
Reply to author
Forward
0 new messages