


{"id":254962,"date":"2020-12-01T07:33:23","date_gmt":"2020-12-01T07:33:23","guid":{"rendered":"\/forum\/forums\/topic\/c-selection-context\/"},"modified":"2020-12-01T07:33:23","modified_gmt":"2020-12-01T07:33:23","slug":"c-selection-context","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/c-selection-context\/","title":{"rendered":"C# selection context"},"content":{"rendered":"<p> Hello, <\/p>\n<p> I have to verify before launch a function if a point on a cuve or on an edge is available. <\/p>\n<p> I start with the Sample exmple, PolygonMesh.cs: <\/p>\n<p> protected override void OnUpdate(Command command) {<br \/> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;command.IsEnabled = Window.ActiveWindow != null &amp;&amp; Window.ActiveWindow.ActiveContext.SingleSelection is IDesignBody;<br \/> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;} <\/p>\n<p> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;protected override void OnExecute(Command command, ExecutionContext context, Rectangle buttonRect) {<br \/> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;Window window = Window.ActiveWindow;<br \/> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if (window == null)<br \/> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return; <\/p>\n<p> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;var desBody = window.ActiveContext.SingleSelection as IDesignBody;<br \/> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if (desBody == null)<br \/> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return; <\/p>\n<p> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;DesignBody desBodyMaster = desBody.Master; <\/p>\n<p>&nbsp;<\/p>\n<p> But I don&#8217;t understand. <\/p>\n<p> I try to undertand thanks to theAPI, but the description are to light for me. <\/p>\n<p>&nbsp;<\/p>\n<p> Could you give me explanation ? <\/p>\n<p> Regards. <\/p>\n","protected":false},"template":"","class_list":["post-254962","topic","type-topic","status-closed","hentry","topic-tag-ansys-discovery","topic-tag-scripting","topic-tag-selection"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["278241"],"_bbp_likes_count":["0"],"_btv_view_count":["240"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["254962"],"_bbp_forum_id":["27789"],"_bbp_engagement":["126","278241"],"_bbp_voice_count":["2"],"_bbp_reply_count":["1"],"_bbp_last_reply_id":["263235"],"_bbp_last_active_id":["263235"],"_bbp_last_active_time":["2020-12-01 10:07:45"]},"test":"daniel-nouxetstelia-aerospace-com"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/254962","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/254962\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=254962"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}