Site Tools


List IGES Export Schemes

Developer: RhinoScript
Summary: Demonstrates how to build a list of IGES export schemes.

Question

I would like to have a method which could return the IGES export schemes. This way, one could query the available schemes, present the user with a pick box and then set the desired scheme.

Answer

IGES export schemes are stored in the Windows Registry. The following sample code demonstrates how to build a list of them. Note, the “Default” scheme is built into the IGES export plug-in. Thus, if you want to list the “Default” scheme, along with the custom schemes, you will to add this to the list of schemes yourself.

Option Explicit
 
Function GetIgesExportSchemes()
  Const HKEY_CURRENT_USER = &H80000001
 
  Dim objReg, strComputer, strKey, arrSubKeys
  strComputer = "."
  strKey = "Software\McNeel\Rhinoceros\4.0\Scheme: Default\Plug-ins\7f0ca561-0c7c-4cea-b822-b95ebe71c409\Settings"
 
  On Error Resume Next   
  Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
  If Err.Number = 0 Then
    Call objReg.EnumKey(HKEY_CURRENT_USER, strKey, arrSubKeys)
  End If
 
  If IsArray(arrSubKeys) Then
    GetIgesExportSchemes = Rhino.SortStrings(arrSubKeys)
  Else
    GetIgesExportSchemes = Null
  End If
 
End Function

You can test the function above with the following subroutine.

Sub ListIgesSchemes()
  Dim arrSubKeys, strSubKey
  arrSubKeys = GetIgesExportSchemes()
  If IsArray(arrSubKeys) Then
    For Each strSubKey In arrSubKeys
      Call Rhino.Print(strSubKey)
    Next
  End If  
End Sub
developer/scriptsamples/igeschemes.txt · Last modified: 2015/09/14 (external edit)