我想通过Ocean在Petrel的自定义单位系统中添加自定义单位。
按照开发人员指南中的建议,我使用了以下代码:
IUnitService unitService = Slb.Ocean.Core.CoreSystem.GetService();
IUnitCatalog catalog = unitService.GetCatalog(null);
System.Collections.Generic.IDictionary map =
new System.Collections.Generic.Dictionary();
map["Pressure"] = "MyUnit";
catalog.CreateCustomUnitSystem("My UnitSystem",
"UnitSystem for my additional units.",
map,
"MyUnitSystem"); 我把这些代码放在Initialize和Integrate方法中。在这两种情况下,Ocean都会抛出SEHException。
知道哪里出问题了吗?
发布于 2011-06-12 16:53:53
您创建的自定义单位系统必须基于现有的单位系统。
在方法CreateCustomUnitSystem中,现有的单位系统名称用作参考系统。
现有的单位系统包括IUnitServiceSettings提供的标准单位系统和显示单位系统。
以下是创建自定义单位制的示例代码:
IUnitService unitService = CoreSystem.GetService( );
IUnitCatalog catalog = unitService.GetCatalog( null );
IUnitServiceSettings uss = CoreSystem.GetService( );
IUnitSystem refSystem = uss.InvariantSystem;
IDictionary map = new Dictionary( );
map["Pressure"] = "MyUnit";
ICustomUnitSystem myUnitSystem = catalog.CreateCustomUnitSystem( "My UnitSystem", "Unit System for my additional units.", map, refSystem.Name );自定义单位系统不会更改任何Petrel模板,也不会将其添加到Petrel Explorer窗口的模板选项卡中
https://stackoverflow.com/questions/6298210
复制相似问题