Macro Texture Objects: Difference between revisions
(Vertical {{Macro}}; fixed icon) |
(Fixed icon location for Addon Manager.) |
||
(11 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
<languages/> |
<languages/> |
||
<translate> |
<translate> |
||
<!--T:1--> |
<!--T:1--> |
||
{{Macro |
{{Macro |
||
|Name=Texture Objects |
|Name=Texture Objects |
||
|Icon=Macro_Texture_Objects.png |
|||
|Description=This macro allows you to temporarily put a texture image on selected objects. To remove the textures, simply close and reopen the document. |
|Description=This macro allows you to temporarily put a texture image on selected objects. To remove the textures, simply close and reopen the document. |
||
|Author=yorik |
|Author=yorik |
||
|Version=1.1 |
|||
|Date= |
|Date=2023-12-08 |
||
|Download=[https://wiki.freecad.org/images/d/da/Macro_Texture_Objects.png ToolBar Icon] |
|||
|FCVersion= 0.18 and below |
|||
}} |
}} |
||
==Description== <!--T: |
==Description== <!--T:8--> |
||
⚫ | |||
This macro allows you to temporarily put a texture image on selected objects. To remove the textures, simply close and reopen the document. |
This macro allows you to temporarily put a texture image on selected objects. To remove the textures, simply close and reopen the document. |
||
⚫ | |||
⚫ | |||
</translate> |
</translate> |
||
⚫ | |||
{{clear}} |
|||
<translate> |
<translate> |
||
==Script== <!--T:4--> |
==Script== <!--T:4--> |
||
</translate> |
</translate> |
||
Line 24: | Line 28: | ||
'''Macro_Texture_Objects.FCMacro''' |
'''Macro_Texture_Objects.FCMacro''' |
||
{{ |
{{MacroCode|code= |
||
import FreeCADGui |
import FreeCADGui |
||
Line 31: | Line 35: | ||
# get a jpg filename |
# get a jpg filename |
||
jpgfilename = QtGui.QFileDialog.getOpenFileName(QtGui. |
jpgfilename = QtGui.QFileDialog.getOpenFileName(QtGui.QApplication.activeWindow(),'Open image file','*.jpg') |
||
# apply textures |
# apply textures |
||
Line 41: | Line 45: | ||
}} |
}} |
||
<translate> |
|||
{{clear}} |
|||
==Links== <!--T:5--> |
|||
<!--T:6--> |
|||
* Forum thread [https://forum.freecadweb.org/viewtopic.php?t=7216 Macro Texture Objects] |
|||
<!--T:7--> |
|||
* Forum thread [https://forum.freecadweb.org/viewtopic.php?f=3&t=28795 Script to map texture with environement checked] |
|||
</translate> |
Latest revision as of 22:25, 28 December 2023
Description |
---|
This macro allows you to temporarily put a texture image on selected objects. To remove the textures, simply close and reopen the document. Macro version: 1.1 Last modified: 2023-12-08 FreeCAD version: 0.18 and below Download: ToolBar Icon Author: yorik |
Author |
yorik |
Download |
ToolBar Icon |
Links |
Macros recipes How to install macros How to customize toolbars |
Macro Version |
1.1 |
Date last modified |
2023-12-08 |
FreeCAD Version(s) |
0.18 and below |
Default shortcut |
None |
See also |
None |
Description
This macro allows you to temporarily put a texture image on selected objects. To remove the textures, simply close and reopen the document.
Script
Macro_Texture_Objects.FCMacro
import FreeCADGui from PySide import QtGui from pivy import coin # get a jpg filename jpgfilename = QtGui.QFileDialog.getOpenFileName(QtGui.QApplication.activeWindow(),'Open image file','*.jpg') # apply textures for obj in FreeCADGui.Selection.getSelection(): rootnode = obj.ViewObject.RootNode tex = coin.SoTexture2() tex.filename = str(jpgfilename[0]) rootnode.insertChild(tex,1)
Links
- Forum thread Macro Texture Objects
- Forum thread Script to map texture with environement checked