STL import force filename as object name

Hey there,

Is there any way I can force Rhino to use the file name as Object name when importing STL files?
I have noticed that, from time to time the object name contains the path and filename (which would be OK too), but sometimes it’s some other string (defined by the exporting application).

Cheers,
Adam

Adam, check out this old script from @pascal does the job nicely. There might be something better out there now, not sure:
BatchImportAndName.rvb (2.0 KB)

Thanks for the lightning fast reply :smile:
That’s basically what I’ve been doing so far, but i would love to see it work on drag-drop actions too, so it needs to be more of a low level solution.
I believe all basic import plugins are closed source unfortunately, otherwise one might think of modifying the STL importer Plugin itself.
Maybe there is a way to configure the plugin in some undocumented way? additional registry entries?

Cheers

Im getting an error when I run this script, and as I have no knowledge of scripting Im not sure what to do about it.

Error: Type mismatch in parameter. Array required.
Line: 27
Char: 16

Im trying to import STLs and have each imported object on it’s own layer. If the individual layers could also have their own randomly assigned colors to differentiate between them, that would be amazing. Any help would be greatly appreciated.

Oi, that is an old one - this one is cleaned up a little- you get to narrow down the files to choose from by selecting formats to look for ahead of time.

-Pascal
BatchImportAndNam2.zip (1.0 KB)

Hmmm, it imports all of the files after I select the STL filetype, but doesn’t separate them into different layers. Any ideas?

Hmmmm- Why would it do anything with layers? The script was posted to help the person who started the thread.

here is one that puts things on layers - unzip, drag and drop for this command(alias):

ImportToLayers

BatchImportToLayers.zip (1.1 KB)

-Pascal

Apologies, didn’t realize the previous question was asking for object names as opposed to layers. This script works perfectly.

Hey @pascal , sorry to dig this from the tombs… looking to see if you have something in your archives that combines batchimportandname and batchimporttolayers. I need object names to derive from file name, but I also want them on their own layer so I can turn off/on easily in layers. I’ve got a complicated assembly with over 100 parts to 3d print.
Thank you!

Hello - I’m pretty sure I can combine them - send me a PM, just as a nudge, if I don’t get to it soon.

-Pascal

Thank you!