FreeCAD-Doc/localwiki/Macro_CloneConvert.html
2018-07-08 12:11:49 -05:00

143 lines
12 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html><head><title>Macro CloneConvert</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link type='text/css' href='wiki.css' rel='stylesheet'></head><body><h1>Macro CloneConvert</h1></div>
<div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr"><div class="mw-parser-output"><table class="fcinfobox wikitable ct" width="100%" style="float: right; width: 230px; margin-left: 10px;">
<tr>
<td class="ctTitle">
<h3><span class="mw-headline" id="Macro_CloneConvert"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_CloneConvert.png" class="image"><img alt="Macro CloneConvert.png" src="32px-Macro_CloneConvert.png" width="32" height="32" srcset="/wiki/images/thumb/0/0a/Macro_CloneConvert.png/48px-Macro_CloneConvert.png 1.5x, Macro_CloneConvert.png 2x" /></a> Macro CloneConvert</span></h3>
</td></tr>
<tr>
<th class="ctOdd">Description
</th></tr>
<tr>
<td class="ctEven left macro-description">Creates a clone of the object and the converted in the chosen position and size (inch, mm, m, µm...).
</td></tr>
<tr>
<th class="ctOdd">Author
</th></tr>
<tr>
<td class="ctEven macro-author"><a href="https://www.freecadweb.org/wiki/index.php?title=User:Mario52" title="User:Mario52">mario52</a>
</td></tr>
<tr>
<th class="ctOdd">Links
</th></tr>
<tr>
<td class="ctEven"><a href="Macros_recipes.html" title="Macros recipes">Macros recipes</a><br /><a href="How_to_install_macros.html" title="How to install macros">How to install macros</a><br /><a href="Customize_Toolbars.html" title="Customize Toolbars">How to customize toolbars</a>
</td></tr>
<tr>
<th class="ctOdd">Version
</th></tr>
<tr>
<td class="ctEven macro-version">0.11
</td></tr>
<tr>
<th class="ctOdd">Date last modification
</th></tr>
<tr>
<td class="ctEven macro-date">2018-03-30
</td></tr>
<tr>
<th class="ctOdd">
</th></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="#Macro_CloneConvert"><span class="tocnumber">1</span> <span class="toctext">Macro CloneConvert</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="#Uses"><span class="tocnumber">3</span> <span class="toctext">Uses</span></a></li>
<li class="toclevel-1 tocsection-3"><a href="#Script"><span class="tocnumber">4</span> <span class="toctext">Script</span></a></li>
<li class="toclevel-1 tocsection-4"><a href="#Revision"><span class="tocnumber">5</span> <span class="toctext">Revision</span></a></li>
</ul>
</div>
</td></tr>
</table>
<p><br />
</p>
<h2><span class="mw-headline" id="Description">Description</span></h2>
<p>Creates a clone or copy of the object and the converted in the chosen position and size (inch, mm, m, µm...) or free. The base object is recognized in mm (FreeCAd base)
</p>
<h2><span class="mw-headline" id="Uses">Uses</span></h2>
<p>Run the macro, the XYZ settings, choose "Clone" or "Copy" a unit or one value of choice select your object, and click <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Ok</span> button.
</p><p>If no value is entered a copy or clone will be created without modification. If no object is selected the <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Ok</span> button will be colored in red.
</p><p>The value of the <b>BoundingBox</b>, <b>Volume</b> and <b>Surface</b> is diplayed in the Report view, in the case of <b>Copy</b> multiple object, the display will show BoundingBox 0.0.
</p><p><br />
The base is the mm example with a <b>1 mm</b> cube of side&#160;:
</p><p>Select in the comboBox <b>inch</b>, <b>1 inch = 25.4 mm</b> , the fields <b>"Scale free"</b> automatically adjusts to 25.4 (the values in <b>"Scale-free"</b> can be changed separately). Click <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Ok</span> button, the clone created will have <b>25,4 mm x 25,4 mm x 25,4 mm</b>
</p><p><b>150%</b> = <b>1,50</b> in the <b>"Scale free"</b> fields <br />
<b>104%</b> = <b>1,04</b> in the <b>"Scale free"</b> fields
</p><p>Inverse operation&#160;:
</p><p>If you want to reduce an object ex: a cube 25.4 mm (1 inch) in cube 1 mm sides, use the following formula, <b>1 / 25.4 = 0.0393700</b> and enter the value <b>0,0393700</b> (with comma) in the Scale field XY and Z.
</p><p>In a cube of 5 mm, made <b>5 / 25.4 = 0.1968503</b> and enter the value <b>0,1968503</b> (with comma) in the Scale field XY and Z.
</p><p><b>50%</b> = <b>0,50</b> in the <b>"Scale free"</b> fields<br />
<b> 4%</b> = <b>0,04</b> in the <b>"Scale free"</b> fields
<br />
</p><p>Predefined units are&#160;:
km, hm, dam, m, dm, cm, <b>mm</b>, µm, nm, inch, link, foot, yard, perch, chain, furlong, mile, league, nautique.
<br /><br />
</p>
<div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_CloneConvert_01.png" class="image" title="CloneConvert"><img alt="CloneConvert" src="220px-Macro_CloneConvert_01.png" width="220" height="546" srcset="/wiki/images/c/cd/Macro_CloneConvert_01.png 1.5x" /></a></div>
<ul><li> <b>Mode</b></li>
<li> <b>Clone &#160;:</b> The object(s) clone are create </li>
<li> <b>Copy &#160;:</b> One copy of the objet(s) is create</li>
<li> <b>Comp &#160;:</b> One compound of the objet(s) is create</li>
<li> <b>Increm.&#160;:</b> incrementing the coordinates data to the original coordinates of the object (Placement, Rotation ...)<br />If this is not checked the Placement begin in coordinates 0,0,0 of FreeCAD<br />In case a compound Placement information is [0,0,0] the Placement begin in the position of object<br />If the real location is away from the base coordinates 0,0,0 use the <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">ValueAt()</span> button for the real Placement of the subObject selected Face, Wire, Line ....</li>
<li> <b>Unique &#160;:</b> If this checkBox is checked and multiple object selected, the clone created is one unique object</li></ul>
<ul><li> <b>Coordinates</b></li>
<li> <b><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">...</span>&#160;:</b> This button align the YZ values on the value of X to have the same values XYZ (or manually). Two click reset the coordinates values to 0.0 </li>
<li> <b>Coordinate X&#160;:</b> Move the copy to the Coordinate X selected (Base 0,0,0 if Increm. is not checked)</li>
<li> <b>Coordinate Y&#160;:</b> Move the copy to the Coordinate Y selected (Base 0,0,0 if Increm. is not checked)</li>
<li> <b>Coordinate Z&#160;:</b> Move the copy to the Coordinate Z selected (Base 0,0,0 if Increm. is not checked)</li></ul>
<ul><li> <b>Rotation</b></li>
<li> <b><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">...</span>&#160;:</b> This button align the Pitch and Roll values on the value of Yaw to have the same values Rotation (or manually)<br />Two click reset the rotations values to 0.0 </li>
<li> <b>Yaw (Z ) &#160;:</b> Rotate the copy to the axis Z (Yaw) (Begin 0 if Increm. is not checked)</li>
<li> <b>Pitch ( Y )&#160;:</b> Rotate the copy to the axis Y (Pitch) (Begin 0 if Increm. is not checked)</li>
<li> <b>Roll ( X ) &#160;:</b> Rotate the copy to the axis X (Roll) (Begin 0 if Increm. is not checked)</li></ul>
<ul><li> <b>Scale predefined</b></li>
<li> <b>Scale predefined&#160;:</b> predefined scales in units, km, hm, dam, m, dm, cm, <b>mm</b>, µm, nm, inch, link, foot, yard, perch, chain, furlong, mile, league, nautique or choose a free value in the Scale free field.</li></ul>
<ul><li> <b>Number copy </b></li>
<li> <b>Number copy&#160;:</b> number of copies</li></ul>
<ul><li> <b>Scale free</b></li>
<li> <b><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">...</span>&#160;:</b> This button align the Scales values on the value of Scale X to have the same values XYZ (or manually)<br />Two click reset the scales values to 1.0 </li>
<li> <b>Scale X&#160;:</b> free scale , if the value is negative <b>( -10)</b> , the object is scaled <b>x 10</b> and will be reversed in the X axis, to reduce the shape give a decimal value <b>(0,5)</b></li>
<li> <b>Scale Y&#160;:</b> free scale , if the value is negative <b>( -10)</b> , the object is scaled <b>x 10</b> and will be reversed in the Y axis, to reduce the shape give a decimal value <b>(0,5)</b></li>
<li> <b>Scale Z&#160;:</b> free scale , if the value is negative <b>( -10)</b> , the object is scaled <b>x 10</b> and will be reversed in the Z axis, to reduce the shape give a decimal value <b>(0,5)</b></li></ul>
<ul><li> <b><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">ValueAt()</span>&#160;:</b> Give the valueAt() the subObject selected Face, Wire, Line ...<br />This option is useful in case a compound Placement information [0,0,0] and its real location is away from the base coordinates 0,0,0 (gives no provide information about the rotation of the object)</li>
<li> <b><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Ok</span>&#160;:</b> the OK button validates and launches the command, if no object is selected the <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Ok</span> button will be coloured in red</li>
<li> <b><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Reset</span>&#160;:</b> the Reset button puts all the values to zero</li>
<li> <b><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Quit</span>&#160;:</b> the Quit button exit the macro</li></ul>
<div style="clear:both"></div>
<p><br />
</p>
<h2><span class="mw-headline" id="Script">Script</span></h2>
<p>The icon <a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_CloneConvert.png" class="image"><img alt="Macro CloneConvert.png" src="Macro_CloneConvert.png" width="64" height="64" /></a>
</p><p><b>Macro_CloneConvert.FCMacro</b>
</p><p>Download the macro to Gist <a rel="nofollow" class="external text" href="https://gist.github.com/mario52a/9f2f2f6144e1307a048f1840ef99300c">Macro_CloneConvert.FCMacro</a>
</p>
<h2><span class="mw-headline" id="Revision">Revision</span></h2>
<p>30/03/2018 ver 0.11 = odd checkBox, if multi selection the clone are object unique or object separate
</p><p>07/06/2017 ver 0.10 = replace Draft...Copy to Part..Shape cause section Copy&#160;: not draw copy scaled of object but copy not scaled&#160;??
</p><p>14/06/2016 ver 0.9 = adding the choice of number of copies and labels optimization
</p><p>31/01/2016 ver 0.8 = modify the buttons reset section for two click for reset (in case modification the value)
</p><p>30/01/2016 ver 0.7 = rewriting code with Placement and Increment and adding buttons Compound, Increment, ValueAt(),
</p><p>26/01/2016 ver 0.6 = correction placement with many objets Copy
</p><p>26/07/2015 ver 0.5 = correction rotate many objects Function Copy
</p><p>25/07/2015 ver 0.4 = adding rotation
</p><p>11/08/2014 replace "AttributeError" to "Exception"
</p><p>02/07/2014 ver. 0.3 = modified to operate PyQt4 and PySide
</p><p>09/05/2014 ver. 0.2 = adding function "Copy"
</p>
</div>
</div>
</div><div class="printfooter">
Online version: "<a dir="ltr" href="https://www.freecadweb.org/wiki/index.php?title=Macro_CloneConvert&amp;oldid=271161">http://www.freecadweb.org/wiki/index.php?title=Macro_CloneConvert&amp;oldid=271161</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>