I’m trying to read some custom object properties from Speckle in C#, the screenshot is below. The issue is when I flatten the stream, I can’t find the base objects with the same ID as in the Speckle stream.
Do you have an example how you’re searching for the id ?
Hi @haitheredavid, I’ve got a bit closer with beamElements below, I get an object with four Speckle base objects inside, which is what I was expecting from the first group in the original. But the ids aren’t the same and it doesn’t seem to contain the custom properties when I use GetMembers()
Hey @imanwarsame ,
Sorry it took us a bit to reply!
When using .Flatten()
the function is flattening every Base
object in the commit and the first result might not be exactly the object you’re looking for.
I’d suggest trying to iterate through them or filtering by id
directly, something like:
For a more advanced usage you can look at creating a custom traversal function, see https://github.com/specklesystems/speckle-sharp/blob/e9d54c51c52f95735f6d1519f4b20659a300f5e9/ConnectorRevit/ConnectorRevit/UI/ConnectorBindingsRevit.Receive.cs#L304
Hi @teocomi, worked like a treat! Thanks for pointing me in the right direction.
For completeness the below is how I managed to get all the base objects with custom properties, not the neatest but it works!
Members = FlatData.FindAll(i => i.GetMembers().Keys.Contains("@MemberType")).ToList();