Add .dll reference to get the Intellisense

I’ve been using this feature of VS with Python and really like it. I’m looking to add the .dll reference to get the intellisense. Did you have any luck adding the Revit API dll?

4 Likes

Hi all,

I’m currently learning to code with python to aid my dynamo scripts (using codecademy), i’ve had a look at visual studio and like the look of the environment, is there a lot more to learn to be able to use VS or is it pretty similar? Would it be better to learn python first then move on to VS, or can i learn python alongside VS?

Apologies if this doesn’t make much sense or this should be posted in a different forum, absolute beginner here!

Yes i understand this, i was just wondering how user friendly it is, and whether it would be better to get a full understanding of python before using vs or something similar like pycharm?

Ok thanks, i’ll give it a whirl.

Did you take a look at pycharm ? It’s way lighter than VisualStudio. Could be a good fit for what you’re trying to do !

2 Likes

@Sylvester_Knudsen1 never managed to. I did some quick research and it seems to be possible but it’s definitely not as simple as it should be …

@Gui_Talarico has worked out a solution here: https://github.com/gtalarico/ironpython-stubs

3 Likes

Seems to work fine with VS Code as well.

14 Likes

@Mostafa_El_Ayoubi agreed. I tried and couldn’t get it to read the RevitAPI or RevitAPIUI dll’s.

I then found this comment by Giulio Piacentino on the Rhino forum about using PyCharm to load the RhinoCommon dll and its not possible. I came to the conclusion that the Revit API may be affected by the same problem cc @Sylvester_Knudsen1

Using Visual Studio is also limited as the references to the libraries need to use full paths (as far as I’m aware) which are not necessary when running the code in Dynamo. Seems like there’s a clear winner here… @Gui_Talarico solution

1 Like

If you’re curious about Dynamo’s current IDE, it is based on an older version of Avalon Edit. You can find the current autocomplete implementation here:

@erfajo if using Atom is an option then you can follow @Gui_Talarico’s step by step directions here.

1 Like

Probably because Revit API libraries are MUCH bigger in size and it simply runs out of allocated memory. I know the same thing happens with pyCharm when you try to load RevitAPI.

1 Like

@Sylvester_Knudsen1 thats as far as I got; I don’t use IDE’s with Python only C# to be honest. However, I have looked into this (finding an IDE for IronPython) before as a means of supporting some new Python users I work with, but the arduous problems I encountered when attempting to load the RevitAPI put the whole thing to bed and I haven’t tried since. It’s why we didn’t use one in the Python workshop a few week’s ago; it opens up a can of worms and is half-baked at best!

If anything, I would recommend using Sublime for the time being, and stick with VS for viewing the RevitAPI/UI and Dynamo libraries as I taught - its about as good as it gets until someone can find a solution.

@Konrad_K_Sobon that’s interesting. Is this verified anywhere? It would be good to get some input from the Dynamo developers on this? I’m surprised by how chronic this problem is and the hindrance it causes. …glad to see I wasn’t alone with the frustration it causes at least.

I think it will be more helpful if you provide more details and tell us at which step do you have an issue? :slight_smile:

1 Like

This feels like it may partially be due to the hindrance of an open source program (Dynamo) being hindered due to the reliance on a close source (Revit) software @Konrad_K_Sobon spoke of on his blog awhile back…

We are talking about Revit API libraries so Dynamo developers can’t do anything about this. Also, there is nothing wrong with a DLL containing a lot of stuff, so I am not sure i would want to bother anyone with this anyways.

The “running out of memory” is not a problem with the DLL, but with pyCharm or Atom. Each of these IDEs has a number allocated for how much stuff it keeps in memory when dealing with AutoComplete. @Gui_Talarico hints at that in his instructions on how to get his solution installed. pyCharm does the same thing. By default it’s set to 2GB and that is not nearly enough to get RevitAPI and RevitAPIUI stubs loaded and good to go. Problem is that even with that number cranked to 10GB it will not handle the whole thing, and that goes back again to what @Gui_Talarico hinted at with Jedi just being a massing resource hog. He also suggested that instead of trying to crawl the whole library we should perhaps use truncated stubs and save our computer resources.

@Thomas_Mahon yes, it’s verified. I am running auto completion in pyCharm for RevitAPI, Revit APIUI and all other Dynamo libraries. It uses the same method that @Gui_Talarico posted - generator3 to create stubs, then load them into pyCharm - but since it’s a little finicky I wasn’t planning on posting it until i figure out a sure fire way to make it work every time. Also, I am on a pyCharm pro, and haven’t gotten it to work on the free version yet, so that’s part of the issue as well. I need to figure out if there is a correlation between that.

I’m trying with Microsoft Visual Studio and an IronPython Application, but is not possible to use de RevitAPI and/or RevitAPIUI references. The Solution Explorer display something like an error/alert icon.

Any idea?

Here’s what I have for pyCharm:

9 Likes

Interesting. I thought these were specific to the Interpreter that you are using. So if you create a new project and use the same IronPython interpreter that should point at the same binary library. Only when you switch to a different interpreter it creates a new folder location for binary skeletons.

Does your solution work for the community edition as well?