FreeCAD-Doc/localwiki/How_to_install_macros-es.html
2018-07-19 18:47:02 -05:00

313 lines
35 KiB
HTML

<html><head><title>How to install macros/es</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link type='text/css' href='wiki.css' rel='stylesheet'></head><body><h1>How to install macros/es</h1></div>
<div id="mw-content-text" lang="es" dir="ltr" class="mw-content-ltr"><hr/><div class="mw-parser-output"><table class="fcinfobox wikitable ct" style="width: 230px; float: right; margin-left: 1em">
<tr>
<td class="ctTitle">
<h3><span class="mw-headline" id="Tutorial"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Base_ExampleCommandModel.png" class="image"><img alt="Base ExampleCommandModel.png" src="32px-Base_ExampleCommandModel.png" width="32" height="30" srcset="/wiki/images/thumb/9/93/Base_ExampleCommandModel.png/48px-Base_ExampleCommandModel.png 1.5x, /wiki/images/9/93/Base_ExampleCommandModel.png 2x" /></a> Tutorial</span></h3>
</td></tr>
<tr>
<th class="ctOdd">Tema
</th></tr>
<tr>
<td class="ctEven">Programming
</td></tr>
<tr>
<th class="ctOdd">Nivel
</th></tr>
<tr>
<td class="ctEven">Medium programmer
</td></tr>
<tr>
<th class="ctOdd">Tiempo para completar
</th></tr>
<tr>
<td class="ctEven">15 minutes
</td></tr>
<tr>
<th class="ctOdd">Autor
</th></tr>
<tr>
<td class="ctEven"><a href="https://www.freecadweb.org/wiki/index.php?title=User:Mario52" title="User:Mario52">Mario52</a>
</td></tr>
<tr>
<th class="ctOdd">Versión de FreeCAD
</th></tr>
<tr>
<td class="ctEven">All
</td></tr>
<tr>
<th class="ctOdd">Archivo(s) de ejemplo(s)
</th></tr>
<tr>
<td class="ctEven">None
</td></tr>
<tr>
<td class="ctToc"><br /><div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1"><a href="#Tutorial"><span class="tocnumber">1</span> <span class="toctext">Tutorial</span></a></li>
<li class="toclevel-1 tocsection-1"><a href="#Description"><span class="tocnumber">2</span> <span class="toctext">Description</span></a></li>
<li class="toclevel-1 tocsection-2"><a href="#Python"><span class="tocnumber">3</span> <span class="toctext">Python</span></a></li>
<li class="toclevel-1 tocsection-3"><a href="#The_Macro_Menu_and_Toolbar_Icons"><span class="tocnumber">4</span> <span class="toctext">The Macro Menu and Toolbar Icons</span></a></li>
<li class="toclevel-1 tocsection-4"><a href="#Location_and_destination_of_macros"><span class="tocnumber">5</span> <span class="toctext">Location and destination of macros</span></a></li>
<li class="toclevel-1 tocsection-5"><a href="#The_indentation_errors_examples_wrong_code"><span class="tocnumber">6</span> <span class="toctext">The indentation errors examples wrong code</span></a></li>
<li class="toclevel-1 tocsection-6"><a href="#Method_copy_the_code_in_one_window_and_paste_in_the_FreeCAD_editor"><span class="tocnumber">7</span> <span class="toctext">Method copy the code in one window and paste in the FreeCAD editor</span></a></li>
<li class="toclevel-1 tocsection-7"><a href="#Method_macro_in_a_compressed_.ZIP_file"><span class="tocnumber">8</span> <span class="toctext">Method macro in a compressed .ZIP file</span></a></li>
<li class="toclevel-1 tocsection-8"><a href="#For_those_who_see_no_information_is_displayed."><span class="tocnumber">9</span> <span class="toctext">For those who see no information is displayed.</span></a></li>
<li class="toclevel-1 tocsection-9"><a href="#Links"><span class="tocnumber">10</span> <span class="toctext">Links</span></a></li>
</ul>
</div>
</td></tr></table>
<p><br />
</p>
<h2><span class="mw-headline" id="Description">Description</span></h2>
<p>This short tutorial will show you how to install and use FreeCAD Macros.
</p><p>This tutorial was made on the Windows platform so a small adjustment may be necessary for other systems.
It was updated to cover the Macintosh platform.
</p>
<h2><span class="mw-headline" id="Python">Python</span></h2>
<p>Python is a programming language which is very simple to use and very fast to <a href="Introduction_to_Python.html" title="Introduction to Python">learn</a>.
</p><p>Python files have a file extension of <b>.py</b> while FreeCAD macros (which are also Python files) use the file extension <b>.FCMacro</b>. The Macro facility of FreeCAD can also execute files with the extension <b>.py</b>. Python was invented by <a rel="nofollow" class="external text" href="https://www.python.org/~guido/">Guido Van Rossun</a>
</p>
<h2><span class="mw-headline" id="The_Macro_Menu_and_Toolbar_Icons">The Macro Menu and Toolbar Icons</span></h2>
<p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro-record.svg" class="image" title="record"><img alt="record" src="Macro-record.svg" width="32" height="32" /></a> <a href="Std_DlgMacroRecord.html" title="Std DlgMacroRecord">Launch Record</a>
<a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro-stop.svg" class="image" title="stop"><img alt="stop" src="Macro-stop.svg" width="32" height="32" /></a> <a href="Std_DebugStop.html" title="Std DebugStop">Stop Record</a>
<a href="https://www.freecadweb.org/wiki/index.php?title=File:Std_DlgMacroExecuteDirect.svg" class="image" title="open editor"><img alt="open editor" src="Std_DlgMacroExecuteDirect.svg" width="32" height="32" /></a> <a href="Std_DlgMacroExecuteDirect.html" title="Std DlgMacroExecuteDirect">Open Menu macro</a>
<a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro-execute.svg" class="image" title="execute"><img alt="execute" src="Macro-execute.svg" width="32" height="32" /></a> <a href="Std_DlgMacroExecute.html" title="Std DlgMacroExecute">Execute</a>
<a href="https://www.freecadweb.org/wiki/index.php?title=File:Debug-start.svg" class="image" title="start"><img alt="start" src="Debug-start.svg" width="32" height="32" /></a> <a href="Std_DebugMacro.html" title="Std DebugMacro">Debug Macro</a>
<a href="https://www.freecadweb.org/wiki/index.php?title=File:Debug-stop.svg" class="image" title="stop"><img alt="stop" src="Debug-stop.svg" width="32" height="32" /></a> <a href="Std_DlgMacroStop.html" title="Std DlgMacroStop">Stop</a>
</p>
<h2><span class="mw-headline" id="Location_and_destination_of_macros">Location and destination of macros</span></h2>
<p>This section shows you how to locate the folder containing your FreeCAD macros.
</p><p><b>1&#160;:</b> click <b>Menu &gt; Macro &gt; Macros</b> (which has the icon <a href="https://www.freecadweb.org/wiki/index.php?title=File:Std_DlgMacroExecuteDirect.svg" class="image"><img alt="Std DlgMacroExecuteDirect.svg" src="Std_DlgMacroExecuteDirect.svg" width="24" height="24" /></a> and the tool tip "Open a dialog to let you execute a recorded macro")
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Dxf_Importer_Install_01.png" class="image"><img alt="Dxf Importer Install 01.png" src="640px-Dxf_Importer_Install_01.png" width="640" height="443" srcset="/wiki/images/5/56/Dxf_Importer_Install_01.png 1.5x" /></a></div></div>
<p><b>2&#160;:</b> This will open a dialog box
</p><p><b>3&#160;:</b> The address of "Macro destination" (<b>C:\Users\your_user_name\AppData\Roaming\FreeCAD\</b> in the screen snapshot below)
</p>
<ul><li> Windows: the form is usually <b>drive:\Users\your_user_name\AppData\Roaming\FreeCAD\</b></li>
<li> Ubuntu: the form is usually <b>/home/your_user_name/.FreeCAD</b> </li>
<li> Macintosh: the form is usually "/Users/your_user_name/Library/Preferences/FreeCAD"</li></ul>
<p><b>4&#160;:</b> copy the address of "Macro destination" (here <b>C:\Users\your_user_name\AppData\Roaming\FreeCAD\</b>)
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Dxf_Importer_Install_02.png" class="image"><img alt="Dxf Importer Install 02.png" src="640px-Dxf_Importer_Install_02.png" width="640" height="443" srcset="/wiki/images/c/c2/Dxf_Importer_Install_02.png 1.5x" /></a></div></div>
<p><b>5&#160;:</b> View the macro folder by:
</p>
<ul><li> Windows: paste the address into your File explorer and confirm</li>
<li> Macintosh: locate the folder in the Finder or paste the address into a File explorer (remember the "file:///" prefix in the File explorer for a file on disk)</li></ul>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Dxf_Importer_Install_03.png" class="image"><img alt="Dxf Importer Install 03.png" src="640px-Dxf_Importer_Install_03.png" width="640" height="382" srcset="/wiki/images/4/49/Dxf_Importer_Install_03.png 1.5x" /></a></div></div>
<p><b>6&#160;:</b> Access the files by:
</p>
<ul><li>Windows: leave open the file explorer</li>
<li>Macintosh: either leave a Finder window open, or bookmark the location in your File explorer, or set up an Alias to point to it, or drag the folder into the SideBar of the Finder so it is there to use from other programs such as text editors etc. (Note: version 0.14 of FreeCAD does not support Aliases but does support the SideBar)</li></ul>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Dxf_Importer_Install_04.png" class="image"><img alt="Dxf Importer Install 04.png" src="640px-Dxf_Importer_Install_04.png" width="640" height="383" srcset="/wiki/images/2/2f/Dxf_Importer_Install_04.png 1.5x" /></a></div></div>
<div style="clear:both"></div>
<p><br />
</p><p><b>Section to read if you are not familiar with Python programming (common mistakes copy/paste).</b>
</p>
<div class="toccolours mw-collapsible mw-collapsed">
<h2><span class="mw-headline" id="The_indentation_errors_examples_wrong_code">The indentation errors examples wrong code</span></h2>
<div class="mw-collapsible-content">
<p>The indentation in the python programming is very important and integral part of the code, a space or an inappropriate shift causes an indentation error ex&#160;:
</p><p><span style="color:red">
<b>&lt;unknown exception traceback&gt;&lt;type 'exceptions.IndentationError'&gt;: ('expected an indented block', ('C:/Users/d/AppData/Roaming/FreeCAD/Macro_Apothem_Based_Prism_GUI.FCMacro', 21, 3, 'def priSm(self):\n'))</b>
</span>
</p><p>gives the error returned 'expected an indented block' block indentation expected to line <b>21, 3,</b> normal after a <b>class p ():</b> must be the next line an indentation at least one space.
</p><p><b>1&#160;:</b> In this example, the code was stuck without any indentation and of course does not work! here definitely a programmer error when pasting the code on the page as it would have never known it to work.
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_09.png" class="image" title="the code was stuck without any indentation"><img alt="the code was stuck without any indentation" src="Macro_Install_HowTo_09.png" width="640" height="478" /></a></div></div>
<p><b>2&#160;:</b> the code was correct indentations in the right place.
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_10.png" class="image" title="the code was correct indentations in the right place"><img alt="the code was correct indentations in the right place" src="Macro_Install_HowTo_10.png" width="640" height="426" /></a></div></div>
<p><b>3&#160;:</b> we select the code, and we see that the selection is at the edge of the code, the macro must works so good
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_11.png" class="image" title="the macro must works so good"><img alt="the macro must works so good" src="Macro_Install_HowTo_11.png" width="640" height="426" /></a></div></div>
<p><b>4&#160;:</b> Here additional space is selected (it can happen) then you need to copy the code into a word processor to remove <b>one space all lines</b>
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_12.png" class="image" title="remove one space all lines"><img alt="remove one space all lines" src="Macro_Install_HowTo_12.png" width="640" height="145" /></a></div></div>
<p><b>5&#160;:</b> Here the code has been copied in a forum window with the <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Select all</span> button apparently the selection is good
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_14.png" class="image" title="Here the code has been copied in a forum"><img alt="Here the code has been copied in a forum" src="640px-Macro_Install_HowTo_14.png" width="640" height="206" srcset="/wiki/images/thumb/e/eb/Macro_Install_HowTo_14.png/960px-Macro_Install_HowTo_14.png 1.5x, /wiki/images/e/eb/Macro_Install_HowTo_14.png 2x" /></a></div></div>
<p><b>6&#160;:</b> But the selection pasted into the FreeCAD editor gives a surprise, an indent of four spaces has been added by the system&#160;? the code is not good
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_15.png" class="image" title="But the selection pasted into the FreeCAD editor gives a surprise"><img alt="But the selection pasted into the FreeCAD editor gives a surprise" src="640px-Macro_Install_HowTo_15.png" width="640" height="173" srcset="/wiki/images/d/d3/Macro_Install_HowTo_15.png 1.5x" /></a></div></div>
<p><b>7&#160;:</b> You must delete all the extra space that is four spaces on each line, for Windows word processing <a rel="nofollow" class="external text" href="http://notepad-plus-plus.org/">notepad-plus-plus</a> enables vertical selection with a combination of buttons <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Alt</span> + Mouse dragging or Menu&gt; Edit&gt; Indent&gt; Decrease the indentation
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_16.png" class="image" title="You must delete all the extra space"><img alt="You must delete all the extra space" src="640px-Macro_Install_HowTo_16.png" width="640" height="173" srcset="/wiki/images/c/c3/Macro_Install_HowTo_16.png 1.5x" /></a></div></div>
<p><b>8&#160;:</b> Here the selection also take the column numbers which will also give an error
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_29.png" class="image" title="Here the selection also take the column numbers"><img alt="Here the selection also take the column numbers" src="640px-Macro_Install_HowTo_29.png" width="640" height="220" srcset="/wiki/images/thumb/8/8b/Macro_Install_HowTo_29.png/960px-Macro_Install_HowTo_29.png 1.5x, /wiki/images/8/8b/Macro_Install_HowTo_29.png 2x" /></a></div></div>
<p><b>9&#160;:</b> Perfect code.
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_13.png" class="image" title="Perfect code"><img alt="Perfect code" src="Macro_Install_HowTo_13.png" width="640" height="514" /></a></div></div>
<p><br />
</p>
</div>
</div>
<p><b>Method 1:</b>
</p>
<div class="toccolours mw-collapsible mw-collapsed">
<h2><span class="mw-headline" id="Method_copy_the_code_in_one_window_and_paste_in_the_FreeCAD_editor">Method copy the code in one window and paste in the FreeCAD editor</span></h2>
<div class="mw-collapsible-content">
<p>For example we will copy the macro <a href="https://www.freecadweb.org/wiki/index.php?title=File:Part_Prism_Apothem.svg" class="image"><img alt="Part Prism Apothem.svg" src="Part_Prism_Apothem.svg" width="16" height="16" /></a> <a href="Macro_Apothem_Based_Prism_GUI.html" title="Macro Apothem Based Prism GUI">Macro_Apothem_Based_Prism_GUI</a>
</p><p>If there are one or more icon (s) download also position your mouse over the icon, click the right mouse button and click "Save image as ..." the icon or icons are placed in the macro directory and one of these icons serve as a shortcut icon to place on the <a href="Customize_Toolbars.html" title="Customize Toolbars">toolbar.</a>
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_28.png" class="image" title="Download icon"><img alt="Download icon" src="300px-Macro_Install_HowTo_28.png" width="300" height="329" srcset="/wiki/images/thumb/6/60/Macro_Install_HowTo_28.png/450px-Macro_Install_HowTo_28.png 1.5x, /wiki/images/6/60/Macro_Install_HowTo_28.png 2x" /></a></div></div>
<p>After copying your code we will paste the code in FreeCAD editor.
</p><p><b>1&#160;:</b> Open FreeCAD and open the editor in FreeCAD
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Dxf_Importer_Install_01.png" class="image"><img alt="Dxf Importer Install 01.png" src="640px-Dxf_Importer_Install_01.png" width="640" height="443" srcset="/wiki/images/5/56/Dxf_Importer_Install_01.png 1.5x" /></a></div></div>
<p><b>2&#160;:</b> The window macros file opens, click <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Create</span> button
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_17.png" class="image" title="The window macros file opens"><img alt="The window macros file opens" src="300px-Macro_Install_HowTo_17.png" width="300" height="322" srcset="/wiki/images/c/c0/Macro_Install_HowTo_17.png 1.5x" /></a></div></div>
<p><b>3&#160;:</b> A new window opens, enter the macro name (here "<b>Macro_Apothem_Based_Prism_GUI</b>")and click the create <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Ok</span> button
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_18.png" class="image" title="enter the macro name"><img alt="enter the macro name" src="300px-Macro_Install_HowTo_18.png" width="300" height="322" srcset="/wiki/images/9/9b/Macro_Install_HowTo_18.png 1.5x" /></a></div></div>
<p><b>4&#160;:</b> The editing window FreeCAD macros is now available and has the name of our future macro.
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_19.png" class="image" title="The editing window FreeCAD macros"><img alt="The editing window FreeCAD macros" src="640px-Macro_Install_HowTo_19.png" width="640" height="494" srcset="/wiki/images/thumb/6/62/Macro_Install_HowTo_19.png/960px-Macro_Install_HowTo_19.png 1.5x, /wiki/images/6/62/Macro_Install_HowTo_19.png 2x" /></a></div></div>
<p><b>5&#160;:</b> Paste your code in the macro editor window and click the little <b>cross</b> to close the window.
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_20.png" class="image" title="close the window"><img alt="close the window" src="640px-Macro_Install_HowTo_20.png" width="640" height="494" srcset="/wiki/images/thumb/9/9c/Macro_Install_HowTo_20.png/960px-Macro_Install_HowTo_20.png 1.5x, /wiki/images/9/9c/Macro_Install_HowTo_20.png 2x" /></a></div></div>
<p><b>6&#160;:</b> A warning window appears asking for confirmation of save code, click on <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Yes</span>
</p><p><b>PS:</b> For the change silk consideration must save the macro and reopen it and just run it.
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_27.png" class="image" title="A warning window appears asking for confirmation of save code"><img alt="A warning window appears asking for confirmation of save code" src="300px-Macro_Install_HowTo_27.png" width="300" height="144" srcset="/wiki/images/7/7f/Macro_Install_HowTo_27.png 1.5x" /></a></div></div>
<p><b>7&#160;:</b> Repeat the number <b>1&#160;:</b> , Click on your new macro and button <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Execute</span>
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_21.png" class="image" title="Click on your new macro and button Execute"><img alt="Click on your new macro and button Execute" src="300px-Macro_Install_HowTo_21.png" width="300" height="323" srcset="/wiki/images/b/b9/Macro_Install_HowTo_21.png 1.5x" /></a></div></div>
<p><b>8&#160;:</b> The macro runs, complete the fields with your values and click the <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">OK</span> button
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_22.png" class="image" title="The macro runs, complete the fields"><img alt="The macro runs, complete the fields" src="640px-Macro_Install_HowTo_22.png" width="640" height="494" srcset="/wiki/images/thumb/4/45/Macro_Install_HowTo_22.png/960px-Macro_Install_HowTo_22.png 1.5x, /wiki/images/4/45/Macro_Install_HowTo_22.png 2x" /></a></div></div>
<p>9&#160;: The macro returns an error&#160;! we do not have to open document, open a document <a href="https://www.freecadweb.org/wiki/index.php?title=File:Document-new.svg" class="image"><img alt="Document-new.svg" src="Document-new.svg" width="24" height="24" /></a> and repeat the operation <b>7</b> and <b>8</b>. Some macros open a new document if it does not find one.
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_23.png" class="image" title="The macro returns an error!"><img alt="The macro returns an error!" src="640px-Macro_Install_HowTo_23.png" width="640" height="494" srcset="/wiki/images/thumb/0/0d/Macro_Install_HowTo_23.png/960px-Macro_Install_HowTo_23.png 1.5x, /wiki/images/0/0d/Macro_Install_HowTo_23.png 2x" /></a></div></div>
<p>10&#160;: Here is your prism
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_24.png" class="image" title="your prism"><img alt="your prism" src="640px-Macro_Install_HowTo_24.png" width="640" height="494" srcset="/wiki/images/thumb/2/24/Macro_Install_HowTo_24.png/960px-Macro_Install_HowTo_24.png 1.5x, /wiki/images/2/24/Macro_Install_HowTo_24.png 2x" /></a></div></div>
<p>11&#160;: You can also open your macro in the editor to run or modify, click the <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Edit</span> button
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_25.png" class="image" title="You can also open your macro in the editor"><img alt="You can also open your macro in the editor" src="300px-Macro_Install_HowTo_25.png" width="300" height="323" srcset="/wiki/images/5/52/Macro_Install_HowTo_25.png 1.5x" /></a></div></div>
<p>12: The macro is now in the FreeCAD editor you can run through the menu "Macro Run Macro" or by clicking on the triangle <a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro-execute.svg" class="image"><img alt="Macro-execute.svg" src="Macro-execute.svg" width="16" height="16" /></a> green in the macros toolsbar
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_26.png" class="image" title="The macro is now in the FreeCAD editor"><img alt="The macro is now in the FreeCAD editor" src="640px-Macro_Install_HowTo_26.png" width="640" height="218" srcset="/wiki/images/thumb/6/64/Macro_Install_HowTo_26.png/960px-Macro_Install_HowTo_26.png 1.5x, /wiki/images/6/64/Macro_Install_HowTo_26.png 2x" /></a></div></div>
</div>
</div>
<p><b>Method 2:</b>
</p>
<div class="toccolours mw-collapsible mw-collapsed">
<h2><span class="mw-headline" id="Method_macro_in_a_compressed_.ZIP_file">Method macro in a compressed .ZIP file</span></h2>
<div class="mw-collapsible-content">
<p>Download the file compressed here (example) <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/viewtopic.php?f=22&amp;t=6558#p52887">Macro_screw_maker 1.7</a>. (the page <a href="Macro_screw_maker1_2.html" title="Macro screw maker1 2">Macro_screw_maker</a>)
</p><p>Free for Windows <a rel="nofollow" class="external text" href="http://www.7-zip.org/">7-zip</a> ou <a rel="nofollow" class="external text" href="http://www.kanmandet.dk/?p=37">L-Zarc</a> ou <a rel="nofollow" class="external text" href="http://www.quickzip.org/quickzip51.html">quickzip</a>
</p><p>For Linux use this on the terminal
</p>
<pre>unzip your_file.zip -d your_directory </pre>
<p>you must unzip the zip and copy the file (or all the files and folders) in your macro directory.
</p><p><b>Process</b>
</p><p><b>1&#160;:</b> Download your file in your local folder here the folder <b>Temp</b>
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_01.png" class="image" title="Download your file in your local folder here the folder Temp"><img alt="Download your file in your local folder here the folder Temp" src="640px-Macro_Install_HowTo_01.png" width="640" height="492" srcset="/wiki/images/9/99/Macro_Install_HowTo_01.png 1.5x" /></a></div></div>
<p><b>2&#160;:</b> Unzip your file in the folder.
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_02.png" class="image" title="Unzip your file in the folder."><img alt="Unzip your file in the folder." src="640px-Macro_Install_HowTo_02.png" width="640" height="492" srcset="/wiki/images/5/55/Macro_Install_HowTo_02.png 1.5x" /></a></div></div>
<p><b>3&#160;:</b> The decompressor finished his work and created a new folder with the unpacked file
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_03.png" class="image" title="The decompressor finished his work and created a new folder with the unpacked file"><img alt="The decompressor finished his work and created a new folder with the unpacked file" src="640px-Macro_Install_HowTo_03.png" width="640" height="492" srcset="/wiki/images/4/45/Macro_Install_HowTo_03.png 1.5x" /></a></div></div>
<p><b>4&#160;:</b> Enter in the newly created directory, move about the file, click the right mouse button and click on <b>Cut</b>.
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_04.png" class="image" title="Enter in the newly created directory"><img alt="Enter in the newly created directory" src="640px-Macro_Install_HowTo_04.png" width="640" height="492" srcset="/wiki/images/d/d0/Macro_Install_HowTo_04.png 1.5x" /></a></div></div>
<p><b>5&#160;:</b> Return to your File explorer remained open in the macro location (here <b>C:\Users\your_user_name\AppData\Roaming\FreeCAD\</b>) and close the File explorer.
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_05.png" class="image" title="Return to your File explorer remained open"><img alt="Return to your File explorer remained open" src="640px-Macro_Install_HowTo_05.png" width="640" height="492" srcset="/wiki/images/c/ce/Macro_Install_HowTo_05.png 1.5x" /></a></div></div>
<p><b>6&#160;:</b> Open FreeCAD click <b>Menu &gt; Macro &gt; Macros</b> or the click the <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">bottom</span> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Std_DlgMacroExecuteDirect.svg" class="image"><img alt="Std DlgMacroExecuteDirect.svg" src="Std_DlgMacroExecuteDirect.svg" width="18" height="18" /></a> "Open a dialog to let you execute a macro Recorded"
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_06.png" class="image" title="Open FreeCAD"><img alt="Open FreeCAD" src="640px-Macro_Install_HowTo_06.png" width="640" height="518" srcset="/wiki/images/2/2d/Macro_Install_HowTo_06.png 1.5x" /></a></div></div>
<p><b>7&#160;:</b> The macros window open , select your macro and click the button <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Execute</span>
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_07.png" class="image" title="The macros window open"><img alt="The macros window open" src="640px-Macro_Install_HowTo_07.png" width="640" height="518" srcset="/wiki/images/7/75/Macro_Install_HowTo_07.png 1.5x" /></a></div></div>
<p><b>8&#160;:</b> Your macro is executed enter the data and click the <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Create</span> button
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_08.png" class="image" title="Your macro is executed"><img alt="Your macro is executed" src="640px-Macro_Install_HowTo_08.png" width="640" height="518" srcset="/wiki/images/2/2d/Macro_Install_HowTo_08.png 1.5x" /></a></div></div>
<p><b>9</b>&#160;: Whaouu
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_30.png" class="image" title="Whaouu"><img alt="Whaouu" src="640px-Macro_Install_HowTo_30.png" width="640" height="518" srcset="/wiki/images/2/27/Macro_Install_HowTo_30.png 1.5x" /></a></div></div>
</div>
</div>
<p><b>Section if the text are not display:</b>
</p>
<div class="toccolours mw-collapsible mw-collapsed">
<h2><span class="mw-headline" id="For_those_who_see_no_information_is_displayed.">For those who see no information is displayed.</span></h2>
<div class="mw-collapsible-content">
<p>Some macros display information on the screen in general they are displayed in the report view.
</p><p>FreeCAD use two methods to display the information in the window view report.
</p><p><b>1&#160;: Commands</b>
</p>
<pre>App = FreeCAD
App.Console.PrintMessage ("Hello World&#160;! \n")
App.Console.PrintError ("Hello World&#160;! \n")
App.Console.PrintWarning ("Hello World&#160;! \n") </pre>
<p>or
</p>
<pre>FreeCAD.Console.PrintMessage ("Hello World&#160;! \n")
FreeCAD.Console.PrintError ("Hello World&#160;! \n")
FreeCAD.Console.PrintWarning ("Hello World&#160;! \n") </pre>
<p>or
</p>
<pre>print "Hello World&#160;!" </pre>
<p>To see the information displayed in the console you should:
</p><p><b>1&#160;:</b> Open FreeCAD
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_31.png" class="image" title="Open FreeCAD"><img alt="Open FreeCAD" src="640px-Macro_Install_HowTo_31.png" width="640" height="485" srcset="/wiki/images/0/0d/Macro_Install_HowTo_31.png 1.5x" /></a></div></div>
<p><b>2&#160;:</b> Click the <b>View menu</b> and <b>Views</b>
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_32.png" class="image" title="Click the View menu and Views"><img alt="Click the View menu and Views" src="640px-Macro_Install_HowTo_32.png" width="640" height="570" srcset="/wiki/images/7/7f/Macro_Install_HowTo_32.png 1.5x" /></a></div></div>
<p><b>3&#160;:</b> Check <b>Report View</b> and <b>Python Console</b>
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_33.png" class="image" title="Check Report View and Python Console"><img alt="Check Report View and Python Console" src="640px-Macro_Install_HowTo_33.png" width="640" height="670" srcset="/wiki/images/e/e9/Macro_Install_HowTo_33.png 1.5x" /></a></div></div>
<p><b>4&#160;:</b> the windows are enabled and available commands like "<b>App.Console.PrintMessage</b>" is configured to the "Report View"
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_34.png" class="image" title="Hello World!"><img alt="Hello World!" src="640px-Macro_Install_HowTo_34.png" width="640" height="485" srcset="/wiki/images/b/b2/Macro_Install_HowTo_34.png 1.5x" /></a></div></div>
<p><br />
<b>2&#160;: command "print" which is a Python command.</b>
</p><p>It is possible that this command does not display the expected string.
</p><p>For information to be displayed in the window do this&#160;:
</p><p><b>1&#160;:</b> Click the <b>Edit menu</b> and then <b>Preferences</b>
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_35.png" class="image" title="Edit menu"><img alt="Edit menu" src="640px-Macro_Install_HowTo_35.png" width="640" height="484" srcset="/wiki/images/9/92/Macro_Install_HowTo_35.png 1.5x" /></a></div></div>
<p><b>2&#160;:</b> In the new window, click <b>General</b>, and select the <b>Output window</b> tab
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_36.png" class="image" title="General"><img alt="General" src="640px-Macro_Install_HowTo_36.png" width="640" height="532" srcset="/wiki/images/f/f7/Macro_Install_HowTo_36.png 1.5x" /></a></div></div>
<p><b>3&#160;:</b> check both boxes:
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Case_a_cocher_O.png" class="image"><img alt="Case a cocher O.png" src="16px-Case_a_cocher_O.png" width="16" height="16" srcset="/wiki/images/8/82/Case_a_cocher_O.png 1.5x" /></a> Redirect internal Python output to Report view
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Case_a_cocher_O.png" class="image"><img alt="Case a cocher O.png" src="16px-Case_a_cocher_O.png" width="16" height="16" srcset="/wiki/images/8/82/Case_a_cocher_O.png 1.5x" /></a> Redirect internal Python errors to Report view
</p><p>and click the <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">OK</span> button
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_37.png" class="image" title="Redirect internal"><img alt="Redirect internal" src="640px-Macro_Install_HowTo_37.png" width="640" height="532" srcset="/wiki/images/f/f7/Macro_Install_HowTo_37.png 1.5x" /></a></div></div>
<p><b>4&#160;:</b> the setup is complete you should see all.
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_Install_HowTo_38.png" class="image" title="the setup is complete"><img alt="the setup is complete" src="640px-Macro_Install_HowTo_38.png" width="640" height="485" srcset="/wiki/images/c/cb/Macro_Install_HowTo_38.png 1.5x" /></a></div></div>
</div>
</div>
<p>End tutorial good job.
</p>
<h2><span class="mw-headline" id="Links">Links</span></h2>
<p>The <a href="https://www.freecadweb.org/wiki/index.php?title=Macros_recipes/es" title="Macros recipes/es">Macros recipes</a> page
</p><p>Other easy macro installer <a rel="nofollow" class="external text" href="https://github.com/microelly2/freecad-pluginloader">freecad-pluginloader</a>
</p><p>The <a href="Macros_recipes.html" title="Macros recipes">Macros recipes</a> page
</p>
</div>
</div>
</div><div class="printfooter">
Online version: "<a dir="ltr" href="https://www.freecadweb.org/wiki/index.php?title=How_to_install_macros/es&amp;oldid=220539">http://www.freecadweb.org/wiki/index.php?title=How_to_install_macros/es&amp;oldid=220539</a>"</div>
<div id="catlinks" class="catlinks" data-mw="interface"></div><div class="visualClear"></div>
</div>
</div>
<div id="mw-navigation">
<h2>Navigation menu</h2>
</body></html>