<?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>[ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/communities/other_communities/chinafirst/f/microstation-projectwise/184533/ord-ce-c</link><description>我在界面上弄了个按钮，想让用户点击后加载一个交互工具，选择一个元素。 
 目前我是使用了一个继承自DgnElementSetTool的子类做的，在_OnElementModify中获取选择集进行操作，但问题是对于参考进来的只读元素无法进行选择，重写了_OnPostLocate函数也无济于事，请问该如何实现？实在不行，就只能让用户先选择了。。。</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/541867?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2019 07:54:58 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:0fdb83e4-d95a-479f-8867-160499f4f77a</guid><dc:creator>程远 李</dc:creator><description>&lt;p&gt;可以了，谢谢郭老师&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/541848?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2019 07:33:03 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:e9382f06-d39c-4d4c-8146-7341c203924b</guid><dc:creator>HongQiang Guo</dc:creator><description>&lt;p&gt;你的_NeedAcceptPoint返回了false，所以就没再启用动态，我是再动态显示的状态下获取到的ID，我建议您重写一下_OnDataButton函数，在这个函数里边调一下基类的_OnDataButton函数，然后判断一下ElementAgenda里是否有元素，有的话就进行你的操作，然后调用_OnReinitialize，最后返回true，没有的话就直接返回false就行。&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/541814?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2019 05:44:39 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:8314970d-5c61-4f74-b110-316d2059a00e</guid><dc:creator>程远 李</dc:creator><description>&lt;p&gt;&lt;a href="https://communities.bentley.com/cfs-file/__key/communityserver-discussions-components-files/343510/_1F57B965A18B977B3057625F216A8B57_.rar"&gt;communities.bentley.com/.../_1F57B965A18B977B3057625F216A8B57_.rar&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;有点大。。。&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/541810?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2019 05:38:58 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:97b1af3d-3873-4a66-a6e7-d5ea2299178e</guid><dc:creator>HongQiang Guo</dc:creator><description>&lt;p&gt;测试的dgn文件呢？&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/541793?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2019 03:40:58 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:a01ed048-f44e-4583-9ab6-0076a632e24d</guid><dc:creator>程远 李</dc:creator><description>&lt;p&gt;好的，我把自己写的类上传一下，麻烦有空帮我看看&lt;a href="https://communities.bentley.com/cfs-file/__key/communityserver-discussions-components-files/343510/ChooseElement.rar"&gt;communities.bentley.com/.../ChooseElement.rar&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/541785?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2019 02:42:20 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:e0e8c68b-0810-4895-b909-8b1817088d01</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><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/541778?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2019 01:49:43 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:9d4d5a1b-91f5-41f4-99fe-228b6e3d30dc</guid><dc:creator>程远 李</dc:creator><description>&lt;p&gt;问题是我现在不要修改元素，只是想选中一个只读元素并获取该元素相关信息，用继承于&lt;span&gt;DgnElementSetTool的类来做似乎不太合适，还是只能自己从DgnTool类来继承&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/541572?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2019 07:03:23 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:3a42fcda-ea20-480b-b279-0dd455017071</guid><dc:creator>Yongan.Fu</dc:creator><description>&lt;p&gt;修改元素一般分两种情况：&lt;/p&gt;
&lt;p&gt;①利用DgnElementSetTool的_OnElementModify自动就会对每个元素调用一遍了，你只需要在此函数中对传入的EditElementHandle修改就可以了，也不需要你调用RepalceInModel。也不需要调用GetElementAgenda；&lt;/p&gt;
&lt;p&gt;②选完所有元素后统一修改。此时需要对&lt;span&gt;_OnElementModify返回ERROR；&lt;/span&gt;需要在_OnModifiyComplete中调用GetElementAgenda获得所有选中的元素统一修改。&lt;/p&gt;
&lt;p&gt;多读一下SDK中带有的例子，自己不要发明操作流程，抄就可以了。&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/541571?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2019 06:59:18 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:0a10d293-01e3-4921-8a5c-c31048f8a662</guid><dc:creator>Yongan.Fu</dc:creator><description>&lt;p&gt;您对DgnTool的理解有问题。在DgnElementDetTool中直接调用&lt;span&gt;GetElementAgenda()就能获得用户选中的元素。这些元素不是在选择集中的。这是两个概念。&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;我对你选择集的测试前提是，先手工用系统的构造选择集工具构造了一个选择集，然后才执行的你那段代码。&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;当然，DgnElementSetTool也能和选择集直接集成，此种情况下还是可以通过调用GetElementAgenda得到选中的一系列元素。&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/541553?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2019 06:04:04 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:375beb63-f11d-438d-8de1-07aa98b56f7a</guid><dc:creator>程远 李</dc:creator><description>&lt;p&gt;我试了，确实不行，上传截图给你看看&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/675x240/__key/communityserver-discussions-components-files/343510/5078.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/943x240/__key/communityserver-discussions-components-files/343510/3252.png" /&gt;&lt;/p&gt;
&lt;p&gt;难道是我的sdk版本太低了？算了，我自己另外想办法解决吧。。。&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/541549?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2019 05:41:43 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:561b78b1-be50-4e09-a254-8d5205179721</guid><dc:creator>HongQiang Guo</dc:creator><description>&lt;p&gt;我测试过可以才回复您的：GetElementAgenda()[0].GetElementId()&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/541545?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2019 05:28:40 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:bd605368-4535-4dbd-b2ca-3bfe5d5dbda8</guid><dc:creator>程远 李</dc:creator><description>&lt;p&gt;你在_OnElementModify函数里调用&lt;span&gt;getSelectElement函数试试看，我试了，得到的elementID是0.。。&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;我打算自己写一个类继承自DgnTool，或者直接调用MicroStation里面的选择命令。。。&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/541543?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2019 05:23:57 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:3f4b0cac-b924-46d7-81aa-f5683a2713aa</guid><dc:creator>程远 李</dc:creator><description>&lt;p&gt;我试了一下，还是不行。代码如下：&lt;/p&gt;
&lt;p&gt;StatusInt SelectOneElement::_OnElementModify(EditElementHandleR el)&lt;br /&gt;{&lt;br /&gt; auto&amp;amp; agenda = GetElementAgenda();&lt;br /&gt; auto count = agenda.GetCount();&lt;br /&gt; mdlDialog_dmsgsPrint(WPrintfString(L&amp;quot;get [%d] element&amp;quot;, count));&lt;br /&gt; if (0 == count)&lt;br /&gt; {&lt;br /&gt; return ERROR;&lt;br /&gt; }&lt;br /&gt; mdlDialog_dmsgsPrint(WPrintfString(L&amp;quot;get element id:[%d]&amp;quot;, agenda.at(0).GetElementId()));&lt;br /&gt; //if (s_SelectOneCallback)&lt;br /&gt; //{&lt;br /&gt; // s_SelectOneCallback(agenda.at(0),GetToolId());&lt;br /&gt; //}&lt;br /&gt; //_ExitTool();&lt;br /&gt; return SUCCESS;&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;span&gt;SelectOneElement继承自DgnElementSetTool&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/541513?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2019 02:09:08 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:760a75d8-ef90-4ae0-b560-aa7bbf4b67e4</guid><dc:creator>HongQiang Guo</dc:creator><description>&lt;p&gt;用GetElementAgenda可以。&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/541509?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2019 01:37:55 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:3ecd9c4b-787a-43da-8c6a-fe07ddbb005a</guid><dc:creator>Yongan.Fu</dc:creator><description>[quote userid="1021097" url="~/communities/other_communities/chinafirst/f/microstation-projectwise/184533/ord-ce-c/541498"]但是获取不到元素[/quote]
&lt;p&gt;在我这里可以获取到元素呀。测试代码如下：&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void getSelectElement(ElementRefP&amp;amp; erp, DgnModelRefP&amp;amp; dmrp, size_t num)
{
	erp = nullptr;
	dmrp = nullptr;
	auto&amp;amp; ssm = SelectionSetManager::GetManager();
	num = ssm.NumSelected();
	if (num &amp;lt;= 0)
	{
		return;
	}
	ssm.GetElement(0, &amp;amp;erp, &amp;amp;dmrp);
}
void SelectionSetTest()
{
	ElementRefP erp = nullptr;
	DgnModelRefP dmrp = nullptr;
	getSelectElement(erp, dmrp, 0);
	ElementHandle eh(erp, dmrp);
	WPrintfString wStr(L&amp;quot;elId=%d&amp;quot;, eh.GetElementId());
	mdlDialog_dmsgsPrint(wStr);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;执行结果如下（我选择集中的所有元素都是在参考文件中的）：&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/343510/6523.png" /&gt;&lt;/p&gt;
[quote userid="1021097" url="~/communities/other_communities/chinafirst/f/microstation-projectwise/184533/ord-ce-c/541498"]DgnElementSetTool类不能满足要求[/quote]
&lt;p&gt;不要轻易下错误的结论。DgnElementSetTool可以满足我们各方面的要求的，但其用法也确实比较复杂。&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/541498?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2019 00:57:07 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:e97bd8bf-1ab2-408a-9ac9-57db00cadb95</guid><dc:creator>程远 李</dc:creator><description>&lt;p&gt;直接获取选择集合里的元素，代码如下：&lt;/p&gt;
&lt;p&gt;void getSelectElement(ElementRefP&amp;amp; erp, DgnModelRefP&amp;amp; dmrp, size_t&amp;amp; num)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; erp = nullptr;&lt;br /&gt;&amp;nbsp; &amp;nbsp; dmrp = nullptr;&lt;br /&gt;&amp;nbsp; &amp;nbsp; auto&amp;amp; ssm = SelectionSetManager::GetManager();&lt;br /&gt;&amp;nbsp; &amp;nbsp; num = ssm.NumSelected();&lt;br /&gt;&amp;nbsp; &amp;nbsp; if (num &amp;lt;= 0)&lt;br /&gt;&amp;nbsp; &amp;nbsp; {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return;&lt;br /&gt;&amp;nbsp; &amp;nbsp; }&lt;br /&gt;&amp;nbsp; &amp;nbsp; ssm.GetElement(0, &amp;amp;erp, &amp;amp;dmrp);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;但是获取不到元素，看样子达到要求只能自己写类继承DgnTool类了，DgnElementSetTool类不能满足要求&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/540601?ContentTypeID=1</link><pubDate>Wed, 28 Aug 2019 05:39:59 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:d6def879-6b98-4476-a134-d0480de26fcd</guid><dc:creator>Yongan.Fu</dc:creator><description>&lt;p&gt;你是如何获取元素Id的？注意此时的DgnModelRef已经不是ACTIVEMODEL了，而是指定的参考模型的DgnModelRef了。&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/540348?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2019 08:15:37 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:a4adeb3b-4216-42f9-8b78-0c9e3dca2391</guid><dc:creator>程远 李</dc:creator><description>&lt;p&gt;&lt;span&gt;重写_IsModifyOriginal后确实可以选中只读元素了，但是好像不能正确获取元素的id了。。。我已经改成让用户先选择再点按钮了。。。&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/540134?ContentTypeID=1</link><pubDate>Mon, 26 Aug 2019 06:24:52 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:ca34393e-3897-4859-bc66-541dc895af49</guid><dc:creator>Yongan.Fu</dc:creator><description>&lt;p&gt;virtual bool _IsModifyOriginal () override {return false;}&lt;/p&gt;
&lt;p&gt;其实搜一下以前的帖子也能找到该问题的答案的。如下：&lt;/p&gt;
&lt;p&gt;&lt;a href="/communities/other_communities/chinafirst/f/microstation-projectwise/177401/msce-c-dgnelementsettool"&gt;https://communities.bentley.com/communities/other_communities/chinafirst/f/microstation-projectwise/177401/msce-c-dgnelementsettool&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/communities/other_communities/chinafirst/f/microstation-projectwise/151508/c-msv8i-ilocatecommandevents"&gt;https://communities.bentley.com/communities/other_communities/chinafirst/f/microstation-projectwise/151508/c-msv8i-ilocatecommandevents&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/540133?ContentTypeID=1</link><pubDate>Mon, 26 Aug 2019 06:24:52 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:4796dce5-65c8-427f-bece-72bf150d4257</guid><dc:creator>Devin Liu</dc:creator><description>&lt;p&gt;你按这种方法尝试选择一个元素吧。&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [ORD CE C++]怎样在交互工具里让用户选择一个只读元素？</title><link>https://communities.bentley.com/thread/540132?ContentTypeID=1</link><pubDate>Mon, 26 Aug 2019 06:24:28 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:3aa6cc2d-4c19-4700-8b44-fd206f4fcf07</guid><dc:creator>Devin Liu</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;        protected override bool OnDataButton(DgnButtonEvent ev)
        {
            if(userstate == CurrentState.none)
            {
                HitPath hitPath = DoLocate(ev, true, 1);
                if (null == hitPath)
                {

                    return false;

                }
 
                selectedSurface = hitPath.GetHeadElement();
                MeshHeaderElement currentmesh = selectedSurface as MeshHeaderElement;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>