<?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 Intersect Selected Features VBA in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/intersect-selected-features-vba/m-p/59285#M1621</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi i have this code to intersect 2 layers but i want to intersect the selected features in one layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Public Sub Intersect()

' Get the input layer and feature class.
Dim pMxDoc As IMxDocument
Set pMxDoc = ThisDocument
Dim pLayer As ILayer
Set pLayer = pMxDoc.FocusMap.Layer(0)
Dim pInputFeatLayer As IFeatureLayer
Set pInputFeatLayer = player

' Use the Itable interface from the Layer (not from the FeatureClass)
Dim pInputTable As ITable
Set pInputTable = player

' Get the input feature class.
' The Input feature class properties, such as shape type,
' will be needed for the output.
Dim pInputFeatClass As IFeatureClass
Set pInputFeatClass = pInputFeatLayer.FeatureClass

' Get the overlay layer
' Use the Itable interface from the Layer (not from the FeatureClass)
Set pLayer = pMxDoc.FocusMap.Layer(1)
Dim pOverlayTable As ITable
Set pOverlayTable = pLayer

' Error checking
If pInputTable Is Nothing Then
MsgBox "Table QI failed"
Exit Sub
End If

If pOverlayTable Is Nothing Then
MsgBox "Table QI failed"
Exit Sub
End If

' Define the output feature class name and shape type (taken from the
' properties of the input feature class)
Dim pFeatClassName As IFeatureClassName
Set pFeatClassName = New FeatureClassName
With pFeatClassName
.FeatureType = esriFTSimple
.ShapeFieldName = "Shape"
.ShapeType = pInputFeatClass.ShapeType
End With

' Set output location and feature class name
Dim pNewWSName As IWorkspaceName
Set pNewWSName = New WorkspaceName
pNewWSName.WorkspaceFactoryProgID = "esriCore.ShapeFileWorkspaceFactory.1"
pNewWSName.PathName = "C:\temp"

Dim pDatasetName As IDatasetName
Set pDatasetName = pFeatClassName
pDatasetName.Name = "Intersect_result"

Set pDatasetName.WorkspaceName = pNewWSName

' Set the tolerance. Passing 0.0 causes the default tolerance to be used.
' The default tolerance is 1/10,000 of the extent of the data frame???s spatial domain
Dim tol As Double
tol = 0#

' Perform the intersect
Dim pBGP As IBasicGeoprocessor
Set pBGP = New BasicGeoprocessor
Dim pOutputFeatClass As IFeatureClass
Set pOutputFeatClass = pBGP.intersect(pInputTable, False, pOverlayTable, False, tol, pFeatClassName)

' Add the output layer to the map
Dim pOutputFeatLayer As IFeatureLayer
Set pOutputFeatLayer = New FeatureLayer
Set pOutputFeatLayer.FeatureClass = pOutputFeatClass
pOutputFeatLayer.Name = pOutputFeatClass.AliasName
pMxDoc.FocusMap.AddLayer pOutputFeatLayer

End Sub

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i change this line false for true but the code ignore the selection. I hope somebody can help me i need this code so mucho thanks!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pOutputFeatClass = pBGP.intersect(pInputTable, False, pOverlayTable, False, tol, pFeatClassName)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Jun 2011 17:26:21 GMT</pubDate>
    <dc:creator>IRASEMAANGELES</dc:creator>
    <dc:date>2011-06-10T17:26:21Z</dc:date>
    <item>
      <title>Intersect Selected Features VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/intersect-selected-features-vba/m-p/59285#M1621</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi i have this code to intersect 2 layers but i want to intersect the selected features in one layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Public Sub Intersect()

' Get the input layer and feature class.
Dim pMxDoc As IMxDocument
Set pMxDoc = ThisDocument
Dim pLayer As ILayer
Set pLayer = pMxDoc.FocusMap.Layer(0)
Dim pInputFeatLayer As IFeatureLayer
Set pInputFeatLayer = player

' Use the Itable interface from the Layer (not from the FeatureClass)
Dim pInputTable As ITable
Set pInputTable = player

' Get the input feature class.
' The Input feature class properties, such as shape type,
' will be needed for the output.
Dim pInputFeatClass As IFeatureClass
Set pInputFeatClass = pInputFeatLayer.FeatureClass

' Get the overlay layer
' Use the Itable interface from the Layer (not from the FeatureClass)
Set pLayer = pMxDoc.FocusMap.Layer(1)
Dim pOverlayTable As ITable
Set pOverlayTable = pLayer

' Error checking
If pInputTable Is Nothing Then
MsgBox "Table QI failed"
Exit Sub
End If

If pOverlayTable Is Nothing Then
MsgBox "Table QI failed"
Exit Sub
End If

' Define the output feature class name and shape type (taken from the
' properties of the input feature class)
Dim pFeatClassName As IFeatureClassName
Set pFeatClassName = New FeatureClassName
With pFeatClassName
.FeatureType = esriFTSimple
.ShapeFieldName = "Shape"
.ShapeType = pInputFeatClass.ShapeType
End With

' Set output location and feature class name
Dim pNewWSName As IWorkspaceName
Set pNewWSName = New WorkspaceName
pNewWSName.WorkspaceFactoryProgID = "esriCore.ShapeFileWorkspaceFactory.1"
pNewWSName.PathName = "C:\temp"

Dim pDatasetName As IDatasetName
Set pDatasetName = pFeatClassName
pDatasetName.Name = "Intersect_result"

Set pDatasetName.WorkspaceName = pNewWSName

' Set the tolerance. Passing 0.0 causes the default tolerance to be used.
' The default tolerance is 1/10,000 of the extent of the data frame???s spatial domain
Dim tol As Double
tol = 0#

' Perform the intersect
Dim pBGP As IBasicGeoprocessor
Set pBGP = New BasicGeoprocessor
Dim pOutputFeatClass As IFeatureClass
Set pOutputFeatClass = pBGP.intersect(pInputTable, False, pOverlayTable, False, tol, pFeatClassName)

' Add the output layer to the map
Dim pOutputFeatLayer As IFeatureLayer
Set pOutputFeatLayer = New FeatureLayer
Set pOutputFeatLayer.FeatureClass = pOutputFeatClass
pOutputFeatLayer.Name = pOutputFeatClass.AliasName
pMxDoc.FocusMap.AddLayer pOutputFeatLayer

End Sub

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i change this line false for true but the code ignore the selection. I hope somebody can help me i need this code so mucho thanks!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pOutputFeatClass = pBGP.intersect(pInputTable, False, pOverlayTable, False, tol, pFeatClassName)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jun 2011 17:26:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/intersect-selected-features-vba/m-p/59285#M1621</guid>
      <dc:creator>IRASEMAANGELES</dc:creator>
      <dc:date>2011-06-10T17:26:21Z</dc:date>
    </item>
  </channel>
</rss>

