{"id":3687,"date":"2019-03-25T17:45:29","date_gmt":"2019-03-25T20:45:29","guid":{"rendered":"http:\/\/xexeu.elipse.com.br\/pt\/executando-scripts-python-atraves-do-elipse-e3\/"},"modified":"2022-09-09T15:50:25","modified_gmt":"2022-09-09T18:50:25","slug":"executando-scripts-python-atraves-do-elipse-e3","status":"publish","type":"post","link":"https:\/\/kb.elipse.com.br\/en\/executando-scripts-python-atraves-do-elipse-e3\/","title":{"rendered":"Executando scripts Python atrav\u00e9s do Elipse E3."},"content":{"rendered":"<div align=\"justify\">\n<p><b>Python <\/b>\u00e9 uma linguagem de programa\u00e7\u00e3o de uso geral que \u00e9 especialmente utilizada para solu\u00e7\u00f5es cient\u00edficas e de engenharia, pois possui diversas bibliotecas para manipula\u00e7\u00e3o de dados, c\u00e1lculos, estat\u00edsticas, visualiza\u00e7\u00e3o, etc.<\/p>\n<p>O Elipse E3 n\u00e3o tem suporte nativo a essa linguagem; no entanto, \u00e9 poss\u00edvel executar aplicativos externos via VBScript, utilizando um comando equivalente ao <b>Executar <\/b>do Windows. Para isso, \u00e9 necess\u00e1rio que o interpretador e as bibliotecas utilizadas pelo script tenham sido instalados. Para isso, \u00e9 necess\u00e1rio baixar e instalar o <strong>Python (x86 ou x64)<\/strong> do site <a href=\"https:\/\/www.python.org\/downloads\/windows\/\">https:\/\/www.python.org\/downloads\/windows\/<\/a>.<\/p>\n<p><u><b>Exemplo 1<\/b><\/u>:\u00a0 c\u00f3digo Python gerando um gr\u00e1fico de barras com a biblioteca <a href=\"http:\/\/matplotlib.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">Matplotlib<\/a> (para instala\u00e7\u00e3o via prompt de comando, utilize: <em>pip install matplotlib<\/em>), usando dados recebidos via argumentos de linha de comando.<\/p>\n<div align=\"left\">\n<pre><span style=\"color: #ff9900;font-family: Courier New\">import <\/span><span style=\"font-family: Courier New\">sys<\/span>\r\n<span style=\"font-family: Courier New\"><span style=\"color: #ff9900\">import <\/span>numpy <span style=\"color: #ff9900\">as <\/span>np<\/span>\r\n<span style=\"font-family: Courier New\"><span style=\"color: #ff9900\">import <\/span>matplotlib.pyplot <span style=\"color: #ff9900\">as <\/span>plt\r\n\r\n<\/span><span style=\"font-family: Courier New\">rs <span style=\"color: #ffcc00\">=<\/span> sys.argv[<span style=\"color: #ff9900\">1<\/span>]<\/span>\r\n<span style=\"font-family: Courier New\">rj<span style=\"color: #ffcc00\"> =<\/span> sys.argv[<span style=\"color: #ff9900\">2<\/span>]<\/span>\r\n<span style=\"font-family: Courier New\">pr <span style=\"color: #ffcc00\">=<\/span> sys.argv[<span style=\"color: #ff9900\">3<\/span>]<\/span>\r\n<span style=\"font-family: Courier New\">sp <span style=\"color: #ffcc00\">=<\/span> sys.argv[<span style=\"color: #ff9900\">4<\/span>]<\/span>\r\n<span style=\"font-family: Courier New\">mg <span style=\"color: #ffcc00\">=<\/span> sys.argv[<span style=\"color: #ff9900\">5<\/span>]<\/span>\r\n\r\n<span style=\"font-family: Courier New\">estados <span style=\"color: #ffcc00\">=<\/span> (<span style=\"color: #339966\">'RS'<\/span>, <span style=\"color: #339966\">'RJ'<\/span>,<span style=\"color: #339966\"> 'PR'<\/span>, <span style=\"color: #339966\">'SP'<\/span>,<span style=\"color: #339966\"> 'MG'<\/span>)<\/span>\r\n<span style=\"font-family: Courier New\">y_pos<span style=\"color: #ffcc00\"> =<\/span> np.arange(<span style=\"color: #ff9900\">len<\/span>(estados))<\/span>\r\n<span style=\"font-family: Courier New\">performance <span style=\"color: #ffcc00\">=<\/span> [rs,rj,pr,sp,mg]<\/span>\r\n\r\n<span style=\"font-family: Courier New\">plt.barh(y_pos, performance, align=<span style=\"color: #339966\">'center'<\/span>, alpha=0.4)<\/span>\r\n<span style=\"font-family: Courier New\">plt.yticks(y_pos, estados)<\/span>\r\n<span style=\"font-family: Courier New\">plt.xlabel(<span style=\"color: #339966\">'Temperatura'<\/span>)<\/span>\r\n<span style=\"font-family: Courier New\">plt.title(<span style=\"color: #339966\">'Grafico com dados do E3'<\/span>)<\/span>\r\n<span style=\"font-family: Courier New\">plt.show()<\/span><\/pre>\n<\/div>\n<p><u><b>Exemplo 2<\/b><\/u>:\u00a0 c\u00f3digo VBScript passando argumentos e executando o programa em Python.<\/p>\n<pre><span style=\"font-family: Courier New\">temprs = Screen.Item(<span style=\"color: #ff0000\">\"spTempRS\"<\/span>).Value\r\ntemprj = Screen.Item(<span style=\"color: #ff0000\">\"spTempRJ\"<\/span>).Value<\/span>\r\n<span style=\"font-family: Courier New\">temppr = Screen.Item(<span style=\"color: #ff0000\">\"spTempRS\"<\/span>).Value<\/span>\r\n<span style=\"font-family: Courier New\">tempsp = Screen.Item(<span style=\"color: #ff0000\">\"spTempSP\"<\/span>).Value<\/span>\r\n<span style=\"font-family: Courier New\">tempmg = Screen.Item(<span style=\"color: #ff0000\">\"spTempMG\"<\/span>).Value<\/span>\r\n\r\n<span style=\"font-family: Courier New\"><span style=\"color: #0000ff\">Dim <\/span>oShell<\/span>\r\n<span style=\"font-family: Courier New\"><span style=\"color: #0000ff\">Set <\/span>oShell = CreateObject(<span style=\"color: #ff0000\">\"WSCript.shell\"<\/span>)<\/span>\r\n<span style=\"font-family: Courier New\">oShell.run <span style=\"color: #ff0000\">\"C:\\E3Python\\grafico.py \"<\/span>&temprs&<span style=\"color: #ff0000\">\" \"<\/span>&temprj&<span style=\"color: #ff0000\">\" \"<\/span>&temppr&<span style=\"color: #ff0000\">\" \"<\/span>&tempsp&<span style=\"color: #ff0000\">\" \"<\/span>&tempmg,0\r\n\r\n<\/span><\/pre>\n<p>O resultado \u00e9 uma janela popup semelhante a esta:<\/p>\n<div align=\"center\"><img loading=\"lazy\" title=\"\" src=\"http:\/\/kb.elipse.com.br\/pt-br\/images\/ID5393\/grafico.png\" alt=\"\" width=\"500\" height=\"423\" align=\"Baseline\" border=\"0\" hspace=\"0\" vspace=\"0\" \/><\/div>\n<p>No anexo do artigo, apresentamos uma aplica\u00e7\u00e3o que utiliza este exemplo, com o c\u00f3digo comentado.<\/p>\n<h3>Anexos:<\/h3>\n<p><a href=\"\/wp-content\/uploads\/2019\/03\/E3Python-1.zip\">E3Python.zip<\/a><\/p>\n<\/div>\n<p><!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python \u00e9 uma linguagem de programa\u00e7\u00e3o de uso geral que \u00e9 especialmente utilizada para solu\u00e7\u00f5es cient\u00edficas e de engenharia, pois possui diversas bibliotecas para manipula\u00e7\u00e3o de dados, c\u00e1lculos, estat\u00edsticas, visualiza\u00e7\u00e3o,&hellip;<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0},"categories":[610],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Executando scripts Python atrav\u00e9s do Elipse E3. - Elipse Knowledgebase<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Executando scripts Python atrav\u00e9s do Elipse E3.\" \/>\n<meta property=\"og:description\" content=\"Python \u00e9 uma linguagem de programa\u00e7\u00e3o de uso geral que \u00e9 especialmente utilizada para solu\u00e7\u00f5es cient\u00edficas e de engenharia, pois possui diversas bibliotecas para manipula\u00e7\u00e3o de dados, c\u00e1lculos, estat\u00edsticas, visualiza\u00e7\u00e3o,&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/\" \/>\n<meta property=\"og:site_name\" content=\"Elipse Knowledgebase\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/www.facebook.com\/elipsesoftware\" \/>\n<meta property=\"article:published_time\" content=\"2019-03-25T20:45:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-09-09T18:50:25+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/kb.elipse.com.br\/pt-br\/images\/ID5393\/grafico.png\" \/>\n<meta name=\"author\" content=\"Lucas Kotres\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Lucas Kotres\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/\"},\"author\":{\"name\":\"Lucas Kotres\",\"@id\":\"https:\/\/kb.elipse.com.br\/#\/schema\/person\/e57d707c58cf7aa3231eb5fdcc2ec379\"},\"headline\":\"Executando scripts Python atrav\u00e9s do Elipse E3.\",\"datePublished\":\"2019-03-25T20:45:29+00:00\",\"dateModified\":\"2022-09-09T18:50:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/\"},\"wordCount\":185,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\/\/kb.elipse.com.br\/#organization\"},\"articleSection\":[\"Scripts\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/\",\"url\":\"https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/\",\"name\":\"[:pt]Executando scripts Python atrav\u00e9s do Elipse E3.[:] - Elipse Knowledgebase\",\"isPartOf\":{\"@id\":\"https:\/\/kb.elipse.com.br\/#website\"},\"datePublished\":\"2019-03-25T20:45:29+00:00\",\"dateModified\":\"2022-09-09T18:50:25+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"In\u00edcio\",\"item\":\"https:\/\/kb.elipse.com.br\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Executando scripts Python atrav\u00e9s do Elipse E3.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/kb.elipse.com.br\/#website\",\"url\":\"https:\/\/kb.elipse.com.br\/\",\"name\":\"Elipse Knowledgebase\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/kb.elipse.com.br\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/kb.elipse.com.br\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/kb.elipse.com.br\/#organization\",\"name\":\"Elipse Software\",\"url\":\"https:\/\/kb.elipse.com.br\/\",\"sameAs\":[\"http:\/\/www.facebook.com\/elipsesoftware\"],\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/kb.elipse.com.br\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/kb.elipse.com.br\/wp-content\/uploads\/2019\/05\/schererelipse-com-br\/logoElipse.png\",\"contentUrl\":\"https:\/\/kb.elipse.com.br\/wp-content\/uploads\/2019\/05\/schererelipse-com-br\/logoElipse.png\",\"width\":161,\"height\":58,\"caption\":\"Elipse Software\"},\"image\":{\"@id\":\"https:\/\/kb.elipse.com.br\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/kb.elipse.com.br\/#\/schema\/person\/e57d707c58cf7aa3231eb5fdcc2ec379\",\"name\":\"Lucas Kotres\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/kb.elipse.com.br\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/faa3c53fb2e8ab0c35c4b8c90a691931?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/faa3c53fb2e8ab0c35c4b8c90a691931?s=96&d=mm&r=g\",\"caption\":\"Lucas Kotres\"},\"url\":\"https:\/\/kb.elipse.com.br\/en\/author\/kotres\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Executando scripts Python atrav\u00e9s do Elipse E3. - Elipse Knowledgebase","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/","og_locale":"en_US","og_type":"article","og_title":"[:pt]Executando scripts Python atrav\u00e9s do Elipse E3.[:] - Elipse Knowledgebase","og_description":"Python \u00e9 uma linguagem de programa\u00e7\u00e3o de uso geral que \u00e9 especialmente utilizada para solu\u00e7\u00f5es cient\u00edficas e de engenharia, pois possui diversas bibliotecas para manipula\u00e7\u00e3o de dados, c\u00e1lculos, estat\u00edsticas, visualiza\u00e7\u00e3o,&hellip;","og_url":"https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/","og_site_name":"Elipse Knowledgebase","article_publisher":"http:\/\/www.facebook.com\/elipsesoftware","article_published_time":"2019-03-25T20:45:29+00:00","article_modified_time":"2022-09-09T18:50:25+00:00","og_image":[{"url":"http:\/\/kb.elipse.com.br\/pt-br\/images\/ID5393\/grafico.png"}],"author":"Lucas Kotres","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Lucas Kotres","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/#article","isPartOf":{"@id":"https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/"},"author":{"name":"Lucas Kotres","@id":"https:\/\/kb.elipse.com.br\/#\/schema\/person\/e57d707c58cf7aa3231eb5fdcc2ec379"},"headline":"Executando scripts Python atrav\u00e9s do Elipse E3.","datePublished":"2019-03-25T20:45:29+00:00","dateModified":"2022-09-09T18:50:25+00:00","mainEntityOfPage":{"@id":"https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/"},"wordCount":185,"commentCount":3,"publisher":{"@id":"https:\/\/kb.elipse.com.br\/#organization"},"articleSection":["Scripts"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/","url":"https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/","name":"[:pt]Executando scripts Python atrav\u00e9s do Elipse E3.[:] - Elipse Knowledgebase","isPartOf":{"@id":"https:\/\/kb.elipse.com.br\/#website"},"datePublished":"2019-03-25T20:45:29+00:00","dateModified":"2022-09-09T18:50:25+00:00","breadcrumb":{"@id":"https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/kb.elipse.com.br\/executando-scripts-python-atraves-do-elipse-e3\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"In\u00edcio","item":"https:\/\/kb.elipse.com.br\/en\/"},{"@type":"ListItem","position":2,"name":"Executando scripts Python atrav\u00e9s do Elipse E3."}]},{"@type":"WebSite","@id":"https:\/\/kb.elipse.com.br\/#website","url":"https:\/\/kb.elipse.com.br\/","name":"Elipse Knowledgebase","description":"","publisher":{"@id":"https:\/\/kb.elipse.com.br\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kb.elipse.com.br\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/kb.elipse.com.br\/#organization","name":"Elipse Software","url":"https:\/\/kb.elipse.com.br\/","sameAs":["http:\/\/www.facebook.com\/elipsesoftware"],"logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kb.elipse.com.br\/#\/schema\/logo\/image\/","url":"https:\/\/kb.elipse.com.br\/wp-content\/uploads\/2019\/05\/schererelipse-com-br\/logoElipse.png","contentUrl":"https:\/\/kb.elipse.com.br\/wp-content\/uploads\/2019\/05\/schererelipse-com-br\/logoElipse.png","width":161,"height":58,"caption":"Elipse Software"},"image":{"@id":"https:\/\/kb.elipse.com.br\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/kb.elipse.com.br\/#\/schema\/person\/e57d707c58cf7aa3231eb5fdcc2ec379","name":"Lucas Kotres","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kb.elipse.com.br\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/faa3c53fb2e8ab0c35c4b8c90a691931?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/faa3c53fb2e8ab0c35c4b8c90a691931?s=96&d=mm&r=g","caption":"Lucas Kotres"},"url":"https:\/\/kb.elipse.com.br\/en\/author\/kotres\/"}]}},"_links":{"self":[{"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/posts\/3687"}],"collection":[{"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/comments?post=3687"}],"version-history":[{"count":10,"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/posts\/3687\/revisions"}],"predecessor-version":[{"id":13700,"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/posts\/3687\/revisions\/13700"}],"wp:attachment":[{"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/media?parent=3687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/categories?post=3687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/tags?post=3687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}