Save/Import *.rmtl files via Scripting/Command

Is there currently a way to use RhinoScript or any command to export Rhino materials as rmtl files?
I can only do it now manually from MaterialEditor and would like to be able to automate it.

1 Like

Hi Jarek, you can try to script below commands, they do not autocomplete:

RenderSaveMaterialToFile
RenderLoadMaterialFromFile

note that you`ll need to define the material name and loading does not assign.

c.

3 Likes

Hi Clement,

Thank you very much, that is exactly what I was after and will get the job done! Much appreciated.

On the side note - I wonder why this is not documented in Help or will not autocomplete… the only source online I could find a mention about it (and a bunch of other Render… commands) is here: http://tips.rhino3d.com/2011_06_01_archive.html?m=1

Bunch of useful stuff for macros/scripting of render/materials/textures:

RenderAddEnvironment: Add render environment.
RenderAddMaterial: Add render material.
RenderAddTexture: Add render texture.
RenderChangeEnvironment: Change render environment.
RenderChangeMaterial: Change render material
RenderChangeTexture: Change render texture.
RenderConvertOldStyleMaterials: Convert old style render materials.
RenderCreateRenderFrame: Create render frame.
RenderDeleteEnvironment: Delete render environment.
RenderDeleteMaterial: Delete render material.
RenderDeleteTexture: Delete render texture.
RenderDuplicateEnvironment: Duplicate render environment.
RenderDuplicateMaterial: Duplicate render material.
RenderDuplicateTexture: Duplicate render texture.
RenderGroundPlaneOptions: Set render ground plane options.
RenderInstanceSimilarContent: Instance similar render content.
RenderLoadEnvironmentFromFile: Load render environment from file.
RenderLoadMaterialFromFile: Load render material from file.
RenderLoadTextureFromFile: Load render texture from file.
RenderOpenLastRendering: Open last rendering in render window.
RenderPostEffectPlugInOptions: Open the Options dialog box at the Post Effect Plugins Page.
RenderRemoveUnusedMaterials: Remove unused render materials.
RenderRenameEnvironment: Rename render environment.
RenderRenameMaterial: Rename render material.
RenderRenameTexture: Rename render texture.
RenderRenderingDocumentProperties: Set rendering document properties.
RenderRenderingOptions: Set rendering options.
RenderSafeFrameOptions: Set render safe frame options.
RenderSaveEnvironmentToFile: Save a specified render environment setting to a *.renv file.
RenderSaveMaterialToFile: Save a specified material to a *.rmtl file.
RenderSaveTextureToFile: Save a specified texture to a *.rtex file.
RenderSetCurrentEnvironment: Provides a scripting option for setting an environment.
RenderSunOptions: Opens the sun options dialog box.

I guess we have to ask @andy why some the RDK commands do not autocomplete ? There are some test commands as well which i guess are used internally. I´ve written some of the working commands down into a text file when had downloaded the plugin for Rhino4 long time ago. In Rhino5 the RDK plugin seems to be included by default.

c.

I can’t for the life of me remember why. I suspect it may have had something to do with documentation.