<?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 How to add a representation applied feature class to mxd using Arcpy in Mapping Questions</title>
    <link>https://community.esri.com/t5/mapping-questions/how-to-add-a-representation-applied-feature-class/m-p/421526#M4558</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having a difficulty adding representation applied feature class to mxd using ArcPy.&amp;nbsp; The below code adds representation to the feature class, but the resulting map doesn't show applied representation instead, it adds 'Single symbol'.&amp;nbsp; Do I have to save it to .lyr after adding representation layer to feature class in order to add it to mxd?&amp;nbsp; I prefer not to create another layer, but if it is the only way, would you please tell me how to save the representation added feature class to .lyr?&amp;nbsp; I tried to save the same to .lyr (SaveToLayerFile_management), but it wasn't successful.&amp;nbsp; I would very much appreciate if you could provide me any assistance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: Please ignore typos in below code.&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;import arcpy &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;arcpy.env.workspace = 'C:/data/data.gdb' &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;out_fc = 'lines' &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;relocate_rep = 'C:/data/relocate_rep'&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;mxd = "path to mxd file"&lt;/P&gt;&lt;P&gt;dfs = arcpy.mapping.ListDataFrames(mxd)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Add representation&lt;/P&gt;&lt;P&gt;&lt;CODE&gt; &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;arcpy.AddRepresentation_cartography(out_fc, out_fc + '_Rep', 'RuleID', 'Override', 'STORE_CHANGE_AS_OVERRIDE',relocate_rep, 'ASSIGN') &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;arcpy.CalculateField_management(out_fc, 'RuleID', '!symbolID!', 'PYTHON_9.3')&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Add to mxd&lt;/P&gt;&lt;P&gt;lyr = arcpy.mapping.Layer(out_fc)&lt;/P&gt;&lt;P&gt;arcpy.mapping.AddLayer(dfs[0], lyr, 'AUTO_ARRANGE')&lt;/P&gt;&lt;P&gt;mxd.save()&lt;/P&gt;&lt;P&gt;del mxd&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt; &lt;/CODE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 05 Oct 2015 21:46:32 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2015-10-05T21:46:32Z</dc:date>
    <item>
      <title>How to add a representation applied feature class to mxd using Arcpy</title>
      <link>https://community.esri.com/t5/mapping-questions/how-to-add-a-representation-applied-feature-class/m-p/421526#M4558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having a difficulty adding representation applied feature class to mxd using ArcPy.&amp;nbsp; The below code adds representation to the feature class, but the resulting map doesn't show applied representation instead, it adds 'Single symbol'.&amp;nbsp; Do I have to save it to .lyr after adding representation layer to feature class in order to add it to mxd?&amp;nbsp; I prefer not to create another layer, but if it is the only way, would you please tell me how to save the representation added feature class to .lyr?&amp;nbsp; I tried to save the same to .lyr (SaveToLayerFile_management), but it wasn't successful.&amp;nbsp; I would very much appreciate if you could provide me any assistance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: Please ignore typos in below code.&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;import arcpy &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;arcpy.env.workspace = 'C:/data/data.gdb' &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;out_fc = 'lines' &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;relocate_rep = 'C:/data/relocate_rep'&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;mxd = "path to mxd file"&lt;/P&gt;&lt;P&gt;dfs = arcpy.mapping.ListDataFrames(mxd)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Add representation&lt;/P&gt;&lt;P&gt;&lt;CODE&gt; &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;arcpy.AddRepresentation_cartography(out_fc, out_fc + '_Rep', 'RuleID', 'Override', 'STORE_CHANGE_AS_OVERRIDE',relocate_rep, 'ASSIGN') &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;arcpy.CalculateField_management(out_fc, 'RuleID', '!symbolID!', 'PYTHON_9.3')&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Add to mxd&lt;/P&gt;&lt;P&gt;lyr = arcpy.mapping.Layer(out_fc)&lt;/P&gt;&lt;P&gt;arcpy.mapping.AddLayer(dfs[0], lyr, 'AUTO_ARRANGE')&lt;/P&gt;&lt;P&gt;mxd.save()&lt;/P&gt;&lt;P&gt;del mxd&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt; &lt;/CODE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Oct 2015 21:46:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/how-to-add-a-representation-applied-feature-class/m-p/421526#M4558</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2015-10-05T21:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a representation applied feature class to mxd using Arcpy</title>
      <link>https://community.esri.com/t5/mapping-questions/how-to-add-a-representation-applied-feature-class/m-p/421527#M4559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I figured out that what I needed was use of&amp;nbsp; arcpy.MakeFeatureLayer_management and arcpy.SetLayerRepresentation_cartography after adding representations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Oct 2015 16:50:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/how-to-add-a-representation-applied-feature-class/m-p/421527#M4559</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2015-10-06T16:50:39Z</dc:date>
    </item>
  </channel>
</rss>

