mDrew
(Andrew)
May 21, 2021, 1:36pm
1
Hi everyone,
I attached a python definition as I am struggling to understand how to update the filepath of the textures loaded in a rhino material. Does anyone have any idea?
Thank you!
UpdateMaterialTexture.py (600 Bytes)
stevebaer
(Steve Baer)
May 22, 2021, 3:58pm
2
@andy can you help with this as it is related to materials?
nathanletwory
(Nathan 'jesterKing' Letwory)
June 11, 2021, 6:15pm
6
Hi @mDrew ,
I wrote an example and explanation at https://jesterking.github.io/rhipy/change_texture_filepath.html . The generated Python code is at:
import os
import rhinoscriptsyntax
import scriptcontext
import Rhino.Render
import System.Convert
def handle_render_content(render_content, target):
child = render_content.FirstChild
while child:
handle_render_content(child, target)
if child.IsImageBased():
child.BeginChange(Rhino.Render.RenderContent.ChangeContexts.Program)
source_path = System.Convert.ToString(child.GetParameter("filename"))
source_file = os.path.basename(source_path)
child.SetParameter("filename", target + os.sep + source_file)
child.EndChange()
child = child.NextSibling
target = rhinoscriptsyntax.BrowseForFolder()
This file has been truncated. show original
2 Likes
mDrew
(Andrew)
June 12, 2021, 11:06am
8
That’s great! Thank you @nathanletwory !!