Macro CloneConvert: Difference between revisions
m (create link to Gist cause inappropriate indentation) |
(Marked this version for translation) |
||
(25 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
⚫ | |||
<translate> |
<translate> |
||
<!--T:1--> |
<!--T:1--> |
||
{{Macro |
|||
{{Macro|Icon=Macro_CloneConvert |Name=Macro CloneConvert|Description=Creates a clone of the object and the converted in the chosen position and size (inch, mm, m, µm...).|Author=mario52|Version=0.9 (14/06/2016)}} |
|||
|Name=Macro CloneConvert |
|||
|Icon=Macro_CloneConvert.png |
|||
|Description={{ColoredText|#ff0000|#ffffff|New version GUI modifyed for the HD dpi (QGridLayout) run only FC version 0.18 and more (PySide2 Qt5)}}<br/><br/> |
|||
For the precedent version see [https://gist.githubusercontent.com/mario52a/9f2f2f6144e1307a048f1840ef99300c/raw/0a141260ad8d5f67f0fc18b9b40ef37757c06c65/Macro_CloneConvert.FCMacro Macro_CloneConvert] and install it manually.<br/><br/> Creates a clone or Copy or Compound of the object(s) and the converted in the chosen position and size (inch, mm, m, µm...) or free. The base object is recognized in mm (FreeCAd base). |
|||
|Author=mario52 |
|||
|Version=0.15 |
|||
|Date=2020-06-06 |
|||
|FCVersion= 0.18 and more |
|||
|Download=[https://www.freecadweb.org/wiki/images/0/0a/Macro_CloneConvert.png ToolBar Icon] |
|||
}} |
|||
==Description== <!--T:2--> |
==Description== <!--T:2--> |
||
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) |
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) |
||
</translate> |
|||
{{Codeextralink|https://gist.githubusercontent.com/mario52a/9f2f2f6144e1307a048f1840ef99300c/raw/39bc54e90b80053a5af76b0b17694cb53697aebd/Macro_CloneConvert.FCMacro}} |
|||
<translate> |
|||
==Uses== <!--T:3--> |
==Uses== <!--T:3--> |
||
Line 46: | Line 61: | ||
<!--T:7--> |
<!--T:7--> |
||
[[File:Macro CloneConvert_01.png| |
[[File:Macro CloneConvert_01.png|350px|left|CloneConvert]] |
||
* '''Mode''' |
* '''Mode''' |
||
* '''Clone :''' |
* '''Clone :''' The object(s) clone are create |
||
* '''Copy :''' One copy of the objet(s) is create |
* '''Copy :''' One copy of the objet(s) is create |
||
* '''Comp :''' One compound of the objet(s) is create |
* '''Comp :''' One compound of the objet(s) is create |
||
* '''Increm. :''' 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 {{KEY|ValueAt()}} button for the real Placement of the subObject selected Face, Wire, Line .... |
* '''Increm. :''' 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 {{KEY|ValueAt()}} button for the real Placement of the subObject selected Face, Wire, Line .... |
||
* '''Unique :''' If this checkBox is checked and multiple object selected, the clone created is one unique object |
|||
<!--T:28--> |
<!--T:28--> |
||
Line 90: | Line 106: | ||
==Script== <!--T:8--> |
==Script== <!--T:8--> |
||
The |
The icon [[Image:Macro_CloneConvert.png]] |
||
<!--T:18--> |
<!--T:18--> |
||
'''Macro_CloneConvert.FCMacro''' |
'''Macro_CloneConvert.FCMacro''' |
||
<!--T:34--> |
|||
Download the macro to Gist [https://gist.github.com/mario52a/9f2f2f6144e1307a048f1840ef99300c Macro_CloneConvert.FCMacro] |
Download the macro to Gist [https://gist.github.com/mario52a/9f2f2f6144e1307a048f1840ef99300c Macro_CloneConvert.FCMacro] |
||
==Revision== <!--T:19--> |
==Revision== <!--T:19--> |
||
<!--T:41--> |
|||
06/06/2020 ver 0.15 = icon |
|||
<!--T:40--> |
|||
20/05/2020 ver 0.14 = grid layout PySide2 Qt5 |
|||
<!--T:39--> |
|||
15/09/2019 ver 0.13 = replace the grec sign micro to "um", replace all "_translate("MainWindow", "mm", None)" to "mm" and comment line "text.encode('utf-8')" cause not work with FC 0.19 18.213 |
|||
<!--T:38--> |
|||
01/06/2019 ver 0.12 = adapted for 0.19 et correction "Copy:legacy=True" and ShapeColor ..... |
|||
<!--T:37--> |
|||
30/03/2018 ver 0.11 = odd checkBox, if multi selection the clone are object unique or object separate |
|||
<!--T:35--> |
|||
07/06/2017 ver 0.10 = replace Draft...Copy to Part..Shape cause section Copy : not draw copy scaled of object but copy not scaled ?? |
|||
<!--T:36--> |
|||
14/06/2016 ver 0.9 = adding the choice of number of copies and labels optimization |
14/06/2016 ver 0.9 = adding the choice of number of copies and labels optimization |
||
Line 124: | Line 161: | ||
09/05/2014 ver. 0.2 = adding function "Copy" |
09/05/2014 ver. 0.2 = adding function "Copy" |
||
</translate> |
</translate> |
||
⚫ |
Revision as of 17:42, 6 June 2020
Description |
---|
New version GUI modifyed for the HD dpi (QGridLayout) run only FC version 0.18 and more (PySide2 Qt5) For the precedent version see Macro_CloneConvert and install it manually. |
Author |
mario52 |
Download |
ToolBar Icon |
Links |
Macros recipes How to install macros How to customize toolbars |
Macro Version |
0.15 |
Date last modified |
2020-06-06 |
FreeCAD Version(s) |
0.18 and more |
Default shortcut |
None |
See also |
None |
Description
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)
Temporary code for external macro link. Do not use this code. This code is used exclusively by Addon Manager. Link for optional manual installation: Macro
# This code is copied instead of the original macro code # to guide the user to the online download page. # Use it if the code of the macro is larger than 64 KB and cannot be included in the wiki # or if the RAW code URL is somewhere else in the wiki. from PySide import QtGui, QtCore diag = QtGui.QMessageBox(QtGui.QMessageBox.Information, "Information", "This macro must be downloaded from this link\n" "\n" "https://gist.githubusercontent.com/mario52a/9f2f2f6144e1307a048f1840ef99300c/raw/39bc54e90b80053a5af76b0b17694cb53697aebd/Macro_CloneConvert.FCMacro" + "\n" "\n" "Quit this window to access the download page") diag.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) diag.setWindowModality(QtCore.Qt.ApplicationModal) diag.exec_() import webbrowser webbrowser.open("https://gist.githubusercontent.com/mario52a/9f2f2f6144e1307a048f1840ef99300c/raw/39bc54e90b80053a5af76b0b17694cb53697aebd/Macro_CloneConvert.FCMacro")
Uses
Run the macro, the XYZ settings, choose "Clone" or "Copy" a unit or one value of choice select your object, and click Ok button.
If no value is entered a copy or clone will be created without modification. If no object is selected the Ok button will be colored in red.
The value of the BoundingBox, Volume and Surface is diplayed in the Report view, in the case of Copy multiple object, the display will show BoundingBox 0.0.
The base is the mm example with a 1 mm cube of side :
Select in the comboBox inch, 1 inch = 25.4 mm , the fields "Scale free" automatically adjusts to 25.4 (the values in "Scale-free" can be changed separately). Click Ok button, the clone created will have 25,4 mm x 25,4 mm x 25,4 mm
150% = 1,50 in the "Scale free" fields
104% = 1,04 in the "Scale free" fields
Inverse operation :
If you want to reduce an object ex: a cube 25.4 mm (1 inch) in cube 1 mm sides, use the following formula, 1 / 25.4 = 0.0393700 and enter the value 0,0393700 (with comma) in the Scale field XY and Z.
In a cube of 5 mm, made 5 / 25.4 = 0.1968503 and enter the value 0,1968503 (with comma) in the Scale field XY and Z.
50% = 0,50 in the "Scale free" fields
4% = 0,04 in the "Scale free" fields
Predefined units are :
km, hm, dam, m, dm, cm, mm, µm, nm, inch, link, foot, yard, perch, chain, furlong, mile, league, nautique.
- Mode
- Clone : The object(s) clone are create
- Copy : One copy of the objet(s) is create
- Comp : One compound of the objet(s) is create
- Increm. : incrementing the coordinates data to the original coordinates of the object (Placement, Rotation ...)
If this is not checked the Placement begin in coordinates 0,0,0 of FreeCAD
In case a compound Placement information is [0,0,0] the Placement begin in the position of object
If the real location is away from the base coordinates 0,0,0 use the ValueAt() button for the real Placement of the subObject selected Face, Wire, Line .... - Unique : If this checkBox is checked and multiple object selected, the clone created is one unique object
- Coordinates
- ... : 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
- Coordinate X : Move the copy to the Coordinate X selected (Base 0,0,0 if Increm. is not checked)
- Coordinate Y : Move the copy to the Coordinate Y selected (Base 0,0,0 if Increm. is not checked)
- Coordinate Z : Move the copy to the Coordinate Z selected (Base 0,0,0 if Increm. is not checked)
- Rotation
- ... : This button align the Pitch and Roll values on the value of Yaw to have the same values Rotation (or manually)
Two click reset the rotations values to 0.0 - Yaw (Z ) : Rotate the copy to the axis Z (Yaw) (Begin 0 if Increm. is not checked)
- Pitch ( Y ) : Rotate the copy to the axis Y (Pitch) (Begin 0 if Increm. is not checked)
- Roll ( X ) : Rotate the copy to the axis X (Roll) (Begin 0 if Increm. is not checked)
- Scale predefined
- Scale predefined : predefined scales in units, km, hm, dam, m, dm, cm, mm, µm, nm, inch, link, foot, yard, perch, chain, furlong, mile, league, nautique or choose a free value in the Scale free field.
- Number copy
- Number copy : number of copies
- Scale free
- ... : This button align the Scales values on the value of Scale X to have the same values XYZ (or manually)
Two click reset the scales values to 1.0 - Scale X : free scale , if the value is negative ( -10) , the object is scaled x 10 and will be reversed in the X axis, to reduce the shape give a decimal value (0,5)
- Scale Y : free scale , if the value is negative ( -10) , the object is scaled x 10 and will be reversed in the Y axis, to reduce the shape give a decimal value (0,5)
- Scale Z : free scale , if the value is negative ( -10) , the object is scaled x 10 and will be reversed in the Z axis, to reduce the shape give a decimal value (0,5)
- ValueAt() : Give the valueAt() the subObject selected Face, Wire, Line ...
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) - Ok : the OK button validates and launches the command, if no object is selected the Ok button will be coloured in red
- Reset : the Reset button puts all the values to zero
- Quit : the Quit button exit the macro
Script
Macro_CloneConvert.FCMacro
Download the macro to Gist Macro_CloneConvert.FCMacro
Revision
06/06/2020 ver 0.15 = icon
20/05/2020 ver 0.14 = grid layout PySide2 Qt5
15/09/2019 ver 0.13 = replace the grec sign micro to "um", replace all "_translate("MainWindow", "mm", None)" to "mm" and comment line "text.encode('utf-8')" cause not work with FC 0.19 18.213
01/06/2019 ver 0.12 = adapted for 0.19 et correction "Copy:legacy=True" and ShapeColor .....
30/03/2018 ver 0.11 = odd checkBox, if multi selection the clone are object unique or object separate
07/06/2017 ver 0.10 = replace Draft...Copy to Part..Shape cause section Copy : not draw copy scaled of object but copy not scaled ??
14/06/2016 ver 0.9 = adding the choice of number of copies and labels optimization
31/01/2016 ver 0.8 = modify the buttons reset section for two click for reset (in case modification the value)
30/01/2016 ver 0.7 = rewriting code with Placement and Increment and adding buttons Compound, Increment, ValueAt(),
26/01/2016 ver 0.6 = correction placement with many objets Copy
26/07/2015 ver 0.5 = correction rotate many objects Function Copy
25/07/2015 ver 0.4 = adding rotation
11/08/2014 replace "AttributeError" to "Exception"
02/07/2014 ver. 0.3 = modified to operate PyQt4 and PySide
09/05/2014 ver. 0.2 = adding function "Copy"