<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communities.bentley.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>请问一下，我想在opm中根据选中的管线获取管线上的支吊架如何实现呢？</title><link>https://communities.bentley.com/communities/other_communities/chinafirst/f/microstation-projectwise/242523/opm</link><description>如题，我通过交互工具选择了指定的管线，然后想获取管线上的支吊架进行标注，不知道如何获取，请帮忙。</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: 请问一下，我想在opm中根据选中的管线获取管线上的支吊架如何实现呢？</title><link>https://communities.bentley.com/thread/756876?ContentTypeID=1</link><pubDate>Fri, 10 Mar 2023 06:25:00 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:ba24f178-f815-4ef9-8c91-15a7d8fcdef5</guid><dc:creator>Liaoyuan Zhang</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;public static List&amp;lt;IECInstance&amp;gt; GetRelationshipInstances(IECInstance inst)
{
    List&amp;lt;IECInstance&amp;gt; resInstList = new List&amp;lt;IECInstance&amp;gt;();
    var relatedInsts = DgnUtilities.GetAllRelationshipInstances(inst);
    foreach (var relatedInst in relatedInsts)
    {
        IECInstance resInst =
            (relatedInst.Target.InstanceId == inst.InstanceId) ?
            relatedInst.Source : relatedInst.Target;
        resInstList.Add(resInst);
    }

    return resInstList;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;不用用EC，直接用OPM的接口去查询&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 请问一下，我想在opm中根据选中的管线获取管线上的支吊架如何实现呢？</title><link>https://communities.bentley.com/thread/756705?ContentTypeID=1</link><pubDate>Thu, 09 Mar 2023 08:09:06 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:3c572969-340e-432f-9a14-7f806bdd1914</guid><dc:creator>Ethan Yuan</dc:creator><description>&lt;p&gt;多谢帮忙，通过&lt;span&gt;ObjectHasSupport确实找到了，然后你说的这个查找方式也是我特别晕的地方，我在classeditor里确实看到了PipingSupport, 然后他的Relationship里找到了ObjectHasSupport，但是这个PipingSupport我其实是根据管道自己猜出来的，我的管道的ECClass名字是PIPE，但是我看好像没有从PIPE到PipingSupport的联系，这块是真的晕，不过多谢帮忙了，当前问题先解决了&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 请问一下，我想在opm中根据选中的管线获取管线上的支吊架如何实现呢？</title><link>https://communities.bentley.com/thread/756690?ContentTypeID=1</link><pubDate>Thu, 09 Mar 2023 06:52:50 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:aec3ffef-9deb-435d-a2c4-7fd5f0050801</guid><dc:creator>Zhipeng Rong</dc:creator><description>&lt;p&gt;首先您截图中的这个支吊架确实不是&amp;nbsp;&lt;span&gt;DEVICE_HAS_SUPPORT 对应的 SUPPORT（去查ClassEditer），所以没找到是正常的。&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;其次您都发现这个支吊架对应的是&amp;nbsp;PIPE_SUPPORT 这个类，接下来您的思路应该是这个&amp;nbsp;PIPE_SUPPORT 有什么relationship。通过查询 ClassEditer 不难发现这个家伙有一个这个 relationship:&amp;nbsp;ObjectHasSupport. 接下来将上述代码中的 relationship 替换掉，是不是就可以找到唯三的支吊架了？&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;由于中英文翻译问题，这种情况是非常常见的。可以从 ClassEditer 中发现，有好几个class 都叫 *support ,而且没有很近的父子关系，也许他们在英文环境中代表不同的支吊架，所以我们通常要去检查一下 relaionship 对应的两边的 ecclass 是不是我们期望的。&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;再多啰嗦几句，像管道这些是比较核心的opm组件，所以它所拥有的relationship是很多的。但是像支吊架这种，一般来说它所拥有的关系就很少，您可以先从支吊架入手，查询支吊架拥有哪些relationship，从得到的relationshipinstance 的source属性中获取这个支吊架是和何种元素关联的，他们的关联relationship是什么，得到这些信息之后，你就可以胸有成竹的获取您想要的支吊架。&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 请问一下，我想在opm中根据选中的管线获取管线上的支吊架如何实现呢？</title><link>https://communities.bentley.com/thread/756684?ContentTypeID=1</link><pubDate>Thu, 09 Mar 2023 06:26:50 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:ba41bdd2-589f-4ad6-a4d2-8b610cbae9a5</guid><dc:creator>Ethan Yuan</dc:creator><description>&lt;p&gt;就是我上传的模型中的图示里面的那个管件&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/343510/pastedimage1678343260090v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 请问一下，我想在opm中根据选中的管线获取管线上的支吊架如何实现呢？</title><link>https://communities.bentley.com/thread/756683?ContentTypeID=1</link><pubDate>Thu, 09 Mar 2023 06:24:06 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:bee559a3-bd1a-4e01-bc8d-dfcfa5527f4c</guid><dc:creator>Ethan Yuan</dc:creator><description>&lt;p&gt;我从模型观察也是这个情况，应该是对的&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 请问一下，我想在opm中根据选中的管线获取管线上的支吊架如何实现呢？</title><link>https://communities.bentley.com/thread/756682?ContentTypeID=1</link><pubDate>Thu, 09 Mar 2023 06:23:17 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:0bfc29c9-df7a-4547-b9b4-9fd47bebed51</guid><dc:creator>Ethan Yuan</dc:creator><description>&lt;p&gt;有是肯定有，我用ScanCriteria这个类然后用选中的管道的Range扫描到所有对象，然后取得对象的所有的IECInstance, 然后再查找这些的BaseClasses,找到父类是&amp;nbsp;[ "PipingSupport", "PIPE_SUPPORT" ]的，取到3个，然后我看图上也是三个，但是这个方法感觉很绕的感觉&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 请问一下，我想在opm中根据选中的管线获取管线上的支吊架如何实现呢？</title><link>https://communities.bentley.com/thread/756677?ContentTypeID=1</link><pubDate>Thu, 09 Mar 2023 05:39:18 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:118561f8-e5c6-42b1-99c1-00133f182225</guid><dc:creator>Zhipeng Rong</dc:creator><description>&lt;p&gt;有没有可能，您选的那根管道上，他就没有support呢？&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 请问一下，我想在opm中根据选中的管线获取管线上的支吊架如何实现呢？</title><link>https://communities.bentley.com/thread/756669?ContentTypeID=1</link><pubDate>Thu, 09 Mar 2023 05:10:47 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:d45b4489-2c7b-48fd-8af4-4432ad344ebc</guid><dc:creator>Ethan Yuan</dc:creator><description>&lt;p&gt;我去实验了一下，好像没有取到，我得到的RelationshipInstances是以下这些，没有DEVICE_HAS_SUPPORT，不知道哪里的问题&lt;/p&gt;
&lt;p&gt;&lt;img style="height:532px;max-height:532px;max-width:789px;" height="328" src="/resized-image/__size/1578x1064/__key/communityserver-discussions-components-files/343510/pastedimage1678338617274v2.png" width="788" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 请问一下，我想在opm中根据选中的管线获取管线上的支吊架如何实现呢？</title><link>https://communities.bentley.com/thread/756667?ContentTypeID=1</link><pubDate>Thu, 09 Mar 2023 04:33:23 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:a8b96a10-b732-4c83-8261-1891103b7c54</guid><dc:creator>Ethan Yuan</dc:creator><description>&lt;p&gt;谢谢，我去试一下&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 请问一下，我想在opm中根据选中的管线获取管线上的支吊架如何实现呢？</title><link>https://communities.bentley.com/thread/756663?ContentTypeID=1</link><pubDate>Thu, 09 Mar 2023 03:45:15 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:9380669f-91e0-48e6-afb7-c53143983819</guid><dc:creator>Zhipeng Rong</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;        private static string Relationship = &amp;quot;DEVICE_HAS_SUPPORT&amp;quot;;
        public static void Run()
        {
            // pipe
            Element element = Utils.Utils.GetASelectedElement();
            if (element == null)
            {
                return;
            }

            var instances = DgnECManager.Manager.GetElementProperties(element, ECQueryProcessFlags.SearchAllClasses);
            var instance = instances.ElementAt(1);//pipeInstance
            List&amp;lt;IECRelationshipInstance&amp;gt; relationships = DgnUtilities.GetAllRelationshipInstances(instance).Where(e =&amp;gt; e.ClassDefinition.Name == Relationship).ToList();
            foreach (var relationship in relationships)
            {
                IECInstance support = relationship.Target;
                var id = (support as IDgnECInstance).Element.ElementId;
            }
        }&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 请问一下，我想在opm中根据选中的管线获取管线上的支吊架如何实现呢？</title><link>https://communities.bentley.com/thread/756642?ContentTypeID=1</link><pubDate>Thu, 09 Mar 2023 01:20:53 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:88fb2c0b-6d7d-467d-b2f7-e36b53d130cf</guid><dc:creator>Ethan Yuan</dc:creator><description>&lt;p&gt;我用的就是ms自带的那个例子刨切了一下，我上传了请帮忙看一下&lt;a href="https://communities.bentley.com/cfs-file/__key/communityserver-discussions-components-files/343510/7220.OPM_2D00_3D_2D00_PLANT.dgn"&gt;communities.bentley.com/.../7220.OPM_2D00_3D_2D00_PLANT.dgn&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 请问一下，我想在opm中根据选中的管线获取管线上的支吊架如何实现呢？</title><link>https://communities.bentley.com/thread/756471?ContentTypeID=1</link><pubDate>Wed, 08 Mar 2023 06:40:28 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:983c547c-3b44-4c4c-93db-ba3514d52252</guid><dc:creator>HongQiang Guo</dc:creator><description>&lt;p&gt;能否提供一下您的模型文件供我们分析，可将无关图形元素删除掉再上传。&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>