{"id":3417,"date":"2020-12-07T12:08:49","date_gmt":"2020-12-07T11:08:49","guid":{"rendered":"https:\/\/www.nextfem.it\/it\/?page_id=3417"},"modified":"2025-07-15T07:52:16","modified_gmt":"2025-07-15T06:52:16","slug":"plugin","status":"publish","type":"page","link":"https:\/\/www.nextfem.it\/it\/plugin\/","title":{"rendered":"Plugin"},"content":{"rendered":"<table style=\"width: 100%; border: none; border-collapse: collapse; border-radius: 15px; background-color: #e3e3e3;\">\n<tbody>\n<tr>\n<td style=\"width: 30%; border: none;\" rowspan=\"2\"><img decoding=\"async\" class=\"aligncenter wp-image-5555\" src=\"https:\/\/www.nextfem.it\/it\/wp-content\/uploads\/codePl.png\" alt=\"\" width=\"115\" height=\"115\" \/><\/td>\n<td style=\"width: 70%; border: none;\">\n<h2>NextFEM Plugins<\/h2>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 70%; border: none;\">\n<h5>Fastest and integrated way to expand program capabilities<\/h5>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>NextFEM Designer can host plugins able to interact with model and viewport. Plugins must be written in any of the <strong>.NET Framework<\/strong> supported languages (eg. C#, VB.NET, F#, \u2026). Recommended framework version is v4.7.1.<\/p>\n<p>NextFEM gives the public interface <strong><em>IPlugin<\/em><\/strong> in <em>NextFEMplugin.dll<\/em>, that must be implemented inside the plugin you\u2019re developing. In addition, the plugin must reference <em>NextFEMapi.dll<\/em>. Both <em>NextFEMapi.dll<\/em> and <em>NextFEMplugin.dll<\/em> can be found in the installation folder of NextFEM Designer, typically <em>C:\\Program Files\\NextFEM\\NextFEM Designer 64bit\\<\/em> for 64bit installations.<br \/>\nBoth references must have the <em>Copy locally<\/em> flag set to <em>False<\/em> in the Visual Studio reference properties. To be found by the plugin, please insert the following code in your <em>app.config<\/em>.<\/p>\n<pre>\u00a0 &lt;runtime&gt;\r\n\u00a0\u00a0\u00a0 &lt;assemblyBinding xmlns=\"urn:schemas-microsoft-com:asm.v1\"&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;probing privatePath=\"..\" \/&gt;\r\n\u00a0\u00a0\u00a0 &lt;\/assemblyBinding&gt;\r\n\u00a0 &lt;\/runtime&gt;<\/pre>\n<p>Implement a <strong>base class<\/strong> like the samples below.<\/p>\n<div  class=\"ewd-ufaq-faq-list ewd-ufaq-page-type-load_more ewd-ufaq-category-tabs-\" id='ewd-ufaq-faq-list'>\n\n\t<input type='hidden' name='show_on_load' value='' id='ewd-ufaq-show-on-load' \/>\n<input type='hidden' name='include_category' value='' id='ewd-ufaq-include-category' \/>\n<input type='hidden' name='exclude_category' value='' id='ewd-ufaq-exclude-category' \/>\n<input type='hidden' name='orderby' value='title' id='ewd-ufaq-orderby' \/>\n<input type='hidden' name='order' value='desc' id='ewd-ufaq-order' \/>\n<input type='hidden' name='post_count' value='-1' id='ewd-ufaq-post-count' \/>\n<input type='hidden' name='current_url' value='\/it\/wp-json\/wp\/v2\/pages\/3417' id='ewd-ufaq-current-url' \/>\n\t\n\t\n\t<div class='ewd-ufaq-faqs'>\n\n\t\t<div  class=\"ewd-ufaq-faq-div ewd-ufaq-faq-column-count-one ewd-ufaq-faq-responsive-columns- ewd-ufaq-faq-display-style-default ewd-ufaq-can-be-toggled\" id='ewd-ufaq-post-3415-0qEpbxow9O' data-post_id='3415'>\n\n\t\t\n\t<div class='ewd-ufaq-faq-title ewd-ufaq-faq-toggle'>\n\t\n\t<a class='ewd-ufaq-post-margin'  href='#' role=\"button\">\n\n\t\t<div class='ewd-ufaq-post-margin-symbol ewd-ufaq-square'>\n\t\t\t<span >a<\/span>\n\t\t<\/div>\n\n\t\t<div class='ewd-ufaq-faq-title-text'>\n\n\t\t\t<h4>\n\t\t\t\tVB.NET language\t\t\t<\/h4>\n\n\t\t<\/div>\n\n\t\t<div class='ewd-ufaq-clear'><\/div>\n\n\t<\/a>\n\t\n<\/div>\n\t\n\t<div class='ewd-ufaq-faq-body ewd-ufaq-hidden' >\n\n\t\t\n\t\t\t\n\t\t\n\t\t\t<div class='ewd-ufaq-post-margin ewd-ufaq-faq-post'>\n\t\n<!-- p.CODE, li.CODE, div.CODE {mso-style-name:CODE; margin:0cm; margin-bottom:.0001pt; font-size:9.0pt; font-family:Consolas;} --><br \/>\n<p class=\"CODE\"><span style=\"color: #569cd6\" lang=\"EN-GB\">Imports<\/span><span lang=\"EN-GB\"> NextFEMplugin<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;<\/span><span style=\"color: #569cd6\" lang=\"EN-GB\">Public<\/span><span lang=\"EN-GB\"> <span style=\"color: #569cd6\">Class<\/span> <span style=\"color: #4ec9b0\">plugin<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">Implements <\/span><span style=\"color: #4ec9b0\">IPlugin<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;<\/span><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">Public<\/span> <span style=\"color: #569cd6\">Sub<\/span> LaunchMe(hnd <span style=\"color: #569cd6\">As<\/span> <span style=\"color: #4ec9b0\">IntPtr<\/span>) <span style=\"color: #569cd6\">Implements<\/span> <span style=\"color: #4ec9b0\">IPlugin<\/span>.LaunchMe<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">Dim<\/span> frm <span style=\"color: #569cd6\">As<\/span> <span style=\"color: #569cd6\">New <\/span><span style=\"color: #4ec9b0\">TrussDrawer<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; frm.caller = <span style=\"color: #569cd6\">Me<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; frm.Text = <span style=\"color: #569cd6\">Me<\/span>.PluginName<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; frm.Show(System.Windows.Forms.<span style=\"color: #4ec9b0\">Control<\/span>.FromHandle(hnd))<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">End<\/span> <span style=\"color: #569cd6\">Sub<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;<\/span><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">Public<\/span> <span style=\"color: #569cd6\">ReadOnly<\/span> <span style=\"color: #569cd6\">Property<\/span> PluginAuthor <span style=\"color: #569cd6\">As<\/span> <span style=\"color: #569cd6\">String<\/span><span style=\"color: #569cd6\"> Implements<\/span> <span style=\"color: #4ec9b0\">IPlugin<\/span>.PluginAuthor<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">Get<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">Return <\/span><span style=\"color: #d69d85\">&#8220;NextFEM Support Team&#8221;<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">End<\/span> <span style=\"color: #569cd6\">Get<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">End<\/span> <span style=\"color: #569cd6\">Property<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;<\/span><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">Public<\/span> <span style=\"color: #569cd6\">ReadOnly<\/span> <span style=\"color: #569cd6\">Property<\/span> PluginName <span style=\"color: #569cd6\">As<\/span> <span style=\"color: #569cd6\">String<\/span><span style=\"color: #569cd6\"> Implements<\/span> <span style=\"color: #4ec9b0\">IPlugin<\/span>.PluginName<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">Get<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">Return <\/span><span style=\"color: #d69d85\">&#8220;Truss Drawer&#8221;<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">End<\/span> <span style=\"color: #569cd6\">Get<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">End<\/span> <span style=\"color: #569cd6\">Property<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;<\/span><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">Public<\/span> <span style=\"color: #569cd6\">ReadOnly<\/span> <span style=\"color: #569cd6\">Property<\/span> iconFile <span style=\"color: #569cd6\">As<\/span> <span style=\"color: #569cd6\">String<\/span><span style=\"color: #569cd6\"> Implements<\/span> <span style=\"color: #4ec9b0\">IPlugin<\/span>.iconFile<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">Get<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">Return <\/span><span style=\"color: #d69d85\">&#8220;NextFEM.ico&#8221;<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">End<\/span> <span style=\"color: #569cd6\">Get<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">End<\/span> <span style=\"color: #569cd6\">Property<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;<\/span><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">Public<\/span> <span style=\"color: #569cd6\">Event<\/span> updateModel(sender <span style=\"color: #569cd6\">As<\/span> <span style=\"color: #569cd6\">Object<\/span>, resize <span style=\"color: #569cd6\">As<\/span> <span style=\"color: #569cd6\">Boolean<\/span>, Vstate <span style=\"color: #569cd6\">As<\/span> <span style=\"color: #4ec9b0\">ViewState<\/span>) <span style=\"color: #569cd6\">Implements<\/span> <span style=\"color: #4ec9b0\">IPlugin<\/span>.updateModel<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">Friend<\/span> <span style=\"color: #569cd6\">Sub<\/span> RequestScreenUpdate(sender <span style=\"color: #569cd6\">As<\/span> <span style=\"color: #569cd6\">Object<\/span>,resize <span style=\"color: #569cd6\">As<\/span> <span style=\"color: #569cd6\">Boolean<\/span>, Vstate <span style=\"color: #569cd6\">As<\/span> <span style=\"color: #4ec9b0\">ViewState<\/span>)<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">RaiseEvent <\/span>updateModel(sender, resize, Vstate)<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">End<\/span> <span style=\"color: #569cd6\">Sub<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">Public<\/span> <span style=\"color: #569cd6\">Event<\/span> undoCall(undoProperty <span style=\"color: #569cd6\">As <\/span><span style=\"color: #4ec9b0\">undoOps<\/span>) <span style=\"color: #569cd6\">Implements <\/span><span style=\"color: #4ec9b0\">IPlugin<\/span>.undoCall<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">Friend<\/span> <span style=\"color: #569cd6\">Sub<\/span> RequestUndo(undoProperty <span style=\"color: #569cd6\">As <\/span><span style=\"color: #4ec9b0\">undoOps<\/span>)<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">RaiseEvent <\/span>undoCall(undoProperty)<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">End<\/span> <span style=\"color: #569cd6\">Sub<\/span><\/span><\/p>\n<p class=\"CODE\">&nbsp;<\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">Public<\/span> <span style=\"color: #569cd6\">Property<\/span> API <span style=\"color: #569cd6\">As<\/span> NextFEMapi.<span style=\"color: #4ec9b0\">API<\/span> <span style=\"color: #569cd6\">Implements <\/span><span style=\"color: #4ec9b0\">IPlugin<\/span>.API<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">Public<\/span> <span style=\"color: #569cd6\">Property<\/span> currentLoadcase <span style=\"color: #569cd6\">As<\/span> <span style=\"color: #569cd6\">String<\/span> <span style=\"color: #569cd6\">Implements <\/span><span style=\"color: #4ec9b0\">IPlugin<\/span>.currentLoadcase<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp; <span style=\"color: #569cd6\">Public<\/span> <span style=\"color: #569cd6\">Property<\/span> currentTime <span style=\"color: #569cd6\">As<\/span> <span style=\"color: #569cd6\">String<\/span> <span style=\"color: #569cd6\">Implements <\/span><span style=\"color: #4ec9b0\">IPlugin<\/span>.currentTime<\/span><\/p>\n<p class=\"CODE\"><span style=\"color: #569cd6\" lang=\"EN-GB\">End<\/span><span lang=\"EN-GB\"> <span style=\"color: #569cd6\">Class<\/span><\/span><\/p>\n<\/div>\n\t\t\n\t\t\t<div class='ewd-ufaq-faq-custom-fields'>\n\n\t\n<\/div>\n\t\t\n\t\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t\t\n\t\t\n\t<\/div>\n\n<\/div><div  class=\"ewd-ufaq-faq-div ewd-ufaq-faq-column-count-one ewd-ufaq-faq-responsive-columns- ewd-ufaq-faq-display-style-default ewd-ufaq-can-be-toggled\" id='ewd-ufaq-post-3414-wxIHAnamBP' data-post_id='3414'>\n\n\t\t\n\t<div class='ewd-ufaq-faq-title ewd-ufaq-faq-toggle'>\n\t\n\t<a class='ewd-ufaq-post-margin'  href='#' role=\"button\">\n\n\t\t<div class='ewd-ufaq-post-margin-symbol ewd-ufaq-square'>\n\t\t\t<span >a<\/span>\n\t\t<\/div>\n\n\t\t<div class='ewd-ufaq-faq-title-text'>\n\n\t\t\t<h4>\n\t\t\t\tC# language\t\t\t<\/h4>\n\n\t\t<\/div>\n\n\t\t<div class='ewd-ufaq-clear'><\/div>\n\n\t<\/a>\n\t\n<\/div>\n\t\n\t<div class='ewd-ufaq-faq-body ewd-ufaq-hidden' >\n\n\t\t\n\t\t\t\n\t\t\n\t\t\t<div class='ewd-ufaq-post-margin ewd-ufaq-faq-post'>\n\t\n<!-- p.CODE, li.CODE, div.CODE {mso-style-name:CODE; margin:0cm; margin-bottom:.0001pt; font-size:9.0pt; font-family:Consolas;} --><br \/>\n<p class=\"CODE\"><span style=\"color: blue\" lang=\"EN-GB\">using <\/span><span lang=\"EN-GB\">NextFEMplugin;<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;<\/span><span style=\"color: blue\" lang=\"EN-GB\">public<\/span><span lang=\"EN-GB\"> <span style=\"color: blue\">class<\/span> plugin : IPlugin<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">{<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: blue\">public<\/span> <span style=\"color: blue\">void<\/span> LaunchMe(IntPtr hnd)<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TrussDrawer frm = <span style=\"color: blue\">new<\/span> TrussDrawer();<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; frm.caller = <span style=\"color: blue\">this<\/span>;<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; frm.Text = <span style=\"color: blue\">this<\/span>.PluginName;<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; frm.Show(System.Windows.Forms.Control.FromHandle(hnd));<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;<\/span><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: blue\">public<\/span> <span style=\"color: blue\">string<\/span> PluginAuthor<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: blue\">get<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <span style=\"color: blue\">return <\/span><span style=\"color: darkred\">&#8220;NextFEM Support Team&#8221;<\/span>; }<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;<\/span><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: blue\">public<\/span> <span style=\"color: blue\">string<\/span> PluginName<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: blue\">get<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <span style=\"color: blue\">return <\/span><span style=\"color: darkred\">&#8220;Truss Drawer&#8221;<\/span>; }<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;<\/span><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: blue\">public<\/span> <span style=\"color: blue\">string<\/span> iconFile<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: blue\">get<\/span><\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <span style=\"color: blue\">return <\/span><span style=\"color: darkred\">&#8220;NextFEM.ico&#8221;<\/span>; }<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;<\/span><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: blue\">public<\/span> <span style=\"color: blue\">event<\/span> EventHandler updateModel;<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: blue\">internal<\/span> <span style=\"color: blue\">void<\/span> RequestScreenUpdate(<span style=\"color: blue\">object <\/span>sender, <span style=\"color: blue\">bool<\/span> resize, ViewState Vstate)<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; updateModel(sender, resize,Vstate);<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: blue\">public<\/span> <span style=\"color: blue\">event<\/span> EventHandler undoCall;<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: blue\">internal<\/span> <span style=\"color: blue\">void<\/span> RequestUndo(undoOps undoProperty)<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; undoCall(undoProperty);<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;<\/span><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: blue\">public <\/span>NextFEMapi.API API {get; set;}<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: blue\">public<\/span> <span style=\"color: blue\">string<\/span> currentLoadcase {get; set;}<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: blue\">public<\/span> <span style=\"color: blue\">string<\/span> currentTime {get; set;}<\/span><\/p>\n<p class=\"CODE\"><span lang=\"EN-GB\">}<\/span><\/p>\n<\/div>\n\t\t\n\t\t\t<div class='ewd-ufaq-faq-custom-fields'>\n\n\t\n<\/div>\n\t\t\n\t\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t\t\n\t\t\n\t<\/div>\n\n<\/div>\n\t<\/div>\n\n\t\n<\/div>\n<p>Implementation is discussed on VB.NET code. Below all the fields of the interface are described:<\/p>\n<ul>\n<li><strong>PluginName<\/strong> : name of the plugin as string. The same name can be used to call the plugin by starting Designer via command-line. Eg. <em>exe \u2013plugin \u201cTruss Drawer\u201d<\/em><\/li>\n<li><strong>PluginAuthor<\/strong> : string for the author of the plugin;<\/li>\n<li><strong>iconFile<\/strong> : it sets the filename of the image to be loaded into the <em>Tools\/Plugins<\/em> menu in NextFEM Designer. This is optional, if not used please return an empty string.<\/li>\n<li><strong>LaunchMe<\/strong> : procedure for starting the plugin application (eg. a form). It must initialize NextFEM API (otherwise ) and pass the current instance of the base class to the plugin application form. In the sample above, it instantiates and launches the TrussDrawer The variable <em>caller<\/em> is declared in the form as: Friend caller as plugin<br \/>\nAs final step, this procedure launched the form, passing the handle to be treated as Designer mask:<br \/>\nfrm.Show(System.Windows.Forms.Control.FromHandle(hnd))<\/li>\n<li><strong>updateModel<\/strong> : event to be called for requesting a viewport update. Since events can be called only in the same class, the function <em>RequestScreenUpdate<\/em> is implemented and has to be called from the plugin app form.<\/li>\n<li><strong>undoCall <\/strong>: it follows the same working mechanism as <em>updateModel<\/em>.<\/li>\n<li><strong>API :<\/strong> an instance of NextFEM API class, retaining all the methods to operate in model and results. You don\u2019t need to implement it in your base class.<\/li>\n<li><strong>currentLoadCase :<\/strong> string indicating the loadcase showed on screen for loading or results views.<\/li>\n<li><strong>currentTime :<\/strong> string indicating the time or the mode showed on screen for results view.<\/li>\n<\/ul>\n<p>Plugins can operate in every way in the model. There are some good practice rules to ensure their optimal functionality:<\/p>\n<p>1) to load other DLLs in your plugin, please add the following code inside the form code:<\/p>\n<pre>\u00a0\u00a0\u00a0 ' for loading dlls in the same folder - IMPORTANT: must be Private!\r\n\u00a0\u00a0\u00a0 Private currentDomain As AppDomain = AppDomain.CurrentDomain\r\n\u00a0\u00a0\u00a0 Private Function MyResolveEventHandler(ByVal sender As Object, ByVal args As ResolveEventArgs) As System.Reflection.Assembly\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ' this handler is called only when the CLR tries to bind to the assembly and fails\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Dim strTempAssmbPath As String = \"\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Dim MyAssembly, objExecutingAssembly As System.Reflection.Assembly\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 objExecutingAssembly = System.Reflection.Assembly.GetExecutingAssembly()\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ' seek in the same folder\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Dim name As String = args.Name.Substring(0, args.Name.IndexOf(\",\"))\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 strTempAssmbPath = My.Application.Info.DirectoryPath &amp; \"\\plugins\\\" &amp; name &amp; \".dll\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 If IO.File.Exists(strTempAssmbPath) = False Then Return Nothing\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ' load the assembly from the specified path\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 MyAssembly = System.Reflection.Assembly.LoadFrom(strTempAssmbPath)\r\n\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0' return the loaded assembly\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Return MyAssembly\r\n\u00a0\u00a0\u00a0 End Function<\/pre>\n<p>In addition, a handler to this event must be added to the <em>MyBase.Load<\/em> procedure:<\/p>\n<pre>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ' use DLL loading for load assemblied from the same plugin folder (or set subfolder in MyResolveEventHandler)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 AddHandler currentDomain.AssemblyResolve, AddressOf MyResolveEventHandler<\/pre>\n<p>Remember, in <em>MyBase.Closing<\/em>, to remove the handler:<\/p>\n<pre>RemoveHandler currentDomain.AssemblyResolve, AddressOf MyResolveEventHandler<\/pre>\n<p>Complex plugins with many DLLs may use a subdirectory of \u201cplugins\u201d folder.<\/p>\n<p>2) Every operation on the model have to be preceded by an \u201c<em>Undo request<\/em>\u201d to Designer.<\/p>\n<pre>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ' call undo\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 caller.RequestUndo(NextFEMplugin.undoProps.Normal)<\/pre>\n<p>and followed by a request for updating screen:<\/p>\n<pre>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ' refresh the view\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 caller.RequestScreenUpdate(caller, True, NextFEMplugin.ViewState.NoOperation)<\/pre>\n<p>3) to update the viewport in Designer, you may choose between a variety of commands, all put together in the ViewState enumerator.<\/p>\n<p>Eg.: caller.RequestScreenUpdate(caller, False, NextFEMplugin.ViewState.NoOperation)<\/p>\n<p>This line request to Designer a screen update, <em>resize<\/em> is set to false hence not \u201cView all\u201d operation is called, and the ViewState is set to <em>NoOperation<\/em>, that means no operation required.<\/p>\n<p>Here you are a list of visual operations you can call:<\/p>\n<table width=\"0\">\n<tbody>\n<tr>\n<td width=\"149\"><strong><em>ViewState enumerator<\/em><\/strong><\/td>\n<td width=\"417\"><strong>Action and remarks<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>Reset<\/em><\/td>\n<td width=\"417\">Viewport is reset to default (no results and no loading views)<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>NoOperation<\/em><\/td>\n<td width=\"417\">No operation is performed, leave viewport as it is.<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>NodesVisible<\/em><\/td>\n<td width=\"417\">Show nodes. Call Reset to disable view.<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>NodesNumber<\/em><\/td>\n<td width=\"417\">Show nodes numbers. Call Reset to disable view.<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>ElementsNumber<\/em><\/td>\n<td width=\"417\">Show elements numbers. Call Reset to disable view.<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>ExtrudedView<\/em><\/td>\n<td width=\"417\">Show extruded views. Call Reset to disable view.<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>ColorElements_Uniform<\/em><\/td>\n<td width=\"417\">Show uniform color in elements. Call Reset to disable view.<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>ColorElements_BySection<\/em><\/td>\n<td width=\"417\">Color elements by sections. Call Reset to disable view.<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>ColorElements_ByMaterial<\/em><\/td>\n<td width=\"417\">Color elements by materials. Call Reset to disable view.<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>ColorElements_ByGroup<\/em><\/td>\n<td width=\"417\">Color elements by groups. Call Reset to disable view.<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>ShowLocalAxes<\/em><\/td>\n<td width=\"417\">Show element local axes. Recall it to disable view.<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>GetScreenshot<\/em><\/td>\n<td width=\"417\">Get screenshot of the current view. Screenshot is stored in Clipboard.<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>ShowAllLoads<\/em><\/td>\n<td width=\"417\">Show all loads in mdoel. Call reset to disable view.<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>ShowDisplResults<\/em><\/td>\n<td width=\"417\">Show displacement results. Call Reset to disable view.<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>HighlightSelectedNodes<\/em><\/td>\n<td width=\"417\">Highlight selected nodes. Call ClearNodesHighlight to disable view.<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>HighlightSelectedElems<\/em><\/td>\n<td width=\"417\">Highlight selected element. Call ClearElementsHighlight to disable view.<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>ClearNodesHighlight<\/em><\/td>\n<td width=\"417\">Clear the nodes highlighting<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>ClearElementsHighlight<\/em><\/td>\n<td width=\"417\">Clear the elements highlighting<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>ShowNodesCheckResults<\/em><\/td>\n<td width=\"417\">Show nodes check results. Call Reset to disable view.<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>ShowElementsCheckResults<\/em><\/td>\n<td width=\"417\">Show elements check results. Call Reset to disable view.<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>ShowFrameForcesResults<\/em><\/td>\n<td width=\"417\">Show frame forces results. Call Reset to disable view.<\/td>\n<\/tr>\n<tr>\n<td width=\"149\"><em>ShowReactionsResults<\/em><\/td>\n<td width=\"417\">Show element reactions results. Recall it to disable view.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>For results and loading views, you should set also <em>caller.currentLoadcase<\/em> and, mostly for modal or non-linear analyses, also <em>caller.currentTime<\/em>.<\/p>\n<p>4) prior to do any action in the model (adding nodes, element, etc.) you should request an undo operation to the Designer. Otherwise, the user cannot revert what plugin did in the model.<\/p>\n<p>Eg.: caller.RequestUndo(NextFEMplugin.undoOps.Normal)<\/p>\n<p>&nbsp;<\/p>\n<table width=\"0\">\n<tbody>\n<tr>\n<td width=\"132\"><strong><em>undoOps enumerator<\/em><\/strong><\/td>\n<td width=\"267\"><strong>Action and remarks<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"132\"><em>Normal<\/em><\/td>\n<td width=\"267\">User will be prompted to clear results, if present.<\/td>\n<\/tr>\n<tr>\n<td width=\"132\"><em>NormalDontAsk<\/em><\/td>\n<td width=\"267\">User will not be prompted to clear results.<\/td>\n<\/tr>\n<tr>\n<td width=\"132\"><em>NoUndo<\/em><\/td>\n<td width=\"267\">No operation is added to undo stack.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Debugging a plugin<\/h4>\n<p>Finally, for debugging purposes, you can copy the whole NextFEM Designer installation directory (typically <em>C:\\Program Files\\NextFEM\\NextFEM Designer 64bit\\<\/em> for 64bit installations) anywhere in your hard-disk, and target its subfolder \u201c<em>plugins<\/em>\u201d as output directory for your program.<br \/>\n<em>IMPORTANT: remember that the \u201cplugins\u201d folder is not writable.<br \/>\n<\/em>Plugins DLLs can be freely developed and distributed without including files or parts of NextFEM Designer assemblies. Always remember to distribute the DLL together with the corresponding <em>.dll.config<\/em> file (which contains the <em>app.config<\/em> copy).<\/p>\n<p>Each plugin must be a DLL build on the base of the sample project below, which is a simple program to draw truss structures in Designer. You can freely use this as a base for your plugin.<\/p>\n<h4>Get element type<\/h4>\n<p>When using the method<\/p>\n<pre xml:space=\"preserve\"><span class=\"identifier\">getElementProperty<\/span>(ID, \"type\")<\/pre>\n<p>to check the type of an element, you get an integer value as listed below:<\/p>\n<p>unk = 0<br \/>\nline = 1<br \/>\ntria = 2<br \/>\nquad = 3<br \/>\nhexa = 4<br \/>\nwedge = 5<br \/>\ntetra = 6<br \/>\nuser = 10<br \/>\nline3 = 20<br \/>\nquad8 = 21<br \/>\nhexa16 = 22<br \/>\nhexa20 = 23<br \/>\ntetra10 = 24<br \/>\ntria6 = 25<br \/>\nwedge15 = 26<br \/>\nspring2nodes = 40<\/p>\n<h4>Saving plugin data<\/h4>\n<p>To save plugin data you can use a custom field stored just inside the model. See API reference for the following functions. The key used to store data should be the plugin name.<\/p>\n<pre>addOrModifyCustomData\r\n\r\ngetCustomData\r\n\r\nremoveCustomData<\/pre>\n<h3>Resources<\/h3>\n<p><a href=\"http:\/\/www.nextfem.it\/dev\/PluginSample.zip\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>Download VB.NET sample project<\/strong><\/a><\/p>\n<p><a href=\"https:\/\/www.nextfem.it\/it\/forums\/forum\/developer-forum\/\" target=\"_blank\" rel=\"noopener\"><strong>Developers&#8217; forum<\/strong><\/a> (for all public enquiries)<\/p>\n<p><a href=\"https:\/\/www.nextfem.it\/api\/html\/N_NextFEMapi.htm\" target=\"_blank\" rel=\"noopener\"><strong>API reference<\/strong><\/a><\/p>\n<p><strong><a href=\"https:\/\/github.com\/NextFEM\" target=\"_blank\" rel=\"noopener\">NextFEM Github repositories<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A C# language using NextFEMplugin; &nbsp;public class plugin : IPlugin { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public void LaunchMe(IntPtr hnd) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TrussDrawer frm = new TrussDrawer(); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; frm.caller = this; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; frm.Text &#8230;<\/p>\n","protected":false},"author":136,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"class_list":["post-3417","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.nextfem.it\/it\/wp-json\/wp\/v2\/pages\/3417","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nextfem.it\/it\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.nextfem.it\/it\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.nextfem.it\/it\/wp-json\/wp\/v2\/users\/136"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nextfem.it\/it\/wp-json\/wp\/v2\/comments?post=3417"}],"version-history":[{"count":0,"href":"https:\/\/www.nextfem.it\/it\/wp-json\/wp\/v2\/pages\/3417\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nextfem.it\/it\/wp-json\/wp\/v2\/media?parent=3417"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}