Macro Texture Objects

From FreeCAD Documentation
Revision as of 10:48, 25 September 2016 by FuzzyBot (talk | contribs) (Updating to match new version of source page)

File:Text-x-python Texture Objects

описание
Этот макрос позволяет временно поместить текстуру на выбранный объект. Для удаления текстуры, просто закройте и вновь откройте документ.

автор : yorik
автор
yorik
Скачать
None
Links
Версия
1.0
Дата последней модификации
None
Версии FreeCAD
None
Ярлык по умолчанию
None
Смотрите также
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[0])
    rootnode.insertChild(tex,1)
Other languages: