Python in Dynamo: Basic Examples

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 พ.ย. 2024

ความคิดเห็น • 48

  • @michaelwickerson4862
    @michaelwickerson4862 ปีที่แล้ว +1

    Thank you for this series, I wish I started with revit, dynamo and python before grasshopper and rhino3D. Michael

    • @AussieBIMGuru
      @AussieBIMGuru  ปีที่แล้ว +1

      They're both highly valuable platforms - I use both! The only thing I wish was different in Grasshopper was a bit more list logic at the surface level, trees are powerful for geometry, but challenging in other scenarios.

  • @damirces
    @damirces ปีที่แล้ว +1

    Really great series that you made Gavin. I am using Revit 2022 and for example Dynamo Node "if" works just fine. Also the first two basic codes for "if" node that you made doesn't work. Start working from the moment when you used if and else with the IN...

    • @AussieBIMGuru
      @AussieBIMGuru  ปีที่แล้ว

      Yes they fixed it eventually in later builds to behave properly. As far as I know the code I used should still work, make sure there are no typos or missing colons.

  • @isaiass.1951
    @isaiass.1951 3 ปีที่แล้ว +1

    Hi, I'm from Brazil, and your video help me so much... Thanks

    • @AussieBIMGuru
      @AussieBIMGuru  3 ปีที่แล้ว +1

      You're welcome! Great to know I have viewers in Brazil :)

  • @ATTechTutorials
    @ATTechTutorials 4 ปีที่แล้ว

    Great concepts for learning the basics of Python in Dynamo! Thanks Gavin!

    • @AussieBIMGuru
      @AussieBIMGuru  4 ปีที่แล้ว

      Cheers Alan! Next week we go deeper so wanted to start simple

  • @youpeng7008
    @youpeng7008 3 ปีที่แล้ว +1

    Despite my english is bad, i can inderstang very well
    Thank you

    • @AussieBIMGuru
      @AussieBIMGuru  3 ปีที่แล้ว

      You are welcome! I am glad it is still understandable, and thank you for the kind feedback.

  • @eng.tiago.b
    @eng.tiago.b 7 หลายเดือนก่อน +1

    bro, epic intro hahha
    greetings from Brazil

  • @陳冠亦-j4s
    @陳冠亦-j4s 3 ปีที่แล้ว +1

    Thanks Gavin! I appreciate it, learned a lot.

  • @adityakelkar7178
    @adityakelkar7178 4 ปีที่แล้ว +1

    Hi Gavin, thanks for another great video! Just a quick question about the random package. I am getting an IronPython error saying the random package is not defined. Do I need to install that somehow in Dynamo?

    • @AussieBIMGuru
      @AussieBIMGuru  4 ปีที่แล้ว

      I believe you may need a certain build of Dynamo to access it - in my case I'm using Revit 2020 and Dynamo 2.3. I believe they introduced it in 2.1 but not 100% certain.

  • @mago_Maximo_do_Universo
    @mago_Maximo_do_Universo 7 หลายเดือนก่อน +1

    bro, epic intro

    • @AussieBIMGuru
      @AussieBIMGuru  7 หลายเดือนก่อน

      Haha thanks! I shortened it eventually as it was a bit on the long side....

  • @vntk7686
    @vntk7686 4 ปีที่แล้ว +1

    Great video! I want to use python libralies numpy and scipy, if you have any idea, could you tell me?

    • @AussieBIMGuru
      @AussieBIMGuru  4 ปีที่แล้ว

      It isn't present by default, but GHRemote might allow you to run external packages if you use Rhino Inside;
      www.food4rhino.com/app/gh-python-remote
      I don't believe Dynamo itself can access these packages directly as it uses IronPython, whilst these rely on CPython.

  • @tumzarelaxing
    @tumzarelaxing 2 ปีที่แล้ว

    Question ? ? ? ? ? - Hi Guru, How can you setup a Loop that uses While (iteration of count at levels). How will you implement, Geometry.intersect and IndexOF and GetItematIndex. 2. how do you deal with levels list.map (iteration to collect information for each 3 levels deep at L2).

    • @AussieBIMGuru
      @AussieBIMGuru  2 ปีที่แล้ว

      I typically wouldn't to be honest, I recommend trying to get geometry into a consistent list structure and then you can iterate at a predictable depth. Usually in data science and also Dynamo it is best to clean data before working with it rather than receiving it in unpredictable shapes. If you want to exhaust levels anyway, you would need to run a for loop across all item at the top level of the data structure, then iterate within a try/except/break statement probably so that if it doesn't work, it can move on.
      For running some functions at levels from Dynamo I usually prefer to package my Python into a custom node and can then work with levels in the node itself.

    • @tumzarelaxing
      @tumzarelaxing 2 ปีที่แล้ว +1

      Thanks for the reply

  • @immi85
    @immi85 4 ปีที่แล้ว +1

    again great video.

    • @AussieBIMGuru
      @AussieBIMGuru  4 ปีที่แล้ว +1

      Cheers Immi! Hope these help give some more context to your learning during the Python series. You'll see in the next video the usefulness of 'for' loops when dealing with Dynamo elements in lists.

    • @immi85
      @immi85 4 ปีที่แล้ว +1

      @@AussieBIMGuru sure 👍

  • @rezwanulhoque117
    @rezwanulhoque117 ปีที่แล้ว +1

    In the last part of this tutorial, you created a python script for random numbers, when you run the script numbers are automatically generated without code block.... how?

    • @AussieBIMGuru
      @AussieBIMGuru  ปีที่แล้ว

      At 22:40 I show that my node has some default inputs. These can be set inside the custom node input nodes using the syntax inputName: dataType = default value

  • @engomardriouich9329
    @engomardriouich9329 ปีที่แล้ว

    i have tried the script but I have got a problem with the dwg file. when I opened the file it doesn't have the filters that it was in the Revit sheet. the colors look different than the Revit and also the filters that were applied in Revit it doesn't have them.
    what can I do to get the DWG files to look the same as the Revit sheet?

    • @AussieBIMGuru
      @AussieBIMGuru  ปีที่แล้ว

      I don't believe this is possible. You can choose layer/import settings in Revit under options, but filters etc. don't carry over when exported from Revit naturally, so Dynamo can't apply them either. In AutoCAD generally you would need to configure a .ctb file to control line weights and colours.

  • @LinhNguyen-zp4cb
    @LinhNguyen-zp4cb ปีที่แล้ว

    5:53 please explain, what is the "if_bool" in "if if_bool:" syntax in this case?

    • @LinhNguyen-zp4cb
      @LinhNguyen-zp4cb ปีที่แล้ว

      "if bool" is 1 condition?

    • @AussieBIMGuru
      @AussieBIMGuru  ปีที่แล้ว +1

      In this case I am storing the input as a variable. This can sometimes be more useful if you want to use the input more than once in your code.

    • @LinhNguyen-zp4cb
      @LinhNguyen-zp4cb ปีที่แล้ว

      @@AussieBIMGuru It will automatically interpret the condition as True, right? thanks

    • @AussieBIMGuru
      @AussieBIMGuru  ปีที่แล้ว +1

      @@LinhNguyen-zp4cb no. It's just a variable name and will store the value provided to the input er assign to it (the boolean going into IN[0]).

  • @Raja-Raju251
    @Raja-Raju251 4 ปีที่แล้ว +1

    How much python should i know for dynamo...?

    • @AussieBIMGuru
      @AussieBIMGuru  4 ปีที่แล้ว +3

      It depends what you need to do with it. Most users get by with no understanding.
      Personally I learnt it because;
      - It provides more efficient list management (e.g. for loops, if statements)
      - It allows custom node development
      - It provided me with access to Revit API commands
      My specific 'bending point' was that I needed to set the time of day in multiple Revit views, and no custom package I could find was able to do this, so I learnt about Revit API and Python and eventually built a custom node to achieve this (most of which uses Python, and can be found in my custom package on my github).
      I would suggest you first learn the fundamentals - definitely watch my 10 part quick tip series which will give you the core skills in Python that you will need for Dynamo Python.

    • @Raja-Raju251
      @Raja-Raju251 4 ปีที่แล้ว +1

      @@AussieBIMGuru Thank you 👌

  • @borun67
    @borun67 2 ปีที่แล้ว +1

    Thanks.👃👃👃👃👃

  • @aliarslan8313
    @aliarslan8313 3 ปีที่แล้ว

    I couldn't find your python template on your github, can you share the path?

    • @AussieBIMGuru
      @AussieBIMGuru  3 ปีที่แล้ว

      github.com/aussieBIMguru/Misc/blob/master/PythonTemplate.py

    • @aliarslan8313
      @aliarslan8313 3 ปีที่แล้ว +1

      @@AussieBIMGuru Thank you so much

  • @Gustavostarke
    @Gustavostarke 2 ปีที่แล้ว +1

    Great lesson.
    I tried to replicate the last but it's not working.. here's my code (should be exaclty like yours)
    Am i missing something?
    Thanks in advance
    ------------
    from random import seed
    from random import random
    rcount = IN[0]
    rseed = IN[1]
    rmin = IN[2]
    rmax = IN[3]
    seed(rseed)
    nums[]
    for r in range(rcount):
    val = rmin + (random() * (rmax-rmin))
    nums.append(val)
    OUT = nums
    --------------

    • @AussieBIMGuru
      @AussieBIMGuru  2 ปีที่แล้ว +1

      The only error I can see is the line nums[] should be nums = []

    • @Gustavostarke
      @Gustavostarke 2 ปีที่แล้ว +1

      @@AussieBIMGuru Thats it! Thanks a lot for replying! Reallly appreciate it.

  • @plaiclaudiamihaela366
    @plaiclaudiamihaela366 2 ปีที่แล้ว

    Tom Geri

    • @AussieBIMGuru
      @AussieBIMGuru  2 ปีที่แล้ว

      Not quite sure what that means, but thanks anyway!