Macro Texture Objects
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Macro Texture Objects
At the moment not right out of the box, but it should become possible at some point in time. At the moment your only solution would be to program a custom python object that supports textures.
Re: Macro Texture Objects
Is really in FreeCAD core everything changed to mm, even if one uses unit system for meter or imperial units ?yorik wrote: Since all objects are internally in millimeters, it would be quite easy to maintain an accurate scale...
Re: Macro Texture Objects
Yesbernd wrote:Is really in FreeCAD core everything changed to mm, even if one uses unit system for meter or imperial units ?
Re: Macro Texture Objects
Thanks bringing this up - never know there had been discussion and macro available!bernd wrote: ↑Fri Aug 01, 2014 8:14 am Found the Macro Texture Objects and tested with imported material from ifc-file. I could'nt helpt to post the screens. I still need to clean and post the code for importing materials and properties.
Code: Select all
def textureMaterial(): """ Texturen nach Material setzen """ import FreeCADGui from PyQt4 import QtGui from pivy import coin print "Texturen" texturefilepath = '/home/hugo/Documents/projekte--ifc/freecad/BIM--IFC/Texturen--Vorlageproj/' material2texture = { 'noMaterial' : texturefilepath+'noMaterial.jpg', 'Beton' : texturefilepath+'beton_bewehrt.jpg', 'Backstein' : texturefilepath+'backstein.jpg', 'Kalksandstein' : texturefilepath+'kalksandstein.jpg', 'Baustahl' : texturefilepath+'stahl.jpg', 'Eindeckung' : texturefilepath+'dachziegel.jpg' } for o in FreeCAD.ActiveDocument.Objects: if '_FreeCAD_shape_body' not in o.Name: # es waere cooler ein eigenes PythonFeature if hasattr(o,'Shape'): o.ViewObject.Visibility = True if hasattr(o,'IfcObjectType') and hasattr(o,'IfcMaterial'): o.ViewObject.Transparency = 0 o.ViewObject.ShapeColor = (1.0,1.0,1.0) rootnode = o.ViewObject.RootNode tex = coin.SoTexture2() tex.filename = material2texture['noMaterial'] # weisse textur if o.IfcMaterial in material2texture: #print material2texture[o.IfcMaterial] tex.filename = material2texture[o.IfcMaterial] else: print (o.Name + ' --> ' + o.IfcObjectType + ' --> ' + o.IfcMaterial) rootnode.insertChild(tex,1) else: o.ViewObject.Transparency = 0 o.ViewObject.ShapeColor = (0.0,0.0,0.0) # black #print (" Object " + o.Name + " has no IfcObjectType or no IfcMaterial")
Wonder why this had not been improved, merged in Arch Module (or other general use) and widely used since so many year?
-
- Posts: 3
- Joined: Wed May 17, 2023 9:58 pm
Re: Macro Texture Objects
Thanks for this! As far as I can tell, the image is always expanded/scaled to the largest dimensions of a planar object/face. I would like a small image (like a single brick) to repeat/tile the image. coin has an option for this ("REPEAT"), but I can't figure out how to use it. I think it involves changing the (0, 1) default "coordinates" of either the image or the object. This would be great as an option in the macro, but actually I'm not using the macro -- I just want to be able to do it programmatically.
Do you have any knowledge about getting "REPEAT" to work? Thanks again, --Dan
Do you have any knowledge about getting "REPEAT" to work? Thanks again, --Dan