Import command with file name

I have several STL files that I sometime need to read into Rhino and I don’t want to do it manually.
How can I supply a file name to the import command in vbscript it will do it automatically.

Thanks

Hi Gideon - use

Rhino.Command ("_-Import " & “Full path to file”)

Does that do what you want?

-Pascal

Hi Pascal

What I tried was not exactly as you suggest. I will try your recommendation.

Thank much

Hi Pascal

Tried your recommendation.
It looks like Import is having problems with blanks in a file/folder name.
Please see below:

This is my coding:
Call Main()
Sub Main()
Dim strFolder

strFolder = "D:\HW wb 422.stl"
	
Rhino.Command("_-Import " & strFolder)

End Sub

This is the result:
Command: _-Import
Name of the file to import ( Browse ): D:\HW
File D:\HW.3dm not found, unable to open

Please note that the command stops after the blank in the file name and it also assume that the file is a 3dm.

Any thoughts
Thanks

Perhaps try:

Rhino.Command("_-Import " & chr(34)&strFolder&chr(34))

–Mitch

Hi Mitch

That worked. Very strange that the quotes had to be in chr format.

Had to add “_Enter” to avoid having to hit enter when “STL Import Options” came up.

Thanks for your help

Hi Pascal,

Got it to work with some additional help. Please see my thread.

Thanks again for your help

Yep, Chr(34) - I should have mentioned that. You can add the Enter:

Rhino.Command("_-Import " & chr(34)&strFolder&chr(34) & " _Enter")

-Pascal