User avatar
By polynurb
#380397
is there a way, if i don not use auto-select material, to make the material of the currently selected object active in the editor by using a keyboard stroke, or alias?

auto-select has some performance impact on big scenes and i would like a way to quickly get the current object's material without r-clicking or going through the properties.
By JDHill
#380401
There's no command for it, but you can make one; open nodepad, paste in this script, and save it as "SelectMaxwellMaterialOfSelectedObject.rvb":
Code: Select all
Option Explicit
Rhino.AddStartUpScript Rhino.LastLoadedScriptFile
Rhino.AddAlias "SelectMaxwellMaterialOfSelectedObject", "_NoEcho _-Runscript (SelectMaxwellMaterialOfSelectedObject)"
Sub SelectMaxwellMaterialOfSelectedObject()
	Dim objects: objects = Rhino.SelectedObjects
	If IsArray(objects) Then
		Dim obj: obj = objects(0)		
		Dim idx: idx = Rhino.ObjectMaterialIndex(obj)
		If idx > -1 Then
			Dim name: name = Rhino.MaterialName(idx)
			Rhino.Command "Maxwell_SetCurrentMaterial " & name & " _Enter"
		End If
	End If   
End Sub
Dropping the .rvb on your viewport will add a new "SelectMaxwellMaterialOfSelectedObject" alias, which you can use in a toolbar button, or assign to a keyboard shortcut.
User avatar
By polynurb
#380403
Hi,

one little thing
Command: SelectMaxwellMaterialOfSelectedObject
Command: Maxwell_SetCurrentMaterial
Enter Material Name <X_SuCi_StreetFin_P1>: X_SuCi_StreetFin_P1
Maxwell: Current Material set to: X_SuCi_StreetFin_P1.
Command: (2)
Unknown command: (2)
..because the material was cloned "(2)" with space in between.

i guess this needs extra "" somewhere?
but i can't quite figure out where/how
By JDHill
#380404
This should be what you're looking for:
Code: Select all
Rhino.Command "Maxwell_SetCurrentMaterial """ & name & """ _Enter"
So, you are adding string + name + string, where the two strings are enclosed in quotation marks; inside the strings, you write a single quotation mark by using two of them (if you used one, that would end the string, and you'd have a loose quotation mark sitting outside it).
Help with swimming pool water

Hi Andreas " I would say the above "fake[…]

render engines and Maxwell

Other rendering engines are evolving day by day, m[…]