<?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: ArcGIS Pro IObjectCopy or Similar in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-iobjectcopy-or-similar/m-p/1659131#M13207</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can use EditOperation &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic22199.html" target="_self"&gt;Copy&lt;/A&gt; method. Below is code for map selection copy layer by layer:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;			var mv = MapView.Active;

			return QueuedTask.Run(() =&amp;gt;
			{

				var sel_set = mv.Map.GetSelection().ToDictionary();
				if (sel_set.Count() == 0)
					return false;

				//do the copy
				var editOp = new EditOperation()
				{
					Name = "Copy",
					ErrorMessage = "Copy failed"
				};

				foreach (var kvp in sel_set)
				{
					editOp.Copy(kvp.Key, kvp.Key, kvp.Value);
                }
				return editOp.Execute();
			});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Oct 2025 18:28:55 GMT</pubDate>
    <dc:creator>GKmieliauskas</dc:creator>
    <dc:date>2025-10-20T18:28:55Z</dc:date>
    <item>
      <title>ArcGIS Pro IObjectCopy or Similar</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-iobjectcopy-or-similar/m-p/1659109#M13206</link>
      <description>&lt;P&gt;In the ArcGIS 10 SDK I copied an object by value using the IObjectCopy interface. I can't find a similar thing in the ArcGIS Desktop SDK. I guess its available in the Enterprise SDK but that's not what i am working with. So, what would be equivalent code in Pro if I had this in ArcGIS 10?&lt;/P&gt;&lt;P&gt;'deep clone the IFeatureSelection because it's possible that the Origin and Proximity sources are the same.&lt;BR /&gt;Dim objectCopyB As IObjectCopy = New ObjectCopy&lt;BR /&gt;Dim objB As Object = objectCopyB.Copy(pFeatSelOriginB)&lt;BR /&gt;Dim pFeatSelOrigCloneB As IFeatureSelection = CType(objB, IFeatureSelection)&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2025 17:42:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-iobjectcopy-or-similar/m-p/1659109#M13206</guid>
      <dc:creator>AbelPerez</dc:creator>
      <dc:date>2025-10-20T17:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro IObjectCopy or Similar</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-iobjectcopy-or-similar/m-p/1659131#M13207</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can use EditOperation &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic22199.html" target="_self"&gt;Copy&lt;/A&gt; method. Below is code for map selection copy layer by layer:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;			var mv = MapView.Active;

			return QueuedTask.Run(() =&amp;gt;
			{

				var sel_set = mv.Map.GetSelection().ToDictionary();
				if (sel_set.Count() == 0)
					return false;

				//do the copy
				var editOp = new EditOperation()
				{
					Name = "Copy",
					ErrorMessage = "Copy failed"
				};

				foreach (var kvp in sel_set)
				{
					editOp.Copy(kvp.Key, kvp.Key, kvp.Value);
                }
				return editOp.Execute();
			});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2025 18:28:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-iobjectcopy-or-similar/m-p/1659131#M13207</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2025-10-20T18:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro IObjectCopy or Similar</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-iobjectcopy-or-similar/m-p/1659193#M13208</link>
      <description>&lt;P&gt;ok let me give that a try.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2025 20:49:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-iobjectcopy-or-similar/m-p/1659193#M13208</guid>
      <dc:creator>AbelPerez</dc:creator>
      <dc:date>2025-10-20T20:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro IObjectCopy or Similar</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-iobjectcopy-or-similar/m-p/1659222#M13209</link>
      <description>&lt;P&gt;I'm not sure this is the routine that will give me what i need. I need to clone a feature layer so that I can manipulate it before sending it to a GP. Essentially I want to use a temp layer that is&amp;nbsp; not to be added to the map.&lt;/P&gt;&lt;P&gt;In ArcGIS 10 I did this and it worked great:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If pOriginalFeatLayer Is Nothing Then Throw New ArgumentNullException(NameOf(pOriginalFeatLayer))&lt;/P&gt;&lt;P&gt;'get the feature class (Or feature table) from original layer&lt;BR /&gt;Dim pFeatClass As IFeatureClass = pOriginalFeatLayer.FeatureClass&lt;/P&gt;&lt;P&gt;'create a New FeatureLayer using the same feature class/table (this creates a layer pointing to the same data)&lt;BR /&gt;Dim pCloneFeatLayer As IFeatureLayer = New FeatureLayer With {.FeatureClass = pFeatClass}&lt;/P&gt;&lt;P&gt;'copy basic properties&lt;BR /&gt;pCloneFeatLayer.Name = pOriginalFeatLayer.Name + "_Cloned" 'new name&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;It's just a layer in memory that is for temporay6 work and therefore not needed to be in the map.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2025 22:51:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-iobjectcopy-or-similar/m-p/1659222#M13209</guid>
      <dc:creator>AbelPerez</dc:creator>
      <dc:date>2025-10-20T22:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro IObjectCopy or Similar</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-iobjectcopy-or-similar/m-p/1659243#M13211</link>
      <description>&lt;P&gt;There is no possibility to have map layer not added to map. You can use &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/copy-features.htm" target="_self"&gt;Copy Features&lt;/A&gt; GP tool and as an output use memory workspace&lt;/P&gt;&lt;LI-CODE lang="c"&gt;            //get the active map
            MapView activeView = MapView.Active;
            //get the first layer in the active map
            var layer = activeView.Map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;().First();
            if(layer == null)
                return; 

            var parameters = Geoprocessing.MakeValueArray(layer, @"memory\clonedFC");

            IGPResult result = await Geoprocessing.ExecuteToolAsync("CopyFeatures_management", parameters, null, null, null, GPExecuteToolFlags.AddToHistory);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2025 06:40:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-iobjectcopy-or-similar/m-p/1659243#M13211</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2025-10-21T06:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro IObjectCopy or Similar</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-iobjectcopy-or-similar/m-p/1659296#M13212</link>
      <description>&lt;P&gt;What about creating a map in memory and adding the layer to that?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2025 13:26:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-iobjectcopy-or-similar/m-p/1659296#M13212</guid>
      <dc:creator>AbelPerez</dc:creator>
      <dc:date>2025-10-21T13:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro IObjectCopy or Similar</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-iobjectcopy-or-similar/m-p/1659331#M13213</link>
      <description>&lt;P&gt;Sorry, I can't help you to create a map in memory.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2025 15:02:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-iobjectcopy-or-similar/m-p/1659331#M13213</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2025-10-21T15:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro IObjectCopy or Similar</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-iobjectcopy-or-similar/m-p/1659381#M13214</link>
      <description>&lt;P&gt;Ok here is what i have an it seems to work without exceptions. I haven't tried sending this to my GP so that's the second part of the challenge.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// do the basic clone of the layer
Map map = null;
FeatureLayer cloneFeatLayer = null;
await QueuedTask.Run(() =&amp;gt;
{
    // we create the layer and do not display in the active map but instead we will
    // create a map in memory and add the layer to this temporary map.
    map = MapFactory.Instance.CreateMap("ForCloneLayer", MapType.Map);

    // get the URI of the original layer
    Uri uri = originalFeatLayer.GetPath();
    Debug.Print($"uri=[{uri}]");

    // create feature layer creation parameters. for this routine we will only need the basics.
    var flyrCreatnParam = new FeatureLayerCreationParams(uri)
    {
        Name = originalFeatLayer.Name + "_Cloned",
        IsVisible = false,
        DefinitionQuery = null,
        //MinimumScale = 1000000,
        //MaximumScale = 5000,
        //DefinitionQuery = new DefinitionQuery(whereClause: "Population &amp;gt; 100000", name: "More than 100k"),
        //RendererDefinition = new SimpleRendererDefinition()
        //{
        //    SymbolTemplate = SymbolFactory.Instance.ConstructPointSymbol(CIMColor.CreateRGBColor(255, 0, 0), 8, SimpleMarkerStyle.Hexagon).MakeSymbolReference()
        //}
    };

    cloneFeatLayer = LayerFactory.Instance.CreateLayer&amp;lt;FeatureLayer&amp;gt;(flyrCreatnParam, map);
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then calling it like so&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// test the cloning
FeatureLayer originCloneLayer = await lyrOrigin.GetBasicClone();

originCloneLayer = null;

// just for testing
GC.Collect();
GC.WaitForPendingFinalizers();&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2025 16:51:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-iobjectcopy-or-similar/m-p/1659381#M13214</guid>
      <dc:creator>AbelPerez</dc:creator>
      <dc:date>2025-10-21T16:51:46Z</dc:date>
    </item>
  </channel>
</rss>

