<?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 Extract feature classes from CAD file in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/extract-feature-classes-from-cad-file/m-p/1097617#M62366</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am currently working on a tool that converts CAD files submitted by users and then extracts the data and processes it in such a way that we can use that data internally. I need to enable the end user to select or upload the cad dataset and select the type of feature classes that are involved. So my question is, is there a way to set up the tool validation to select all of the feature classes that are in the CAD dataset?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;class ToolValidator:
    # Class to add custom behavior and properties to the tool and tool parameters.

    def __init__(self):
        # set self.params for use in other function
        self.params = arcpy.GetParameterInfo()

    def initializeParameters(self):
        # Customize parameter properties. 
        # This gets called when the tool is opened.
        return

    def updateParameters(self):
        # Modify parameter values and properties.
        # This gets called each time a parameter is modified, before 
        # standard validation.
        CAD_Dataset = self.params[2].value
        featureclasses = self.params[3].filter
        fieldname = self.params[4].valueAsText
        SubdivisionLayers = self.params[5].filter
        ParcelsLayers = self.params[6].filter
        RoadLayers = self.params[7].filter
        
        if CAD_Dataset:
            featureclasses.list = [fc for fc in arcpy.ListFeatureClasses(CAD_Dataset)]
            fieldname = "Layer"
            fcfields = [fieldname]
            attributevalues = [row[0] for row in arcpy.da.SearchCursor(featureclass, fcfields)]
            UniqueAttributes = set(attributevalues)
            SubdivisionLayers.list = [str(value) for value in UniqueAttributes]
            ParcelsLayers.list = [str(value) for value in UniqueAttributes]
            RoadLayers.list = [str(value) for value in UniqueAttributes]
            
        return

    def updateMessages(self):
        # Customize messages for the parameters.
        # This gets called after standard validation.
        return

    # def isLicensed(self):
    #     # set tool isLicensed.
    #     return True&lt;/LI-CODE&gt;&lt;P&gt;Any help on this would be greatly appreciated.&lt;/P&gt;</description>
    <pubDate>Mon, 13 Sep 2021 14:01:55 GMT</pubDate>
    <dc:creator>RPGIS</dc:creator>
    <dc:date>2021-09-13T14:01:55Z</dc:date>
    <item>
      <title>Extract feature classes from CAD file</title>
      <link>https://community.esri.com/t5/python-questions/extract-feature-classes-from-cad-file/m-p/1097617#M62366</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am currently working on a tool that converts CAD files submitted by users and then extracts the data and processes it in such a way that we can use that data internally. I need to enable the end user to select or upload the cad dataset and select the type of feature classes that are involved. So my question is, is there a way to set up the tool validation to select all of the feature classes that are in the CAD dataset?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;class ToolValidator:
    # Class to add custom behavior and properties to the tool and tool parameters.

    def __init__(self):
        # set self.params for use in other function
        self.params = arcpy.GetParameterInfo()

    def initializeParameters(self):
        # Customize parameter properties. 
        # This gets called when the tool is opened.
        return

    def updateParameters(self):
        # Modify parameter values and properties.
        # This gets called each time a parameter is modified, before 
        # standard validation.
        CAD_Dataset = self.params[2].value
        featureclasses = self.params[3].filter
        fieldname = self.params[4].valueAsText
        SubdivisionLayers = self.params[5].filter
        ParcelsLayers = self.params[6].filter
        RoadLayers = self.params[7].filter
        
        if CAD_Dataset:
            featureclasses.list = [fc for fc in arcpy.ListFeatureClasses(CAD_Dataset)]
            fieldname = "Layer"
            fcfields = [fieldname]
            attributevalues = [row[0] for row in arcpy.da.SearchCursor(featureclass, fcfields)]
            UniqueAttributes = set(attributevalues)
            SubdivisionLayers.list = [str(value) for value in UniqueAttributes]
            ParcelsLayers.list = [str(value) for value in UniqueAttributes]
            RoadLayers.list = [str(value) for value in UniqueAttributes]
            
        return

    def updateMessages(self):
        # Customize messages for the parameters.
        # This gets called after standard validation.
        return

    # def isLicensed(self):
    #     # set tool isLicensed.
    #     return True&lt;/LI-CODE&gt;&lt;P&gt;Any help on this would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 14:01:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extract-feature-classes-from-cad-file/m-p/1097617#M62366</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2021-09-13T14:01:55Z</dc:date>
    </item>
  </channel>
</rss>

