Add materials with one click - toolbar

Rhino 3D (Export script developed by SamPage; Integrated Plugin developed by Paul Kinnane)

Moderator: face_off

User avatar
formatio
Licensed Customer
Posts: 131
Joined: Sun May 18, 2014 11:00 am
Location: EU
Contact:

Hi

prehabitat - yes. I'll add more features in the future so they would go underneath the current icons (or cascade icon/menu when it gets crowded)

I have it like this:
toolbar location
toolbar location
If you guys have any suggestions for the toolbar post them in this thread
neiwei845458454
Licensed Customer
Posts: 86
Joined: Fri Jan 23, 2015 3:32 am

Code: Select all

# This Python file uses the following encoding: utf-8
import rhinoscriptsyntax as rs
import scriptcontext

rs.Command("_RenderLoadMaterialFromFile C:\\glass.rmtl")


def FindMaterialByName(mat_name):
    # find a material by name
    mat_table = scriptcontext.doc.Materials
    mat_index = mat_table.Find(mat_name, True)
    if mat_index >= 0:
        print("{0} found at index {1}").format(mat_name, mat_index)
    else:
        print("material named {} not found in table").format(mat_name)

if __name__=="__main__":
    FindMaterialByName("glass")

obj = rs.GetObject()

if obj:

    index = rs.ObjectMaterialIndex(obj)

    if index==-1: index = rs.AddMaterialToObject(obj)
this will help you
User avatar
Marvez
Licensed Customer
Posts: 97
Joined: Wed Oct 08, 2014 4:55 pm

thanks
I7 5820K 16MB RAM SSD850PRO GTX 970/780
User avatar
formatio
Licensed Customer
Posts: 131
Joined: Sun May 18, 2014 11:00 am
Location: EU
Contact:

Hi guys.

I just added toolbar for octane for rhino 3.x.x .

Download link is in the first post of this thread.


Regards,
Mac
fabrizio_s
Licensed Customer
Posts: 345
Joined: Fri Feb 03, 2017 12:14 pm

Hi formatio,
your toolbar is great.

Unfortunately materials don't work. Rhino says: Unknow Command

I' seem like "RenderLoadMaterialFromFile" isn't recognised...

Bye
User avatar
formatio
Licensed Customer
Posts: 131
Joined: Sun May 18, 2014 11:00 am
Location: EU
Contact:

Hi Fabrizio.

This command comes from rdk - do you have it installed/up to date?
This command (and many others starting with Render...) do not autocomplete.

Regards,
Mac
fabrizio_s
Licensed Customer
Posts: 345
Joined: Fri Feb 03, 2017 12:14 pm

Hi,
I have solved...my Rhino is in the Italian version...so I have to insert an underscore before the commands.

_RenderLoadMaterialFromFile

Now everything works fine

thanx a lot
User avatar
formatio
Licensed Customer
Posts: 131
Joined: Sun May 18, 2014 11:00 am
Location: EU
Contact:

Hi, Thank you for the info - I changed the toolbar so it works in every language now :) (see first post in this thread)

Hey Guys - if you have any suggestions or need another feature - let me know here and I try to implement it.

Regards,
Mac
fabrizio_s
Licensed Customer
Posts: 345
Joined: Fri Feb 03, 2017 12:14 pm

Thanx a lot!!!

Fabrizio
Post Reply

Return to “Rhinoceros 3D”