如题,想获得Standard Preferences里面当前激活的等级名,请问可以么?谢谢。
没有找到这个API。
不知道您的最终目标,这里列出一些相关API,您看能否换个思路达到目标:
DatabaseUtilities.GetAllSpecifications()
DatabaseUtilities.GetAllSizes(string specification)
我的目的是获得当前激活的spec,然后才能去找到对应的spec mdb文件。
前两个databaseutilities的没用过,看名字是获取所有的等级和尺寸。最后一个是改变,不是获取。
请问有方法么?是否可以先放一段管子,然后查询该管子的spec?不管行不行,能给出一段查询OPM元件属性的代码么?谢谢。
查询属性参见:C:\Program Files\Bentley\OpenPlant CONNECT Edition\OpenPlantModeler\SDKExamples\QueryPipeWithPortsExample
放管子之前要创建管子,创建的时候使用的不是Standard Preferences中的Specification,是要作为参数指定的。参见:C:\Program Files\Bentley\OpenPlant CONNECT Edition\OpenPlantModeler\SDKExamples\PipingExample
不是您要做什么操作,是您要解决什么需求问题?
我想放置某等级的元件,等级名希望能等同Standard Preferences的激活等级,这样只需要更改Standard Preferences的等级,就可以更换等级。否则还得另外想办法让用户选择等级。
明白了,我正在跟OPM开发的同事做最终确认。
类似于您的需求的例子也有:C:\Program Files\Bentley\OpenPlant CONNECT Edition\OpenPlantModeler\SDKExamples\DialogExample\MyDialog.cs
例子实现的功能:
Dialog Example: This example demonstrates placement of different components through a dialog.This example will work fine in both Imperial and Metric projects.KeyIn: To load the examples, use the following keyin. mdl load DialogExampleRunning the keyin will open a form using which, you can select any of specifications, sizes, provide origin and angles, and place the component respectively.
推荐您先试一下。
Bentley.Plant.StandardPreferences.DlgStandardPreference("SPECIFICATION");
试试这个。
Answer Verified By: Changsong Ling
请问Bentley.Plant在哪里?需要引用什么?谢谢。
C:\Program Files\Bentley\OpenPlant CONNECT Edition\OpenPlantModeler\Assemblies\bentley.plant.standardpreferences.dll
完整的代码如下:
Bentley.Plant.StandardPreferences.DlgStandardPreference.GetPreferenceValue("SPECIFICATION");
多谢!
哈,抱歉,拼接错误。