RhinoScript crash on importing multiple ViewDisplayModes


I needed a simple script to import multiple ViewDisplayModes into Rhino in one go (going via Options allows only one-at-a-time).

Each time I try doing it via script, either using RhinoScript ImportViewDisplayMode method, or just scripting the -Options… command, it crashes Rhino.
(the crash does not happen if only one .ini file is selected, with two or more - crash every time).

Here is the code (you can comment out either of the import methods) - wondering if anyone else can repeat the crash, or have any other idea how to import multiple display modes avoiding it:

Option Explicit
Call Main()
Sub Main()

	Dim arrFiles : arrFiles = Rhino.OpenFileNames("DisplayMode Files to import?", "DisplayMode Files (*.ini)|*.ini|All Files (*.*)|*.*||")
	If isnull(arrFiles) Then Exit Sub
	Dim i
	For i=0 To Ubound(arrFiles)
		'import via Rhino command:
		Call Rhino.Command("_-Options _View _DisplayModes _Import " & chr(34) & arrFiles(i) & chr(34) & " _EnterEnd")
	For i=0 To Ubound(arrFiles)
		'import via RhinoScript method
		Call Rhino.ImportViewDisplayMode(arrFiles(i), True)
End Sub

Hi @Jarek,

It took me a while, but I was finally able to reproduce the crash.


– Dale


RH-49421 is fixed in the latest Service Release Candidate