I am trying to use Rhino.NET to extend my RhinoScript code. I installed Microsoft Visual C++ 2005 and then downloaded the .NET Framework SDK from here. When I run the .vsi file, I get the following error message. Why does this happen?
I am trying to use Rhino.NET to extend my RhinoScript code. I installed Microsoft Visual C++ 2005 and then downloaded the .NET Framework SDK from here. When I run the .vsi file, I get the following error message. Why does this happen?
Are you sure you want this? This is for writing obsolete .NET plug-ins for Rhino 4. And, the download isn’t really an SDK, as all you need is to reference Rhino_DotNet.dll. Rather, its just a Visual Studio wizard and help xml file.
Why do you need this?
@dale I need this to write some code along these lines. I was using Rhinoscript until I hit a roadblock where Rhino 4.0 does not support certain Rhinoscript methods, specifically Rhino.MaterialIds
. So I’ve been trying to circumvent this by trying to write a code that will fetch the material table using Rhino.DocObjects. Is there any other way to around this issue with Rhino 4.0?
This is the part of my Rhinoscript code that works for Rhino 5 but not on Rhino 4 because of the absence of MaterialIds, MaterialIndices. Also, ObjectMaterialIndex in Rhino 4 does not modify the index.
Function FindIndex(str_name)
Dim mat_index, i, thisStr
Dim idMaterials: idMaterials = Rhino.MaterialIds
Dim indexMaterials: indexMaterials = Rhino.MaterialIndices
For i = 0 to UBound(indexMaterials)
thisStr = Rhino.MaterialName(indexMaterials(i))
If InStr(thisStr, str_name) <> 0 Then
mat_index = Rhino.MaterialIndex(idMaterials(i))
Exit For
End If
Next
FindIndex = mat_index
End Function
Function Material1(strObj)
Material1 = True
Dim mat_name, i, name, mat_index, materials, str_name, thisStr
str_name = "Material1"
mat_index = FindIndex (str_name)
If IsNull(mat_index) or IsEmpty(mat_index) Then
LoadVismats 16777215
mat_index = FindIndex (str_name)
End If
If IsNull(mat_index) or IsEmpty(mat_index) Then
Material1 = False
Exit Function
End If
Rhino.ObjectMaterialIndex strObj, mat_index
End Function
I guess I still don’t know what you are trying to do. But if you want to add a material to an object using RhinoScript 4.0, then just use the AddMaterialToObject
method.
Does this help?