Macro Texture Objects/fr: Difference between revisions

From FreeCAD Documentation
m (remplacement des balise <pre> par <syntaxhighlight>)
(Updating to match new version of source page)
Line 1: Line 1:
{{Macro/fr|Icon=Text-x-python|Name=Texture Objects|Name/fr=Texture Objects|Description=Cette macro permet de mettre temporairement une image qui servira de texture sur les objets sélectionnés. Pour supprimer les textures, Fermez simplement le document et rouvrez le.|Author=yorik}}
{{Macro|Icon=Text-x-python|Name=Texture Objects|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}}


This macro allows you to temporarily put a texture image on selected objects. To remove the textures, simply close and reopen the document.
[[Image:Textured_objects.jpg|640px]]


[[Image:Textured_objects.jpg|680px]]

{{clear}}
<syntaxhighlight>
<syntaxhighlight>

import FreeCADGui
import FreeCADGui
from PyQt4 import QtGui
from PyQt4 import QtGui
Line 17: Line 21:
tex.filename = str(jpgfilename)
tex.filename = str(jpgfilename)
rootnode.insertChild(tex,1)
rootnode.insertChild(tex,1)
</syntaxhighlight>


</syntaxhighlight>
{{languages/fr | {{en|Macro_Texture_Objects}} {{es|Macro_Texture_Objects/es}} {{it|Macro_Texture_Objects/it}} }}
{{clear}}
<languages/>

Revision as of 17:33, 25 December 2013

File:Text-x-python Texture Objects

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
Download
None
Links
Macro Version
1.0
Date last modified
None
FreeCAD Version(s)
None
Default shortcut
None
See also
None

This macro allows you to temporarily put a texture image on selected objects. To remove the textures, simply close and reopen the document.

 import FreeCADGui
 from PyQt4 import QtGui
 from pivy import coin
 
 # get a jpg filename
 jpgfilename = QtGui.QFileDialog.getOpenFileName(QtGui.qApp.activeWindow(),'Open image file','*.jpg')
 
 # apply textures
 for obj in FreeCADGui.Selection.getSelection():
     rootnode = obj.ViewObject.RootNode
     tex =  coin.SoTexture2()
     tex.filename = str(jpgfilename)
     rootnode.insertChild(tex,1)