1

I am trying to move features programmatically using IFeatureEdit:MoveSet() method.
It works fine if I simply move one feature, but if I add more than one feature (from another FC of course), it hangs. It seems to be processing, but never finishes.

I have waited for about 45 mins...the same operation when done via ArcMap finishes in a few seconds.

I also noticed that in some cases, pFeatMoveSet.Next() as IFeatureEdit2 does not move to the next feature, and keeps returning the same pointer, resulting in a infinite loop of sorts.

I have also tried the one feature per FC approach as suggested by ESRI in this link, but same behaviour. Is it an API issue?

Any clues?

PS: I am on ArcGIS 10.0 (sp4) with ArcFM 10.0.3 and FCs participate in a geo net.

Update: The following code works.

            pFeatMoveSet = GetRelatedFeatures(pPoleFeat);
            pFeatMoveSet.Reset();

            pFeatEdit = pFeatMoveSet.Next() as IFeatureEdit2;

            if (pFeatEdit != null)
            {
                pFeatEdit.MoveSet(pFeatMoveSet, pMoveVector);
            }
  • 1
    I've never used this interface but having just read the Help file it sounds like you need to call MoveSet on a single feature for as many featureclasses that are participating in the set. There is a better explanation in the help file, may be that is your problem? – Hornbydd Jun 24 '14 at 10:40
  • Thanks @Hornbydd. I think I know why it is doing it. The ESRI doco is flawed, even the code samples floating on the net are incorrect, except for this one: help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/… – ujjwalesri Jun 25 '14 at 1:24
  • In the above example you will see that one does not need to iterate through every object in the set. You just need to point to the first one and call MoveSet(), it will take care of the rest. That is what, I believe, they mean by "winnowed". Pasting the working code in the problem description. – ujjwalesri Jun 25 '14 at 1:28
0

This works
Notice the if() instead of while() that most of the online samples propagate.

        pFeatMoveSet = GetRelatedFeatures(pPoleFeat);
        pFeatMoveSet.Reset();

        pFeatEdit = pFeatMoveSet.Next() as IFeatureEdit2;

        if (pFeatEdit != null)
        {
            pFeatEdit.MoveSet(pFeatMoveSet, pMoveVector);
        }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.