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?
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!
It is two different things you are asking for…
Python and C# are languages while ‘Visual Studio’ and ‘Visual Studio Code’ are tools (IDE)
So it doesnt matter in which order you learn it, since they will not compete against each other.
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 !
@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 …
@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
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:
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.
@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?
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.
SOLUTION - PART 2… here is the explanation how to do it
I have marked @Gui_Talarico as giving the solution. Since this thread came from the Python IDE post concerning lightweight IDE environment especially VSCode and not issues concerning Visual Studio…
Just to follow up… I have got a solution and a special thanks go to @Gui_Talarico and @Kulkul
Step by step guide -> https://www.useloom.com/share/72588e78e6cc4d65a8a294b84ed2dee1
You need to install “native” Python ( https://www.python.org/downloads/release/python-2713/ )
I took the 2.7.13 version, but the 3.6 version should work also…
My settings in VSCode ended up like this:
//Python "python.linting.enabled": false, "python.linting.pep8Enabled": false, "python.pythonPath": "C:\\Program Files\\Python27\\python.exe", "python.autoComplete.extraPaths": ["C:\\Users\\erfajo\\.vscode\\stubs.min"], "python.autoComplete.preloadModules": [ "Autodesk.Revit.DB", "Autodesk.Revit.UI" ]
The important part is the “python.pythonPath” and “python.autoComplete.extraPaths”. The rest of it I copied from @Gui_Talarico while he had that in his settings… they should not be needed
Thats that… so simple… but only if you are a real good coder you would figure that IronPython didnt support the solution… I would never have guessed that, so thanks a lot to both @Gui_Talarico and @Kulkul
Here’s what I have for pyCharm: