¿Cómo crear una nueva función en Ocean?

I am using Ocean 2010.2 and I cannot create a new function with CreateFunction method. It says, that "it does not exist in the current context". Any help will be highly appreciated!

preguntado el 31 de julio de 12 a las 13:07

2 Respuestas

It would be good if you added some code example on how you try to create your function. For now I can propose that your didn't add necessary Petrel assemblies to your project.

Here is my example of creating function:

Collection SimpColl = Collection.NullObject;
Function SimpFunction = Function.NullObject;
// Do not forget to use transactions
using (ITransaction trans = DataManager.NewTransaction())
{
    // Use current project to create collection
    // that will contain your function
    trans.Lock(PetrelProject.PrimaryProject);
    SimpColl = PetrelProject.PrimaryProject.CreateCollection("Simple collection");
    trans.Commit();
}

using (ITransaction trans = DataManager.NewTransaction())
{
    // Create your function in your newly created collection
    trans.Lock(SimpColl);
    SimpFunction = SimpColl.CreateFunction("Simple Function");
    trans.Commit();
}

Respondido 01 ago 12, 06:08

The CreateFunction method can be called for the Slb.Ocean.Petrel.DomainObject.Analysis.AnalysisRoot, Slb.Ocean.Petrel.DomainObject.Seismic.InterpretationCollection and Slb.Ocean.Petrel.DomainObject.Collection objects. Pattern is the same in all cases. But your message doesn't look as an Ocean error, but it looks as a generic VS message. The common reason for messages like this is usually if: the declaration of object and the usage of object are located in two different isolated blocks of code and not visible to each other.

Respondido 15 ago 12, 13:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.