Site Tools

List AutoCAD Export Schemes

Developer: RhinoScript
Summary: Demonstrates how to build a list of ““AutoCAD”” export schemes.


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


AutoCAD DWG and DXF 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 AutoCAD 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 GetAcadExportSchemes()
  Const HKEY_CURRENT_USER = &H80000001
  Dim objReg, strComputer, strKey, arrSubKeys
  strComputer = "."
  strKey = "Software\McNeel\Rhinoceros\4.0\Scheme: Default\Plug-ins\39a88493-9e97-4f15-bd62-ad25896a2632\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
    GetAcadExportSchemes = Rhino.SortStrings(arrSubKeys)
    GetAcadExportSchemes = Null
  End If
End Function

You can test the function above with the following subroutine.

Sub ListAcadSchemes()
  Dim arrSubKeys, strSubKey
  arrSubKeys = GetAcadExportSchemes()
  If IsArray(arrSubKeys) Then
    For Each strSubKey In arrSubKeys
      Call Rhino.Print(strSubKey)
  End If  
End Sub
developer/scriptsamples/acadschemes.txt · Last modified: 2020/08/14 (external edit)