Macro Texture Objects/pl: Difference between revisions

From FreeCAD Documentation
(Created page with "Makrodefinicja: Obiekty tekstury")
 
(Updating to match new version of source page)
Line 1: Line 1:
<languages/>
<languages/>

{{Macro
{{Macro
|Name=Texture Objects
|Name=Texture Objects
Line 12: Line 13:


==Description==
==Description==

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.


Line 40: Line 42:
==Links==
==Links==


[https://forum.freecadweb.org/viewtopic.php?t=7216 Macro Texture Objects]
* Forum thread [https://forum.freecadweb.org/viewtopic.php?t=7216 Macro Texture Objects]

[https://forum.freecadweb.org/viewtopic.php?f=3&t=28795 Script to map texture with environement checked]


* Forum thread [https://forum.freecadweb.org/viewtopic.php?f=3&t=28795 Script to map texture with environement checked]
{{clear}}

Revision as of 16:14, 3 July 2022

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.

Macro version: 1.0
Last modified: 2011-10-13
FreeCAD version: 0.18 and below
Download: Icon Toolbar
Author: yorik
Author
yorik
Download
Icon Toolbar
Links
Macro Version
1.0
Date last modified
2011-10-13
FreeCAD Version(s)
0.18 and below
Default shortcut
None
See also
None

Description

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

Script

Macro_Texture_Objects.FCMacro

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)

Links