Graph object export scripts

2686
5
04-19-2013 12:57 AM
StevenHartin
New Contributor
Hello, I'm wondering if it's possible to attach export script whilst exporting graph objects? It seems on initial inspection that you can only attach an export script to the shape exports. I'm trying to export the network nodes / splines to a different format; is this possible using python during the export pipeline? I would much prefer it to be part of the pipeline as opposed to an external script to parse the data from the file format which is generated by CityEngine.

Thank you in advance

-Steven
Tags (3)
0 Kudos
5 Replies
MatthiasBuehler1
Frequent Contributor II
Hi !

You have to differentiate between Model Generation ( Anything related to CGA BASED ON SHAPES ) vs. creating shapes.

You want to export street graphs via a script, that is possible, by calling the export context of e.g. a GDB, where you export to. So yes, that's possible. But note the difference between exporting graph segments, shapes or models ( after CGA model generation.)



Ok ?
0 Kudos
StevenHartin
New Contributor
Thank you for the reply. I understand I can dump out the node information, but what I was looking for was a mixture between shape information / node data. Essentially I wanted spline data from the network, but it looks like I'm gonna have to loop through the shape information and create my own 'node data' based from the shape data.

I have a couple of other questions though:

  • Is there any way to use ce.getAttribute() on an attribute which has a default value. I.E if "type" is set to "Crossing (Default)" within a Node, is there any way to retrieve the "Crossing" value for the "/ce/crossing/type" key? Attempting to access that key will return None if the attribute has not been overriden. If I manually set it to Crossing so it changes from a default-value to a user-defined value then the correct value appears.

  • Is there any way to get the segment objects which are joined to a Node?

  • Is there any way to get the associated shape object created from a Node?


If these are possible, it will simplify my script quite a bit. If not, then I will have to generated the shapes based on geometric data which I would prefer not to do due to execution time and programming time.

Thank you in advance

-Steven
0 Kudos
MatthiasBuehler1
Frequent Contributor II
Hey !

Sorry for the late reply.

Sadly, there's no direct ways to access those relationships.

But take a close look at the UUID structure ( info tab in the Inspector ) of the selected shapes, nodes, graph segments.

E.g. for a block it's like this :

qeorthuq3498y5dkfn93h45 = block UUID
qeorthuq3498y5dkfn93h45:1 = 1st block shape
..


You may have to loop over the shapes to find those connections.

Let me know if this helps you further so far.

Matt
0 Kudos
StevenHartin
New Contributor
Thank you for the reply. I didn't know about the UUID relationship so I went with the geometric ways instead.

What I wanted was a list of quads for each road and the widths of the roads. The way in which I did this was to sort the list of vertices into a list of quads by checking for coplanar vertices and CCW order. Using these quads I was able to find connecting junction information by finding matching vertices (or near matching). I joined the road system up in the same fashion.

The only thing I'm missing now is the ability to query rule information which I'm guessing is not available through Python. I think the only possible way of finding out the rule information is through the report system right? I'd be interested to know if there was a better way to find out the default rule values of an object without forcing a user defined value.

Thank you in advance
0 Kudos
MatthiasBuehler1
Frequent Contributor II
Hi ..

Yes, I'd use reporting to collect data, report it, then write it out.

This thread may give you some more inputs on using reporting to export metadata ..

http://forums.arcgis.com/threads/64088-Vehicle-placement-on-CityEngine-generated-streets.


Concerning the other question :
I asked here.

This is actually something which is not working until you trigger the source of the attr to be 'user'.

Think of it like this :

The node has a set of attributes which trigger the street creation algorithm with a certain set of parameters, ONE DIRECTIONAL. Means if the algorithm's default value is not accessible in the node object. So if the node does not have the attribute, the default value is triggered within the street creation function. Thus, you can not access those default values.

But note that if you set the source to user, the ce.getAttributeList() will then list ['/ce/crossing/type', '/ce/name'], so adding the user set value to the parameter list of the node. Setting the source back to (Default) does not delete that attr again.

So in your case, just use the methodology you found out.

Ok ?
0 Kudos