Macro Texture Objects: Difference between revisions
Renatorivo (talk | contribs) (indentation) |
(modify "PyQt4 " to "PySide") |
||
Line 14: | Line 14: | ||
import FreeCADGui |
import FreeCADGui |
||
from |
from PySide import QtGui |
||
from pivy import coin |
from pivy import coin |
||
Revision as of 18:04, 12 June 2015
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 |
Macros recipes How to install macros How to customize toolbars |
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 PySide 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)