Import command takes too much time


#1

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.


(Menno Deij - van Rijswijk) #2

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


#3

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.


(Pascal Golay) #4

Hi Enrique-

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

-Pascal


(Menno Deij - van Rijswijk) #5

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.


#6

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.


(Willem Derks) #7

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


#8

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.


(Menno Deij - van Rijswijk) #9

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


(Willem Derks) #10

No problem,
glad you found the cause.

-Willem