How to connect Dynamo to a web-based system


#1

Hello dear friends

I would like to know how can I connect Dynamo to Web or cloud? I have some inputs and outputs from Dynamo (extracted from my Revit file). Now I want to send them to Web to share between somebody else. I want to make this link bidirectional which means in case of any changes on my Revit file and consequently on outputs from Dynamo, Data stored in Web is also updated.
In Dynamo Studio as shown in attached picture, there are two options from the file menu namely “Send to Web” and “Manage Web Workspaces”. I am not sure whether these options can solve my issue or not, but the problem here is that as far as I know Dynamo Studio cannot connect to Revit file. Any comments would be highly appreciated.

Thank you so much


#2

Not particularly pro advertising, but maybe give flux a go?


#3

Thank u so much Jostein

Is it possible to create a web system using Python script in Dynamo and send all data extracted from Revit to a pre-designed Web system? and make it dynamic which in case of any changes in Revit model, the data in the Web gets updated. If yes, could you please share me a link or video of it if you have? I already worker with flux a little bit. It is very interesting and helpful, but since I am a student, university wants me to develop or integrate things which are free. Thank u so much again

Regards


#4

Think about using something like an ExternalCommand in Revit. You want to avoid using Dynamo for this since it won’t be automatic. In order for Dynamo to update your database you will have to launch it every time you want an update which makes it non automatic. That’s not a great workflow. Now with an ExternalCommand in revit you can subscribe to Synch event and send your data to database every time user synchs or saves the model. That would all happen behind the scenes and automatic.

Cheers!


#5

Thank you so much Konrad for your response. Yes. You’re right. But I need to know Revit API which I don’t now. Since I am working with Dynamo, I want to solve this issue in Dynamo.Do you know whether I can create my own website and send my Revit data to it to have a dynamic website using Python script in Dynamo? I just want to make sure that it is possible and then go to the next step. Thank u so much in advance

Best Regards


#7

Thank u so much @jostein_olsen

Is it possible to create a web system using Python script in Dynamo and send all data extracted from Revit to a pre-designed Web system? and make it dynamic which in case of any changes in Revit model, the data in the Web gets updated. If yes, could you please share me a link or video of it if you have? I already worker with flux a little bit. It is very interesting and helpful, but since I am a student, university wants me to develop or integrate things which are free. Thank u so much again

Regards


#8

Is it possible to create a web system using Python script in Dynamo and send all data extracted from Revit to a pre-designed Web system?’

Sure. However, keep in mind that Dynamo uses IronPython and you’ll have to stick to dotNet solutions. You can find a lot of examples of simple web servers on the net, however most of them will be targeting C# or VB.Net and you’ll have to translate them to python’s syntax yourself. Here’s a the first few examples that pop up from google:

https://codehosting.net/blog/BlogEngine/post/Simple-C-Web-Server

And of course, because your server will be running on top of Dynamo, it will die every time you close Dynamo and Revit, which would make it kind of useless…

Can I make it dynamic which in case of any changes in Revit model, the data in the Web gets updated

Possibly.

Could you please share me a link or video of it if you have?

The first suggestion that was given to you was a paid platform for a very good reason. What you’re asking for is going to be a monumental task and the amount of work required to create, maintain and update something like it would simply be humongous for an individual to tackle.

If you scale down your expectations and limit your scope to a few specific items, you might be able to cobble something up from existing solutions (open source deployable web servers, databases, etc.), but each of those will come with its own API and specifics and will require a ton of “glue” code to fit it all together and in the end Dynamo will be just a tiny piece of the whole.

But I need to know Revit API which I don’t now. Since I am working with Dynamo, I want to solve this issue in Dynamo

If you’re not willing to learn Revit’s API - which, as you’ll find, is much better documented than the majority of the open source solutions out there - accomplishing all of the above will be nigh impossible…


Dynamo online
#9

Hi @MOJTABA256, sorry for the late reply. As always, take Dimitars answer for good advice. Yes, Flux is a paid platform, however they have a free version of it, with the limitations being 2 projects only and 100Gb of data in total.


#10

Thank u so much dear Dimitar for your great explanations and time. I will check the links you sent to me and start learning Revit API. Could u please introduce me a good and effective Revit API learning package, even if it is not free to help me start learning Revit API? Thank u so much again and so sorry for the late reply, since I was travelling for 8 days and did not have access to the internet.

Regards


#11

Hi Jostein. Thank u so much for your response and sorry for my late reply since I was travelling for 8 days and didn’t have access to the internet. I am gonna work with Flux beside learning Revit API. Could u pls introduce me a good Revit API tutorial package? Thanks again

Regards


#12

On a somewhat similar question. Is it possible to have dynamo report and access say a Google Spreadsheet?


#13

I would say ‘likely’. Beyond the standard web request stuff, sheets and google drive have an API which can be accessed with Python, with or without authentication requirements. Only question is if it would execute correctly inside the Dynamo environment or not. Certainly worth looking into if you have a need.

I’ll also say that I think the web request node is gennerally underutilized.


#14

Mike,
Respect Google Spreadsheet exist a node call Raindrops, you can map info using “element unique id”, i testing transponse 200k element information.


#15

Hey @mike.quella, you can use the package I made called DynaWeb (available on the package manager) to interact with Google Sheets.
I ran a lab at #BILTeur just 2 days ago on this, see the attached sample Dynamo graph which sends stuff to Google Sheets. Remove the parts with append from the url (look at their docs) and the method to GET and it’ll happily retrieve stuff too.

I’d suggest looking into Airtable as an alternative though, the Google Sheets API is not nice to work with & docs are very obtuse.S31_Exercise_8_POST to Google Sheets_DynamoBIM forum.dyn (46.9 KB)


Hide/compile Dynamo scripts from end users?
#16

Hi @Radu_Gidei,

Thank you for posting and making DynaWeb! I’m using it to pull data from airtable - and have a few questions.

  1. I keep getting fields arranged differently when I connect. EG:
    {“records”:[{“id”:“rec5khMm0G6b23Oj6”,“fields”:{“ITEM1”:20,“Name”:“jimmy john",“DesiredHeight”:3,“Email”:"jerryJon@random.com”,“ITEM2”:5,“ITEM3”:10},“createdTime”:“2018-08-07T03:57:41.000Z”}
    and typically ITEM1 is grouped w ITEM2 & 3 (which is what I want) EG:
    “Name”:“jimmy john",“DesiredHeight”:3,“Email”:"jerryJon@random.com”,“ITEM1”:20,“ITEM2”:5,“ITEM3”:10}
    Do you know why this would happen?

  2. DynaWeb also doesn’t seem to update in real time. If there is a new entry in airtable - I have to restart dynamo for airtable to pull the update. Has this been your experience?

Thanks for any help!
-Mike


#17

Hi @MikeD,

Very cool to hear you’re using DynaWeb with the Airtable API.
It would be really useful if you could post/send me the DYN graph to help with debugging. If you’d be happy to contribute, we could also add it to DynaWeb samples folder for others to easily find and enjoy.

If you do plan to share, don’t forget to delete any API key strings or secrets in there).

To answer your questions :

1. Fields order

Though i haven’t used it before, a quick google or two lead me to believe Airtable API returns fields in a sorted order, with the ability for you to specify the field that is used for sorting.

Others with same issue : https://community.airtable.com/t/api-returning-fields-in-differrent-order/2299
Ordering records (& fields via in-page link) : https://support.airtable.com/hc/en-us/articles/223247187-How-do-I-sort-filter-or-retrieve-ordered-records-in-the-API-

I’d recommend using the JSON-to-dictionary node in the DynaWeb utilities in the meantime, since it will allow you to ignore the order of fields and retrieve the ones you’re interested in. YMMV though.

2. DynaWeb updates in realtime

This has to do with Dynamo caching the results (outputs) of nodes when executing. So if you run your graph and get stuff from Airtable, Dynamo won’t run that web request node again since it considers it executed (and hence no need to run again.)

This is something i’m aware of but i’ve not yet put any time towards making a built-in workaround in DynaWeb (requires messing with NodeModels).

To get around it today, you have a few options :

  1. Unplug and re-plug your request/web client node from the node that executes the web request. You shouldn’t need to restart all of Dynamo, but let me know if this doesn’t work.

  2. Use the ProRuBIM package’s force children eval node : this forces all nodes after it to always execute, bypassing Dynamo caching.

I suggest option 2 :slight_smile:

Let me know how you get on.


#18

Hi @Radu_Gidei,

Thanks for the help! It worked! Initially I stopped using DynaWeb bc of the inability to repeat the call. I was using - https://digitalborn.org/data-analysts-get-data-from-the-airtable-api/
The issue with that work around is excel can only update every minute - and I am trying to update in real time / as close as possible. I resumed trying to use DynaWeb this week with your fix and finally got it to work running “periodic”.
A side note for those using airtable with your call - this is extremely helpful -
https://codepen.io/airtable/full/rLKkYB

The force children eval node has also been helpful in the larger program.

Thanks again,
Mike


#19

Glad you got it working and thanks for updating the post with useful info for everyone else attempting the same workflow!


#20

Hi @Radu_Gidei,

Another issue whenever you have time - I am now trying to post to Airtable. I am trying to use your examples here - https://github.com/radumg/DynaWeb/tree/master/samples- and I keep getting an error - “error opening corrupted file”. I’ve had this warning on my home comp, work comp, and using Dynamo 1.3 & 2.0

Also in my current post to airtable - I am getting an error on the post -
“{“error”:{“type”:“INVALID_REQUEST_BODY”,“message”:“Could not parse request body”}}” - I’m not sure if my Airtable API URL call is correct. I can try and figure this out on my own if I can see some more examples.

Thanks again for Dynaweb & the guidance!
-M


#21

Hi Mike, can you please post a Dynamo file that we can debug ? Can’t do much more without one as not sure where the issue is.

Please make sure you don’t leave your api key or secret in the file before posting it.