{"id":3425,"date":"2020-12-07T12:29:44","date_gmt":"2020-12-07T11:29:44","guid":{"rendered":"https:\/\/www.nextfem.it\/it\/?page_id=3425"},"modified":"2025-11-14T08:57:51","modified_gmt":"2025-11-14T07:57:51","slug":"python","status":"publish","type":"page","link":"https:\/\/www.nextfem.it\/it\/python\/","title":{"rendered":"Python"},"content":{"rendered":"<table style=\"height: 101px; width: 100%; border: medium; border-collapse: collapse; border-radius: 15px; background-color: #e7eba9;\" border=\"medium\">\n<tbody>\n<tr style=\"height: 60px;\">\n<td style=\"width: 30%; border: medium; height: 101px;\" rowspan=\"2\"><img decoding=\"async\" class=\"wp-image-3429 aligncenter\" src=\"https:\/\/www.nextfem.it\/it\/wp-content\/uploads\/logoNF_Python.png\" alt=\"\" width=\"112\" height=\"112\" srcset=\"https:\/\/www.nextfem.it\/it\/wp-content\/uploads\/logoNF_Python.png 240w, https:\/\/www.nextfem.it\/it\/wp-content\/uploads\/logoNF_Python-150x150.png 150w, https:\/\/www.nextfem.it\/it\/wp-content\/uploads\/logoNF_Python-24x24.png 24w, https:\/\/www.nextfem.it\/it\/wp-content\/uploads\/logoNF_Python-48x48.png 48w, https:\/\/www.nextfem.it\/it\/wp-content\/uploads\/logoNF_Python-96x96.png 96w\" sizes=\"(max-width: 112px) 100vw, 112px\" \/><\/td>\n<td style=\"width: 70%; border: medium; height: 60px;\">\n<h2>NextFEM Python Scripting<\/h2>\n<\/td>\n<\/tr>\n<tr style=\"height: 41px;\">\n<td style=\"width: 70%; border: medium; height: 41px;\">\n<h5>Empower structural analysis with Python<\/h5>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>NextFEM APIs can be used with Python as well. This plugin helps developers in finding and testing every API instruction, directly in Designer and with immediate effect in the model.<\/p>\n<h3>Integrated Python scripting<\/h3>\n<p>Integrated Python scripting can be started by the command <em>Tools \/ Python scripting<\/em>. It is a web-powered Python scripting engine, able to run scripts and\/or code snippets directly from within the program. Below you can see it in action after <a href=\"https:\/\/raw.githubusercontent.com\/NextFEM\/NextFEMpy\/refs\/heads\/main\/samples\/flat_slab.py\" target=\"_blank\" rel=\"noopener\"><strong>this sample script<\/strong><\/a> has been run.<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-6290\" src=\"https:\/\/www.nextfem.it\/it\/wp-content\/uploads\/python_scripting.jpg\" alt=\"\" width=\"1486\" height=\"893\" srcset=\"https:\/\/www.nextfem.it\/it\/wp-content\/uploads\/python_scripting.jpg 1486w, https:\/\/www.nextfem.it\/it\/wp-content\/uploads\/python_scripting-300x180.jpg 300w, https:\/\/www.nextfem.it\/it\/wp-content\/uploads\/python_scripting-1024x615.jpg 1024w, https:\/\/www.nextfem.it\/it\/wp-content\/uploads\/python_scripting-768x462.jpg 768w, https:\/\/www.nextfem.it\/it\/wp-content\/uploads\/python_scripting-600x361.jpg 600w\" sizes=\"(max-width: 1486px) 100vw, 1486px\" \/><\/p>\n<p>Samples are available <a href=\"https:\/\/github.com\/NextFEM\/NextFEMpy\/tree\/main\/samples\" target=\"_blank\" rel=\"noopener\"><strong>here<\/strong><\/a>.<\/p>\n<h3>NextFEMpy Python package<\/h3>\n<p>We supply the NextFEMpy Python package, which is a NextFEM REST API wrapper in pure Python, to be used with NextFEM Designer or NextFEM Server. It is a complete set of REST API call, wrapped in Python functions, distinguishing between mandatory and optional arguments.<\/p>\n<p dir=\"auto\">If you&#8217;re looking for NextFEMpy source, look into \/nextfempy folder. If you&#8217;re looking for sample code using nextfempy, look into \/samples folder.<\/p>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h6 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">Installation instructions<\/h6>\n<p><a id=\"user-content-installation-instructions\" class=\"anchor\" href=\"https:\/\/github.com\/NextFEM\/NextFEMpy\/tree\/main#installation-instructions\" aria-label=\"Permalink: Installation instructions\"><\/a><code>pip install nextfempy<br \/>\n<\/code><\/p>\n<\/div>\n<div class=\"zeroclipboard-container\"><\/div>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h6 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">Upgrading instructions<\/h6>\n<p><a id=\"user-content-upgrading-instructions\" class=\"anchor\" href=\"https:\/\/github.com\/NextFEM\/NextFEMpy\/tree\/main#upgrading-instructions\" aria-label=\"Permalink: Upgrading instructions\"><\/a><code>pip install nextfempy --upgrade<br \/>\n<\/code><\/p>\n<\/div>\n<div class=\"zeroclipboard-container\"><\/div>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h6 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">Usage<\/h6>\n<p><a id=\"user-content-usage\" class=\"anchor\" href=\"https:\/\/github.com\/NextFEM\/NextFEMpy\/tree\/main#usage\" aria-label=\"Permalink: Usage\"><\/a>Before using with your local installation of NextFEM Designer, start the plugin REST API Server.<\/p>\n<\/div>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>from nextfempy import NextFEMrest\r\n# connect to local copy of NextFEM Designer\r\nnf=NextFEMapiREST.NextFEMrest()\r\n<\/code><\/pre>\n<\/div>\n<p dir=\"auto\">To handle a property:<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>nf.autoMassInX=False\r\nprint(str(nf.autoMassInX))\r\n<\/code><\/pre>\n<\/div>\n<p dir=\"auto\">To call a NextFEM API method:<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>nf.addOrModifyCustomData(\"test\",\"Test\")\r\nprint(nf.getCustomData(\"test\"))\r\n<\/code><\/pre>\n<\/div>\n<h3>Python Console<\/h3>\n<p>The <em>Python Console<\/em> in NextFEM Designer is accessible in the Plugin tab.<\/p>\n<p><img decoding=\"async\" class=\"wp-image-3426 aligncenter\" src=\"https:\/\/www.nextfem.it\/it\/wp-content\/uploads\/pythonConsole.png\" alt=\"\" width=\"811\" height=\"280\" srcset=\"https:\/\/www.nextfem.it\/it\/wp-content\/uploads\/pythonConsole.png 643w, https:\/\/www.nextfem.it\/it\/wp-content\/uploads\/pythonConsole-300x104.png 300w, https:\/\/www.nextfem.it\/it\/wp-content\/uploads\/pythonConsole-600x207.png 600w, https:\/\/www.nextfem.it\/it\/wp-content\/uploads\/pythonConsole-250x86.png 250w, https:\/\/www.nextfem.it\/it\/wp-content\/uploads\/pythonConsole-640x222.png 640w\" sizes=\"(max-width: 811px) 100vw, 811px\" \/><\/p>\n<p>This plugin works only with 64bit version of NextFEM Designer and needs Python3 64bit installed in system. Users must have Python available in the PATH environment variable.<\/p>\n<p>This plugin is formed by two boards:<\/p>\n<ol>\n<li>a <strong>Linked board<\/strong> in which every API method affects the model and the viewport. This has Python syntax and some basic functions, but it\u2019s not a complete Python console. In the lower textbox, start typing \u201c\u201d and the available commands will be suggested, as well as their arguments. Arguments between \u201c&lt;\u201d and \u201c&gt;\u201d are optional. API reference can be recalled by pressing <em>Open API reference<\/em>.<\/li>\n<li>An <strong>External board<\/strong>, which is a complete Python terminal. The instance of API (always called <strong>nf<\/strong>) is not linked to the model here. You can export the model from linked to external board by the button <em>Export model<\/em>.<\/li>\n<\/ol>\n<p>The other controls in this form are associated to the <em>ViewState<\/em> and <em>undoOps<\/em> enumerator and with the <em>resize<\/em> boolean variable as explained above.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>NextFEM Python Scripting Empower structural analysis with Python NextFEM APIs can be used with Python as well. This plugin helps developers in finding and testing every API instruction, directly in &#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-3425","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.nextfem.it\/it\/wp-json\/wp\/v2\/pages\/3425","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=3425"}],"version-history":[{"count":0,"href":"https:\/\/www.nextfem.it\/it\/wp-json\/wp\/v2\/pages\/3425\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nextfem.it\/it\/wp-json\/wp\/v2\/media?parent=3425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}