Hi guys! I have a small question to ask. I have a vb script that creates directional light objects from a path curve and direction curve. Eventually I built a sun system with geco's sun path and direction. However I want to make that light a valid V-ray sun. As far as I know the Rhino command is "vismakesunlight" which converts a directional light into V-ray sun that could be used for GI and Environment.
this is the VB code that I use in the moment:
Private Sub RunScript(ByVal LinesList As List(Of OnLine), ByVal addLights As Boolean, ByRef A As Object)
If AddLights Then
Dim nLights As Int32 = 0
Dim strLightName As String = "GH_Light"
'first delete Lights created before
'construct a new object iterator Dim it As New MRhinoObjectIterator( _ IRhinoObjectIterator.object_state.normal_objects, _ IRhinoObjectIterator.object_category.active_objects) it.IncludeLights(True)
'loop through each object found and delete if objectName= strLightName
For Each obj As MRhinoObject In it
Dim attr As MRhinoObjectAttributes = obj.Attributes
If attr.m_name = strLightName Then
doc.DeleteObject(New MRhinoobjref(obj))
End If Next For Each Line As onLine In LinesList
Dim newlight As New OnLight
newlight.SetLocation(New On3dPoint(Line.PointAt(0)))
newlight.SetDirection(Line.Direction)
newlight.SetStyle(IOn.light_style.world_directional_light)
newLight.m_light_name = strLightName
doc.m_light_table.AddLight(newlight)
nLights = nlights + 1
Next
doc.Redraw()
print(nLights & " lights created")
End If
End Sub
Tags: