Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Revit Methods in VS Code and missing Revit Services and Transactions #29

Open
DwayneAcosta opened this issue Mar 13, 2022 · 7 comments

Comments

@DwayneAcosta
Copy link

Hi!

I have installed the iron stubs against Python v2.7.18 and have edited the settings.json file of Pylance to include extra paths as instructed with linting disabled.

I have intellisense for the basic imports and a few first level codes such as FilteredElementCollector, however, when I do FilteredElementCollector(doc). - after the "." nothing comes out. This is also the same for element.Category for example, nothing comes out as well.

I'd like to ask if this is the case or is there an error somewhere in my set up.

Appreciate the help. Thanks! :D
image

@PavelAltynnikov
Copy link

This is a stub problem. To make it work, you need to go into the code of the stubs, in this case, in the FilteredElementCollector and replace the methods pass with return salf. But only for those methods that return a FilteredElementCollector

@DwayneAcosta
Copy link
Author

DwayneAcosta commented Mar 15, 2022

Hi Pavel, thanks for the help.

I tried going over to FilteredElementCollector.py in stubs.min and changed the .WherePasses method to return self but doesn't work.

However I noticed a new problem and that there are codes in each of the python files that are missing, see below. This problem also persists in a lot of the other python codes in the stubs.min file.

Is this because I downloaded the wrong stub.min file? I actually just downloaded the entire folder in this github page and used what's there.

Thanks again

image

@PavelAltynnikov
Copy link

I don't even know how else to help. Try these stubs, I generated them not so long ago and it seems that in our community they all work with Pylance.
Be sure to read the readme and examples

@DwayneAcosta
Copy link
Author

Hi Pavel,

It finally works, thank you! So it was the stubs after all. If you don't mind, can I ask how you generated the stubs yourself? or perhaps a reference guide that I can read?

Also I noticed that the stub file you sent were divided into sub-folders having different years, are these Revit versions? or are these when the stubs were generated?

Thanks again!

image

@PavelAltynnikov
Copy link

PavelAltynnikov commented Mar 15, 2022

I reworked the gtalarico project a bit, but for the most part the essence remains the same.
Yes, the stubs are separated by Revit versions, in my repository in the readme there are instructions on how to work with them.

@DwayneAcosta
Copy link
Author

Thanks Pavel. Apologies it took me a while to get back to you.

Appreciate the help!

@toothless92
Copy link

Leaving this for others that may find it useful, I have made a script to fix typing issues, see here: #35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants