2012-07-31 12 views

回答

2

如果您在創建函數時添加了一些代碼示例,那就太好了。現在我可以建議你沒有將必要的Petrel組件添加到你的項目中。

這裏是我的創造功能的例子:

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(); 
} 
0

的CreateFunction方法可以呼籲Slb.Ocean.Petrel.DomainObject.Analysis.AnalysisRoot,Slb.Ocean.Petrel.DomainObject.Seismic.InterpretationCollection和Slb.Ocean.Petrel.DomainObject.Collection對象。 模式在所有情況下都是相同的。但是,您的消息看起來不像海洋錯誤,但它看起來像一個普通的VS消息。像這樣的消息的通常原因通常是:對象的聲明和對象的使用位於兩個不同的獨立代碼塊中,彼此不可見。