Import command takes too much time

Hi,

When I use “Import” command from a script with some .stl files it takes too much, 5 or 6 minutes.

This is the code line I use:

Rhino.Command("-_Import " & filepath & " _Enter")

For example, one .stl file of 1,7 MB takes more than 5 minutes and another of 1,4 MB takes 1 second. Both of them are binary .stl files.

Any idea of what is happening here? Is there any other way to open a file with no user interaction (OpenFileName is not an option because it opens a window to select the file)?

Any help would be really appreciated.

Thank your in advance.

Regards,

Enrique.

If you open the same problematic file by hand, does it take just as long?

No! That is the thing I don’t understand.

If I open this file (and many others, it is not only one file with this problem) with double-click it opens almost instantaneously.

And also if I drag and drop them into Rhinoceros and choose “Import” option in the window that Rhino offers to me, then they open really fast as well.

Which is the difference with the script command?

Thank you again,

Enrique.

Hi Enrique-

Are the files in different locations, one local and one on a network for example?

-Pascal

This may be a red herring, but in other examples I see the import command being scripted as

Rhino.Command "_-Import " & CHR(34) & strFile & CHR(34) & " _Enter"

Note the CHR(34) - this is a double quote. You may have spaces in your file name, so you need to put quotes around it.

Hi,

@pascal: Every file is located in the same local directory. I have used the 1,4 MB and 1,7 MB files as an example, but I get the same problem with several files, smaller and bigger.

@menno: I have tried your solution and I get the same behaviour. The thing is that the file opens at the end, so it is not a problem related to the command doesn’t finish OK. The issue is the time it takes.

Is there another way to open a file instead of Rhino.Command "_-Import" ?

Thank you very much for your help.

Hi Enrique.

It could be the topology of the files causes the importer to need more time processing it.
I’m on my phone so the description below is by approximation.

If you run te regular import command, STL files have an option to be welded and split into disjoint parts. If you set both options to not be executed you can check if either of these cause the difference.

Does that help?

-Willem

Hi All,

I have detected that if I write:

Rhino.Command("_-Import " & "C:\asdfg_I_limpio.stl" & " _Enter")

or:

Call Rhino.Command("-_Open " & "C:\asdfg_I_limpio.stl"& " _Enter")

in a rvb file with no more code then the file is imported or opened very fast, so it is not a problem in this part.

I have found that the command is blocking my execution is:

Rhino.UnifyMeshNormals arrmesh(0)

so if I comment this line above the files are loaded almost intanstaneously.

I am really sorry for the inconveniences and thank you very much for your help.

Regards,

Enrique.

Ah, oh well. We all PEBCAK from time to time :smile:

No problem,
glad you found the cause.

-Willem