Dynamo экспорт в excel

In this tutorial, we’ll explore the different ways in which you can transfer geometry and BIM data from Dynamo to Excel (and back!) using Speckle.

Dynamo has already a couple of nodes that let you export and import Excel files, so why bother using Speckle?

Dynamo built-in Excel nodes

Well, there are quite a few advantages:

  • data is stored in Speckle, not in files. Access it whenever you want it, wherever you want it
  • no need to worry about losing data or overriding files, each time you send a permanent commit is saved automatically
  • you can filter data before it’s actually received in Excel
  • personally, I find the built-in nodes a bit finicky!

Prerequisites

To follow this tutorial you’ll need the following:

  • Dynamo (I’m using 2.6 inside Revit 2021)
  • Excel (I’m using Excel Web)
  • a Speckle account (you can get one at https://speckle.xyz/)
  • the Speckle Connector for Dynamo (install it via Manager)
  • the Speckle Connector for Excel (install via Office store, instructions)
  • a BIM model (I’m using the sample architectural one that comes with Revit)

Method 1: Pre-filtering data in Dynamo

This first method is ideal if you already know what data you’ll need in Excel or if you have old definitions using the built-in nodes that you’d like to update by using Speckle.

In Dynamo

Simply create the logic to extract some data and structure it in a list of lists, where each sub-list corresponds to a row in Excel.

Here’s a sample that takes room information from Revit. Both images show the same logic, but the second is more concise:

Verbose version
Concise version

Now, it’s just a matter of sending these nested lists to Speckle. Either create a new stream or pick an existing one’s URL and plug it and our data in a sender:

After clicking the send button, you’ll be able to view the data online instantly:

::: tip

Right click the send node to view the stream online

:::

In our online viewer, you can see the data just sent. In the future we will introduce a tabular interface to see this in a more natural way.

Here’s a link to the commit if you want to check it out.

In Excel

In Excel, we just need to add the stream to our document and receive this commit, since the data structure is quite simple, we won’t be asked to filter it.

The data will be inserted where our cursor is.

Let’s now update the Dynamo script and send again, for instance by adding a new parameter, like the room perimeter:

In Excel we now click «receive last selection», we’ll get the updated data set in the previosly selected cell:

Method 2: Filtering data in Excel

This second method is great if you don’t know yet what data you’ll need in Excel, we’ll be sending Revit elements with all their properties and then filter the data we need in Excel.

In Dynamo

Update the Dynamo script to just send the rooms:

In Excel

Now in Excel, if we follow the same steps as before, we’ll be prompted to filter the data before it’s written in the spreadsheet. This is because it’s a much larger data set than before.

See the gif below for how to do that, and notice that under the parameters item we have available all the parameters belonging to a Revit room, indexed by their internal Revit name.

For a list of internal parameters names, see this page.

The result achieved is the same as with the previous method, the only difference is that now we also get headers with the property names.

Conclusion

We hope you enjoyed this tutorial and found it useful!

Speckle is an Open Source project and we really ❤️ feedback, so if you have any questions, comments, critiques, or praises please let us know on our community forum.

Dynamo – Русский – только для чтения

Раздел для программистов и специалистов, использующих Dynamo


Включить подсказки

С помощью автоматической подсказки можно сузить результаты поиска до возможных соответствий при вводе текста.


Отображаются результаты для 


Вместо этого искать 

Вы имели в виду: 


  • Назад к форумам


  • Назад

  • Далее

eng11DUDJZ

655 просмотров, 2 ответов

‎11-21-2021

06:02 PM

[dynamo] Экспорт данных в эксель.


Добрый день.Пытаюсь написать скрипт по экспорту данных в эксель и у меня выскакивает ошибка    «Предупреждение:Data.ExportExcel операция не выполнена.
Невозможно привести COM-объект типа «Microsoft.Office.Interop.Excel.ApplicationClass» к интерфейсному типу «Microsoft.Office.Interop.Excel._Application». Операция завершилась со сбоем, поскольку вызов QueryInterface COM-компонента для интерфейса с IID «{000208D5-0000-0000-C000-000000000046}» возвратил следующую ошибку: Элемент не найден. (Исключение из HRESULT: 0x8002802B (TYPE_E_ELEMENTNOTFOUND)).»НА самом последнем ноде выскакивает.».Кто нибудь сталктвался с таким?

eng11DUDJZ_0-1637506957469.png


  • Назад к форумам


  • Назад

  • Далее

2 ОТВЕТ 2

Leutsky_VA

‎11-21-2021

06:13 PM

Добрый день.

Такое было, пришлось переустановить весь пакет Office

Находите сообщения полезными? Поставьте «НРАВИТСЯ» этим сообщениям! | Do you find the posts helpful? «LIKE» these posts!
На ваш вопрос успешно ответили? Нажмите кнопку УТВЕРДИТЬ РЕШЕНИЕ | Have your question been answered successfully? Click ‘ACCEPT SOLUTION’ button.

Владимир Леуцкий | Vladimir Leuckii >Эксперт по решениям Autodesk | Autodesk Solutions Expert
Сертифицированный инструктор Autodesk Civil 3D | Autodesk Certified Instructor Civil 3D

KozyrevYA


  • Назад к форумам


  • Назад

  • Далее

Dynamo

Importing from Excel

To Import data from Excel you can use the out-of-the-box Import node. For Dynamo version 2.x, search «excel» in the search bar and find the node [ImportExcel]. For Dynamo version 1.x, search for «excel» and Read more…

Dynamo

What is a “String”

«In computer programming, a string is traditionally a sequence of characters…» Reference: https://en.wikipedia.org/wiki/String_(computer_science) In laymen’s terms, a string is basically “text”. It is equivalent to the “Text” type in Revit and the “Text” type in Excel, but it is not Read more…

Dynamo

When Running Graphs (Scripts)

When running Dynamo graphs, also called scripts, make sure that there aren’t any active pop-up menus open in Revit. Sometimes it’s easy to forget that you have left open the view template properties after checking Read more…

Dynamo

Loading

  • Learn
  • Explore
  • Blog
  • Forum
  • Roadmap
  • Resources

    • Primer
    • Dictionary
    • Developer
    • Builds
    • Events
    • DesignScript Guide
    • Help Center
  • Get Dynamo

It is sometimes desirable or necessary to push data from Revit to Excel, and back again. One such example I can think of is when working with a door hardware consultant.

The door hardware consultant may not have access to Revit, little lone your Revit model. You have a few options. You could export your data to Excel, have him/her populate it, and then re-enter the data once it is back in Revit OR you could export it to excel using Dynamo, and then re-import the data from excel to Revit.

It’s worth mentioning that you want to be very intentional about how and when you complete these tasks. For example if you export your data, and add/remove a door, this information will be lost in translation with your door hardware consultant.

Exporting Revit To Excel

All Elements of Category paired with Categories pulls all the elements that exist in your model.

Next, we want to pick which parameters from the elements to export. To do this we will use the «Element.GetParameterValueByName» node. I’m also using the «Element.Id» so I can match the components and their data with the unique Element.Id.

List.Create allows you to take multiple streams of data and combine them. This is important as the Revit to Excel node later will be receiving one stream of data.

List.Transpose flips data. It makes rows columns and columns rows. If you are a grasshopper user, this does the same thing as «Flip Matrix» in grasshopper.

Excel.WriteToFile is AMAZING. This node is where the magic happens. We have a few inputs to match up. Where is the File located? What is the sheet name? Which Row/Column do you want to start with? Overwrite data that exist?

Here is the result! Now to email the hardware consultant! ;)

Push data from Excel to Revit

Here is the full script for importing the data from excel back into Revit.

Importing the data from Excel into Revit begins with the «Excel.ReadFromFile» node. You will use the File Path and File.FromPath nodes to browse to your excel file. Pick which sheet you want to import from. Pick the Sheet name. One of the most important subtle check boxes that I found extremely important was the «ReadAsStrings» input. The reason this input is so important is depending on if your Revit parameter name is a number or not, you will want to be intentional about checking this true or not. Revit text parameter=True. Revit number parameter=False.

We’ll be using the List.Transpose again to get convert the rows back to columns and the columns back to rows.

We’ll use the List.GetItemAtIndex to choose which Excel column to grab. «0» will be the first column. «1» will be the second columns, and so on.

Finally we will want to pick which elements and parameter(s) to feed our data back into. We will be using the «Element.SetParameterByName node to populate the data. We can pair the «All Elements of Category» with the «Categories» node to grab the doors again. We are using a code block with quotes for the parameter name «Door Hardware Group». It’s worth mentioning again that since our excel to revit node imported as string, we do not need to convert the data to a text string for the text parameter «Door Hardware Group». You will need to take into consideration if your parameter is number parameter or an integer parameter instead of a text parameter as you may need to use the string to number node.

And here is the Door Hardware Group populated in the Revit schedule!

Here’s the data set I used. Enjoy! https://1drv.ms/f/s!Avd-6xjpUFd6iJ9zdhg8-I0MN7EpIQ

Interested in growing your Dynamo ninja skills or want to host a dynamo workshop at your office? Reach out to me personally at bill.allen@evolvelab-inc.com

#Revit #Dynamo #freedynamotraining #ExcelToRevit #revittoexcel #RevitSchedules #doorhardware #Architecture #DenverBIMServices #HealthcareBIM #FreeDynamoTraining #RevitSchedule

Понравилась статья? Поделить с друзьями:
  • Drawing figures in word
  • Dynamics meaning of the word
  • Drawing family tree in word
  • Drawing diagrams on word
  • Drawing connecting lines in word