使用海洋在Petrel中复制粘贴项目...? [英] Copy-Paste Items in Petrel using Ocean...?
问题描述
在Petrel中,是否可以使用ocean复制输入树中的项目?我需要在某处复制特定井或策略的副本;我该怎么做?
In Petrel, is it possible to COPY-PASTE items in input tree using ocean? I need to have a copy of a specific well or strategy somewhere; how can I do this?
例如,如果我想拥有这口井的副本(myWell):
For example if I want to have a copy of this well (myWell):
Tubing = e.Data.GetData(typeof(TubingString)) as TubingString;
Borehole myWell=Tubing.Borehole;
进入我的钻孔收集区(Borhol):
into my boreholecollection (Borhol):
WellRoot Welrot = Slb.Ocean.Petrel.DomainObject.Well.WellRoot.Get(PetrelProject.PrimaryProject);
BoreholeCollection Borhol = Welrot.BoreholeCollection;
或者有一份DevelopmentStrategy(oldStrategy):
Or have a copy of DevelopmentStrategy (oldStrategy):
EclipseFormatSimulator.Arguments args=WellKnownSimulators.ECLIPSE100.GetEclipseFormatSimulatorArguments(theCase);
DevelopmentStrategy oldStrategy=args.Strategies.DevelopmentStrategies.First();
进入DevelopmentStrategyCollection(strategycol):
into DevelopmentStrategyCollection (strategycol):
SimulationRoot simroot = SimulationRoot.Get(PetrelProject.PrimaryProject);
DevelopmentStrategyCollection strategycol=simroot.DevelopmentStrategyCollection;
推荐答案
许多在Petrel中具有复制/粘贴功能的域对象实现名为 ICopyable
的接口。但是,我不认为这对于所有域对象都是一致的。复制/粘贴域对象的更可靠方法是使用 ICopyableFactory
服务。
Many domain objects that have copy/paste functionality in Petrel implement an interface called ICopyable
. However, I don't believe this is consistent for all domain objects. A more reliable way of copy/pasting a domain object would be through the use of the ICopyableFactory
service.
Borehole borehole = ...;
ICopyable copyable = borehole as ICopyable;
if (copyable == null)
{
ICopyableFactory factory = CoreSystem.GetService<ICopyableFactory>(borehole);
copyable = factory.GetCopyable(borehole);
}
if (copyable != null)
{
IDataSourceManager sourceMgr = ...;
IDataSourceManager targetMgr = ...;
IProjectInfo sourceProjectInfo = ...;
IProjectInfo targetProjectInfo = ...;
ICoordinateReferenceSystem sourceCrs = ...;
ICoordinateReferenceSystem targetCrs = ...;
ICoordinateOperation coordinateOperation = ...;
CopyContext.Element ignoreElements = ...;
CopyContext.Identify identity = ...;
object targetCollection = ...;
object snapshot = copyable.GetSnapshot();
CopyContext context = new CopyContext(sourceMgr, targetMgr,
sourceProjectInfo, targetProjectInfo, sourceCrs, targetCrs
coordinateOperation, ignoreElements, identity, targetCollection,
snapshot);
Borehole copy = copyable.Copy(context) as Borehole;
}
ICopyable.Copy
需要很多参数,因为此方法还用于参考项目工具(用于在项目之间复制域对象)。如果要在同一项目中复制域对象,则所有关联的源/目标属性都将相同(即 targetMgr = sourceMgr
)。
ICopyable.Copy
takes a lot of parameters because this method is also used for the reference project tool (for copying domain objects between projects). If you are copying a domain object within the same project, all of your associated source/target properties will be the same (i.e. targetMgr = sourceMgr
).
这篇关于使用海洋在Petrel中复制粘贴项目...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!