<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: graph network layer attributes not mapping in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/graph-network-layer-attributes-not-mapping/m-p/120838#M1648</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Christian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a question regarding your Python script. Did it work?&lt;BR /&gt;I am using CE Python API and came into your topic. I want to know why didn't you put the variables "set_name" and "get_name" inside quotation marks in setAttribute and getAttribute methods?! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Jul 2016 09:40:14 GMT</pubDate>
    <dc:creator>MohsenNazemi</dc:creator>
    <dc:date>2016-07-14T09:40:14Z</dc:date>
    <item>
      <title>graph network layer attributes not mapping</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/graph-network-layer-attributes-not-mapping/m-p/120836#M1646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm attempting to implement a custom layer attribute rule for graph networks, but am running into some trouble. I modified the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;&lt;STRONG&gt;ce.lib\shp.ceattr&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt; file so I could automatically adjust graph network parameters from specific shapefile attributes (generated through a schema I regularly use). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The street width adjusts, but the sidewalk widths don't. Even if I remap the attributes directly to the shapefile, where I know there are values &amp;gt; 0 (instead of relying on an expression in the rule), still no go. The attached image shows how it looks in CE. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Other than adding a new attribute for the new landWidth parameter, I haven't changed anything since implementing this successfully code in version 2012.1...?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The layer attribute rule is as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;// Shape Tag Mapping

streetscale = 1&amp;nbsp; // street width scale factor

width = getObjectAttr("width")
swide = getObjectAttr("sidewalk")
lwide = getObjectAttr("VEH_WIDE")

check = getObjectAttr("ROW_WIDE")

default_road = 0
default_side = 0

attr streetWidth = 
 case check == 0:
&amp;nbsp; default_road * streetscale 
 else:
&amp;nbsp; width * streetscale
&amp;nbsp; 
attr sidewalkWidthLeft = 
 case check == 0: 
&amp;nbsp; default_side * streetscale 
 else:
&amp;nbsp; swide * streetscale
&amp;nbsp; 
attr sidewalkWidthRight =
 case check == 0: 
&amp;nbsp; default_side * streetscale 
 else:
&amp;nbsp; swide * streetscale
&amp;nbsp; 
attr laneWidth = 
 case check == 0:
&amp;nbsp; default_road * streetscale 
 else:
&amp;nbsp; lwide * streetscale&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]32546[/ATTACH]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Mar 2014 23:10:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/graph-network-layer-attributes-not-mapping/m-p/120836#M1646</guid>
      <dc:creator>ChristianGass</dc:creator>
      <dc:date>2014-03-26T23:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: graph network layer attributes not mapping</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/graph-network-layer-attributes-not-mapping/m-p/120837#M1647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;For those interested, I created a work around with Python, which is shown below. It seems to be a more robust approach than my previous fiddling with the ce.lib\shp.ceattr file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;from scripting import *

# get a CityEngine instance
ce = CE()

# helper function
def update_attr(shape, get_name="", set_name="",check_name=""):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """helper function: used to get attribute values from the shape and 
&amp;nbsp;&amp;nbsp;&amp;nbsp; set them in the layer"""
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # get the value from the shape attribute that will be written 
&amp;nbsp;&amp;nbsp;&amp;nbsp; value = ce.getAttribute(shape, get_name)
&amp;nbsp;&amp;nbsp;&amp;nbsp; # get the check value from the shape that will be written
&amp;nbsp;&amp;nbsp;&amp;nbsp; check = ce.getAttribute(shape, check_name)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; if check == 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ce.setAttribute(x , set_name, 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ce.setAttribute(x, set_name, value)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; ce.setAttributeSource(x, "/ce/street/%s" % set_name, "OBJECT") 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 

# selection
graph_network = ce.getObjectsFrom(ce.selection())

# iteration
for x in graph_network:
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # check parameter
&amp;nbsp;&amp;nbsp;&amp;nbsp; check_name = "check_attr"
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # run update function for each attribute
&amp;nbsp;&amp;nbsp;&amp;nbsp; update_attr(x, "in_carriageway", "street_width", check_name)
&amp;nbsp;&amp;nbsp;&amp;nbsp; update_attr(x, "outside_carriageway", "sidewalkWidthLeft", check_name)
&amp;nbsp;&amp;nbsp;&amp;nbsp; update_attr(x, "outside_carriageway", "sidewalkWidthRight", check_name)
&amp;nbsp;&amp;nbsp;&amp;nbsp; update_attr(x, "lane_width", "laneWidth", check_name)

if __name__ == '__main__':
&amp;nbsp;&amp;nbsp;&amp;nbsp; pass&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm still wondering why my modified &lt;/SPAN&gt;&lt;STRONG style="font-style: italic;"&gt;ce.lib\shp.ceattr&lt;/STRONG&gt;&lt;SPAN&gt; file wasn't working, though...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:01:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/graph-network-layer-attributes-not-mapping/m-p/120837#M1647</guid>
      <dc:creator>ChristianGass</dc:creator>
      <dc:date>2021-12-11T07:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: graph network layer attributes not mapping</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/graph-network-layer-attributes-not-mapping/m-p/120838#M1648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Christian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a question regarding your Python script. Did it work?&lt;BR /&gt;I am using CE Python API and came into your topic. I want to know why didn't you put the variables "set_name" and "get_name" inside quotation marks in setAttribute and getAttribute methods?! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2016 09:40:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/graph-network-layer-attributes-not-mapping/m-p/120838#M1648</guid>
      <dc:creator>MohsenNazemi</dc:creator>
      <dc:date>2016-07-14T09:40:14Z</dc:date>
    </item>
  </channel>
</rss>

