How to set up Revit API Autocomplete in pyCharm

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

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

  • @korayyardas9801
    @korayyardas9801 22 วันที่ผ่านมา +1

    thank you erik, great explanation!

    • @ErikFrits
      @ErikFrits  22 วันที่ผ่านมา

      Happy to help!

  • @BarettMacLeod
    @BarettMacLeod 5 หลายเดือนก่อน +1

    After installing pyCharm, when I type 'import os' the 'import" is red instead of blue and I get an error "unused import statement 'import os'" did I miss a step?

    • @ErikFrits
      @ErikFrits  5 หลายเดือนก่อน

      I don't think it's an error if you see "unused import statement"
      pyCharm IDE monitors unused variables, imports and other things to notify us that it might be a good idea to clean it up.
      Does python autocomplete work if you keep writing further? (os.path.join() e.g.)

    • @BarettMacLeod
      @BarettMacLeod 5 หลายเดือนก่อน

      @@ErikFrits Yes the autocomplete seems to be working thanks.

  • @MrEjoeb7
    @MrEjoeb7 6 หลายเดือนก่อน +1

    I have added the path for the lib on multiple times and it adds them but then when i go back to the root file path it lost them so i am unable to access them. do you konw why this is?
    is there another way i can add them ? thank you for your time

    • @evg_shamshin
      @evg_shamshin 6 หลายเดือนก่อน +1

      Аналогичная проблема - не получается добавить файл автозаполнения. Сбрасывает путь

    • @ErikFrits
      @ErikFrits  5 หลายเดือนก่อน

      Sorry to hear that!
      pyCharm 2024 seem to give a lot of people this kind of an error...
      I can't explain it or solve, but I heard multiple times that downgrading to pyCharm 2023 helps to solve it and it starts to work as expected!
      Maybe it's because pyCharm 2024 has removed python 2 support or something... Just guessing here

    • @evg_shamshin
      @evg_shamshin 5 หลายเดือนก่อน +1

      @@ErikFrits спасибо, Эрик!
      Вопрос решен! Перестановка IDE на более старую версию дало свои результаты ❤️‍🔥

    • @ErikFrits
      @ErikFrits  5 หลายเดือนก่อน

      @@evg_shamshin Супер! Рад слышать что проблема разрешилась 🥳
      Happy Coding!

  • @abbas_darvishi
    @abbas_darvishi 4 หลายเดือนก่อน +1

    Hi.please share revit api stubs 2025❤

    • @ErikFrits
      @ErikFrits  3 หลายเดือนก่อน +1

      I will share them once pyRevit is supported in Revit 2025 😉

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

    Wow. Thanks for the updated stubs

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

      It was about time to do it 😅

  • @alejandroibarra8335
    @alejandroibarra8335 11 หลายเดือนก่อน +1

    Thanks for that, will the stubs work with python 3.x?

    • @ErikFrits
      @ErikFrits  11 หลายเดือนก่อน +1

      Yes, it's doesn't matter as much what python version we use, because code will be executed using pyRevit's or RevitPythonShells environment.
      We just need any python version and add Revit API stubs so we can code much quicker :)

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

    Ryrevit did not work with my as your in the video , I already added it but pycharm can not recognise it and didnot give me options like you

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

      1. Does your Autocomplete works in general in pyCharm?
      2. Did you provide correct paths?
      Usually if it doesn't work it's one of these things that we need to check.
      If revit api autocomplete works but pyRevit not, then probably it's just a path issue

  • @rgheno
    @rgheno 8 หลายเดือนก่อน +1

    Can I add this autocompletion for the Robot API?

    • @ErikFrits
      @ErikFrits  8 หลายเดือนก่อน

      I am not sure what is Robot API, but if it has its stubs or actual python package, then it will be possible.

    • @rgheno
      @rgheno 8 หลายเดือนก่อน

      @@ErikFrits Sorry, I was referring to Autodesk Robot Structural Analysis API, the structural software from Autodesk. I'm able to have autocomplete when I'm using an ironpython node in Dynamo, but when I use pycharm (or vs code) with ironpython interpreter, the code runs normally, but the autocomplete doesn't work. I don't know where I'd find these stubs for a given software

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

    Hi Erik, thanks for this free module! I had some issues setting up the dev environment but after hours of trial/error i got it to work. Here are some issues others might also encounter:
    1. The python installer did NOT add the python path to the windows system environment variables so i had to add that manually.
    2. I couldn't get the autocomplete stubs to work and was about to give up; the problem was that there where no "__init__.pyi" files in the Autodesk and Revit folders of your stubs package. When i added empty text files named "__init__.pyi" to these folders it finally worked.

    • @Mauro-n4t
      @Mauro-n4t ปีที่แล้ว

      could you be more specific about the solution of autocomplete stubs?
      Thanks

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

      👋 Hi Tommy,
      1. Usually there is a tick box during python installation for that, maybe you missed it.
      2. I am so sorry for this! I have uploaded the wrong folder for stubs.
      You are right, there should be __init__.py file in every folder so python can treat the whole thing as a package.
      I am going to replace folders in OneDrive asap. Thank you for letting me know about it!

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

      @@ErikFrits You're welcome! I also have a question about the full course; if I buy it now can i start whenever i want? The reason I'm asking is I have no experience coding and want to learn some python basics before I start.

  • @fangyu8367
    @fangyu8367 6 หลายเดือนก่อน +1

    Hi Erik,i pasted the interpreter path like video.
    After clicking ok , my path disappeared immediately.
    even i cannot delete origin path.so i cannot type code about revit.
    Is any problem about settings?
    Thanks!

    • @ErikFrits
      @ErikFrits  6 หลายเดือนก่อน

      Hi,
      Sorry to hear that.
      Recently I head from someone that they had the same issue with the latest pyCharm.
      They have installed 2023 verison of pyCharm and it worked.
      I assume there is some weird bug in the newer version that fails to create interpreter for python 2.7, maybe it got too old for new pyCharm...
      So you can try installing older version of pyCharm, or you can also check out VS Code Revit API Autocomplete tutorial. It's another IDE, but it's also very popular and widely used.
      Hope this helps ;)

    • @fangyu8367
      @fangyu8367 6 หลายเดือนก่อน

      @@ErikFrits Thanks a lot~ I've already reinstall 2023 version. It works!

  • @Mauro-n4t
    @Mauro-n4t ปีที่แล้ว +1

    Hi Erik!
    As I told you yesterday, I can't get the autocomple stubs.
    The error that I got is
    "C:\Users\miacuaniello\AppData\Roaming\pyCharm Enviroments\RevitAPI 23\Scripts\python.exe" C:\Users\miacuaniello\Desktop\Mauro\PythonProject\Prova.py
    Traceback (most recent call last):
    File "C:\Users\miacuaniello\Desktop\Mauro\PythonProject\Prova.py", line 1, in
    from Autodesk.Revit.DB import *
    ImportError: No module named Autodesk.Revit.DB"
    Thank you

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

      Hi,
      So based on the error I think you tried to run the script in pyCharm. We shouldn't do that.
      ✅ We use pyCharm or other code editors for writing python code better with Revit API Autocomplete.
      👀 But Code will be executed by using pyRevit, RevitPythonShell or Python Node in Dynamo.
      💡 our Revit API Scripts need a lot more libraries and connection to Revit Application to run, and we can't achieve that from a code editor. That's why we use plugins like pyRevit and RevitPythonShell ;)
      📌 The goal for this video is to add Revit API Autocomplete. So if you get autosuggestions of Revit API classes, then you made it right!
      P.S.
      As someone has pointed out I have uploaded wrong folder as Revit API stubs. (they are missing __init__.pyi files)
      I am going to fix it very soon, and reupload them. Just be aware of that!

    • @Mauro-n4t
      @Mauro-n4t ปีที่แล้ว

      THANK YOU!!@@ErikFrits