Macro Texture Objects/fr: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
(Created page with "{{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 obj...")
Line 1: Line 1:
{{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}}
{{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}}


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.

Revision as of 17:53, 1 January 2014

File:Text-x-python 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.

Auteur: yorik
Auteur
yorik
Téléchargement
None
Liens
Version Macro
1.0
Dernière modification
None
Version(s) FreeCAD
None
Raccourci clavier
None
Voir aussi
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)