Is it possible to send blocks, with attributes, from Grasshopper to Power BI?

Hi. I would like to use Grasshopper to send block instances over to Power BI, with user attribute data (that can be accessed in Power BI via the “record” in the Data column).

I see that in Rhino it is possible to send blocks over, but unless I’m missing something, there is now way to include attribute data when sending from Rhino. Is there a way to include attribute data when sending blocks from Rhino?

Thanks!

Hey CarlRTC,

Great news - Rhino connector already supports attributes! To help you understand where they’re stored, I’m happy to walk you through the data structure. If you happen to have a Speckle Model URL with Rhino blocks and attached attributes, I’d love to help you out!

Hi Bilal, sorry, I was kind of unclear, I sort of had two separate questions.

My primary issue is that when I send blocks up to my Speckle stream using Grasshopper, I don’t see anything in the Branch Commit. The website says “no displayable objects found.” (and nothing comes into Power BI)

I’m using the CSO component to turn the block into a Speckle Object, then adding the various attributes using the ESO component.

EDITED TO ADD:
https://speckle.xyz/streams/a707037c92/branches/powerbi-connector-test-carl-model

Hey there @CarlRTC,

As far as i know, blocks are not part of the Vanilla Grasshopper objects (@AlanRynne to confirm). There are some plugins out there that can help you access Rhino blocks (Elefront), but they define their block objects and we can’t convert them. However, I’ve seen Grasshopper for Rhino 8 added block support, so we may add this for Rhino 8. In the meantime, you can to manually convert them via CSO component. If this is time consuming, I’m happy to explore some alternative ways if you can share a sample Rhino file.

Hi, Bilal, thanks once again for your reply! Yeah we use Elefront and the C# grasshopper component to deal with blocks.

Anyway, so if I use the CSO component to “manually” convert them as you say, will they show up in Power BI? I’ve tried this and I don’t see the records in Power BI, although on the Speckle website the overall count of items has gone up. Here’s how I’m doing it (the “O” input is where I’m inputting the blocks):

Also, a second question, is it possible to send data through Speckle (GH to Power BI) without any kind of geometry? (just alphanumeric attribute data)

Yes, Create Speckle Object node doesn’t necessarily need geometrical input. You can create objects that only has alphanumeric data.

Sorry, i think there is a misunderstanding. As i said, our Grasshopper node doesn’t know what a block is. What i meant what extracting the block geometry and attributes, then converting them into Speckle objects.

I couldn’t get alphanumeric-only to work with the CSO component, but I did get it to work with CSOKV.

I did notice it that for two or more rows that have the same exact data, it shows only one row. (example below: there are two rows with “A” and “C”, but in the data from the website, there is only one row with “A” and “C”. Is there a way I can get it to not do that?

Thank you!

Hey @carl,

I have some exciting news to share with you! I did some research on how to send blocks from Grasshopper and it seems that using a combination of Elefront and Speckle can do the trick. Although Grasshopper (for Rhino 7) doesn’t have native block support, Speckle has its own block definition. By using Elefront and Speckle Block objects, we can convert Grasshopper blocks to Speckle blocks and then receive them in Power BI with all their attributes intact. Let me show you how it’s done:

I have created a very simple model with 5 blocks in place.

Creating Speckle Blocks

As you may know, blocks consist of two parts:

  • Block definition
  • Block Instance

Block Definition

First we need to define a block definition. You can do that by selecting Speckle Schema Object, which stores all objects part of our library, even those that are not natively available inside Grasshopper.

Then simply search for block and select Block Definition.

Block Definition expects 3 inputs:

  • name: we can extract this using Elefront > Block Explode node.
  • geometry: again Elefront > Block Explode node.
  • basepoint for the block: Elefront > Block Info node.

Block Instance

Now we have block definition let’s put some instances of it. Again, we will use Speckle Schema Object Node.

Block Instance node expects two inputs:

  • block definition: we created one above.
  • transform: we can extract this using Elefront > Block Explode node.

Block Attributes

I also added an additional input to Block Instance node (you can do that by zooming in to the node and click +) for storing attributes. Used AttributesToJSON node from Elefront to convert the geometry into JSON.

That’s it! Now simply send it to a Speckle Project and Model of your choice.

Receiving in Power BI

Now, receive this in Power BI and you will receive many blocks.

I filtered out Block Instances from received data and expanded data column.

Converting JSON String into Power BI Record

Elefront Attributes to JSON node converts block attributes to a JSON string. However, its current state is not useful within Power BI. So, let’s parse the JSON into a Power BI Record object to make it more user-friendly.

You can do that by selecting the column, go to Transform > Text Column > Parse > JSON.

Result is a Record object that is much easier to work with.

Grasshopper File

I have attached the Grasshopper file too. I hope this answers your question.
8534.gh (9.7 KB)

3 Likes

Thank you!!! This is a solid workaround.

1 Like