Macro Texture Objects

From FreeCAD Documentation
Revision as of 14:18, 29 September 2017 by Mario52 (talk | contribs)

File:Text-x-python Texture Objects

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

Макрос версии : 1.0
Дата последней модификации : 2011-10-13
автор : yorik
автор
yorik
Скачать
None
Links
Версия
1.0
Дата последней модификации
2011-10-13
Версии 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: