I’m exporting a geometry from a grasshopper script and receiving it in my node server. It has a bunch of breps which I’m trying to add to a file3dm object. Up to yesterday it worked fine. But today, without changing anything, add() expects two arguments.
How can that happen? Everywhere I look (js docs, .net docs, and the source code) add() receives one argument.
Sending a random string I got BindingError: Cannot pass "foo" as a ObjectAttributes const*.
Two questions I have:
How can the api change without having changed any dependency?
What should I send as second argument? null does the trick, but I don’t know if I’m breaking the geometry somehow
The js/py library uses this binding, and .net uses this binding or this. In .net you should be able to get away with just the item you want to add, in js, it has always needed two args. I have an idea of why the js docs are not correct and will try to tune them up.
I’m having issues with this again. What makes it use the 1 argument binding vs the 2 arguments binding?
I’m trying to add the objects in antoher3dmFile into a new File3dm. The goal is to combine objects from multiple files into a single one. For that I’m doing the following, which I thought should work, but it isn’t working:
const file = new rhino.File3dm()
const objects = another3dmFile.objects()
for (let i = 0; i < objects.count; i++) {
const obj = objects.get(i)
// file.objects().add(obj)
file.objects().add(obj, null) // this doesn't work
}
I’ve checked that the type of obj is File3dmObject, so I was hoping it would use the 1 argument binding, but it doesn’t.
Then, when I use null as second argument, I get the error:
RuntimeError: abort(BindingError: Expected null or instance of GeometryBase, got an instance of File3dmObject)