Importing .obj from filename in Grasshopper (not with Python)

I need to load a .obj file into my grasshopper tool from a filename, and had been using localcode to manage this for me in Rhino 5, but it now fails in Rhino 6, in the same way that this unanswered post describes - the plugin reports “No layer by that name could be found”. Unfortunately, this localcode plugin has not been updated in a long time and I don’t expect that will change.

Because I later call this grasshopper tool from Python, I’m unable to use python scripts inside the tool, so the various examples of importing .obj files with Python scripts in grasshopper aren’t helpful for me. I haven’t been able to find any other non-python plugins, and the attempts I’ve made to script something in C# haven’t gotten very far as I’m not experienced and haven’t found a clear example on importing objects.

Any recommendations / examples / workarounds for importing .objs within grasshopper?

Unfortunately, I can’t share my tool with you here, but I’ve made an example file to demonstrate the issue (it’s attached with a copy of the localcode plugin and a test obj file)

importOBJ.7z (80.9 KB)

Can you explain in more detail, why exactly you are calling the gh script from python?
What problem are you trying to solve by doing this?

Hi Lando,

Thanks for the question!

I have a library of ~600 3D scans of various similar objects that are all .obj files, and the grasshopper tool I’ve created identifies landmarks on any given scan, and outputs measurements (circumference, distance, angles, etc). The objects are complicated, and file sizes are about 3mb per scan, so I didn’t want to tackle all 600 within grasshopper - hence the python step.

The python script reads all of the filenames in the folder of scans, opens rhino, and feeds the filenames through the tool (which has been saved as a user object) one by one, saving the output measurements into a csv file. The ultimate goal is to be able to compare measurements of all of these objects on a large scale.

Let me know if this is still unclear, I’m happy to elaborate.

1 Like

Ok, as far as i understood from your fist post, C# code would work?

Give this a try :slight_smile:

importObj.gh (9.1 KB)

1 Like

Hi Lando -

Success! I’ve plugged this into my tool and it works.

Thank you so much!
-Audrey

Hey Abosquet,

I am trying to achieve similar goals in terms of processing more than 1000 obj files to attain specific dimensions of the geometry at a particular face.

I would be grateful if you can share or guide me how to create " grasshopper tool I’ve created identifies landmarks on any given scan, and outputs measurements (circumference, distance, angles, etc). " and the python script.

Thank you