lukasz1988

Parameter in GP tool

Discussion created by lukasz1988 on Mar 11, 2013
Hi,

I wrote a code which should add to my GP tool new parameter. This parameter has domain set to Composite Domain which allows only Point Geometry feature classes and .csv files:

The problem is that this composite domain allows also .lyr files which are not Point Feature classes. So in file selection window I can see also all .lyr files (doesn't matter if point feature classes or not). My code:

            var featureClassDomain = new GPFeatureClassDomainClass();
            featureClassDomain.AddType(esriGeometryType.esriGeometryPoint);

            var featureClassDomain = new GPFeatureClassDomainClass();
            featureClassDomain.AddType(esriGeometryType.esriGeometryPoint);

            var fileDomain = new GPFileDomainClass();
            fileDomain.AddType("csv");

            var compositeDomain = new GPCompositeDomainClass();
            compositeDomain.AddDomain(featureClassDomain);
            compositeDomain.AddDomain(fileDomain);

            IGPParameterEdit3 parameter = new GPParameterClass();
            parameter.DataType = (IGPDataType)new DEShapeFileType();
            parameter.Direction = esriGPParameterDirection.esriGPParameterDirectionInput;
            parameter.Enabled = true;
            parameter.Name = "Source file to import";
            parameter.DisplayName = Resources.SourceFileToImportCSVorSHPLabel;
            parameter.Domain = compositeDomain;

Is there any solution to show in file seletion window only .shp files with point geometry (plus csv ofcourse) ?

Outcomes