like to use a single VRay material as a template for creating multiple identical materials with different colors within the GH environment (instead of creating manually in the document).
I have gotten as far as creating the materials. Now I need to add them to the document material table so that they can be used with Giulio's rendering component (which looks for either Rhino.Display.DisplayMaterial or a String that references a document object). I'm not going to learn C# to modify his script, so I am catering to its demands.
Private Sub RunScript(ByVal M As Object, ByVal C As Color, ByRef Mat As Object)
Dim mTemp As Rhino.DocObjects.Material mTemp = CType(M, Rhino.DocObjects.Material) If mTemp.Name.Length > 0 Then mTemp.DiffuseColor = C Dim nTemp As String = mTemp.Name & "_" & C.R & "_" & C.G & "_" & C.B mTemp.Name = nTemp End If
Rhino.DocObjects.Tables.MaterialTable.Add(mTemp) Mat = mTemp
End Sub
The code throws the error: Reference to a non-shared member requires an object reference. (line 96)
Do I understand that the material has to be assigned to a particular object in order to enter the Material Table? Can I assign it to a Layer instead? Any ideas? A better way to do this?
Thanks,
Marc
…
cannot be cast to [B]CustomClassXY. Type A originates from 'CustomLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'LoadNeither' in a byte array. Type B originates from 'CustomLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'LoadFrom' at location 'C:\Users\T\AppData\Roaming\Grasshopper\Libraries\CustomLib.gha'. (line: 96)This is how I do the casting:List<CustomLib.SomeClass.CustomClassXY> AllINPUTs = new List<CustomLib.SomeClass.CustomClassXY>();
for (int i = 0 ; i < INPUT.Count; i++)// { AllINPUTs.Add((CustomLib.SomeClass.CustomClassXY) INPUT[i]); }
The GHA is compiled with two namespaces, one for the component one for the library.
Thanks a lot in advance,
Tim…
p, open to designers worldwide, will explore the parametric mix of new raw materials and the re-use of elements from Carnival floats and costumes, transforming them using generative design processes and new digitally fabricated joint components, to create interventions for micro-venues and urban furniture in the Porto do Rio region.
Taught by AA Staff, recent AA graduates, and computation and fabrication professionals, the studio-based workshop will include extensive instruction in Rhino Grasshopper (including GECO, and Galapagos, to integrate environmental optimization, simulation and parametric control) and digital fabrication processes using laser cutter, CNC-milling and rapid-prototyping machines, sponsored by DS4 and SEACAM, all of which will be used to produce one-to-one design prototypes.
MORE INFORMATION AND APPLICATION: http://rio.aaschool.ac.uk/andhttp://www.aaschool.ac.uk/STUDY/VISITING/rio.php…