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.
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.)
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 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.
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.