2

I'm developing an arcobjects 10.4.1 custom GeoProcess (fusion shift) which has to be able to run within a model builder. The GeoProcess seems to run smoothly, but the problem is it needs to be outputting a resultant feature class that needs to be reused afterwards. The resultant feature class path is being generated correctly and the feature class is there at the end, but the node doesn't turn green nor shades, so it cannot be reused.

Fusion Shift GP and resultant feature class

This is the code i'm using to statically define this resultant feature class field:

 outputParameter = new GPParameterClass();
 outputParameter.DataType = new GPFeatureLayerTypeClass();
 outputParameter.Value = new GPFeatureLayerClass();
 outputParameter.ParameterType = esriGPParameterType.esriGPParameterTypeDerived;
 outputParameter.DisplayName = "Resultant feature class";
 outputParameter.Name = "ResultantFeatureClass";
 outputParameter.Direction = esriGPParameterDirection.esriGPParameterDirectionOutput;
 outputParameter.AddDependency("ShiftedWorkspace");
 outputParameter.AddDependency("ShiftedFeatureClassName");
 IGPFeatureSchema outSchema = new GPFeatureSchemaClass();
 outSchema.FieldsRule = esriGPSchemaFieldsType.esriGPSchemaFieldsNone;
 outSchema.FeatureTypeRule = esriGPSchemaFeatureType.esriGPSchemaFeatureFirstDependency;
 IGPSchema schema = outSchema as IGPSchema;
 schema.GenerateOutputCatalogPath = true;
 outputParameter.Schema = (IGPSchema)outSchema;
 parameters.Add(outputParameter);

And this piece of code is executed once in the update parameters method:

 // Output parameter feature class
 IGPParameter3 gpParamOutputMasterLayer = (IGPParameter3)m_Parameters.Element[++parameterCount];
 IGPParameterEdit3 gpParamOutputMasterLayerEdit = (IGPParameterEdit3)gpParamOutputMasterLayer;
 if (!gpValue.IsEmpty()) gpParamOutputMasterLayerEdit.Value = m_GPUtilities.UnpackGPValue(gpValue);

What am I missing? is there something else I need to define?

asked Apr 23, 2020 at 9:21

2 Answers 2

1

I've personally never created a GeoProcessing tool in ArcObjects so the only thing I can offer is that there is a whole section on building such tools in the API help file and they have moved examples which are probably worth looking at to see whats different to their GitHub site.

answered Apr 23, 2020 at 10:34
1
  • Thanks anyway for your input Hornbydd. I checked them out but those samples didn't seem to fit into my GP needs. Didn't even have GUI. Commented May 5, 2020 at 12:00
1

Found this ESRI sample ConvexHull ESRI which revealed what I was doing wrong. Basically indicated output parameter to required instead of derived and switched its type to feature class instead of feature layer. Ath the end no IGPSchema was needed. Here's the working code:

 outputParameter = new GPParameterClass();
 outputParameter.DataType = new DEFeatureClassTypeClass();
 outputParameter.Value = new DEFeatureClassClass();
 outputParameter.ParameterType = esriGPParameterType.esriGPParameterTypeRequired;
 outputParameter.DisplayName = "Resultant feature class";
 outputParameter.Name = "ResultantFeatureClass";
 outputParameter.Direction = esriGPParameterDirection.esriGPParameterDirectionOutput;
 parameters.Add(outputParameter);

Then in the UpdateParameters method, you decode your values into whatever form you need to execute your GP.

answered May 5, 2020 at 11:58

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.