Add .dll reference to get the Intellisense


#1

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?


Python IDE
Intellisense step by step configuration on visual studio code
Python IDE
Python IDE
#2

I am trying to figure out how to get most out of using ‘Visual Studio Code’.

Before today I had all my python code I have made in nodes saved as .txt files since it was easier to walk through if I needed to copy something. All these files are now renamed to .py files that now opens default with VSC.

When I have tried to change something it comes with the proper suggestion, so until now it is much much better than it has been at any point in the time I have coded anything for dynamo.

When I am going to develop anything in the future concerning python, I will surely use @Konrad_K_Sobon trick reading a .py file, and gain all the benefits from having a much better IDE.

If it can be expanded to include intellisense for revit .dll files and ironpython, then it would be really great :slight_smile:


#3

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!


#4

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.


#5

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.


#6

In my opinion Visual Studio is too comprehensive if you only need to ‘code’ some python scripts, thats why I am looking for a lightweight IDE like Visual Studio Code. I dont need anything else than a simple editor but I would prefer to have intillisense… and I have not figured how this could be implemented for IronPython 2.7.3, Revit API, Dynamo API and DesignScript in VSC yet.


#7

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 !


#8

@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 …


#9

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


Python autocomplete?
#10

Seems to work fine with VS Code as well.


Python autocomplete?
Splitting topics and locking is poorly administered
#11

Thanks for the hints, but I will have to wait until someone makes the complete step by step guide from scratch… I simply have to give up. I cant find the coherency or meaning in all those different links I am being directed in.
Using hours on this and still nothing works, is so much waste of time.

Why it isnt easy to do is a mystery to me. Installing a lightweight environment should be so easy that we “spare time coders” should be able to get it going easily.
That is clearly not the case, and that is really making the range of action smaller for many not just me.


#12

@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


#13

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:


#14

thanks @Dimitar_Venkov, but by now have I figured that it is out of my league to get this going… I have to do dumb lookup and code by reading the python webpage and the Revit API page. God should know that I would wish it was differently, but I simply don’t have the needed skills to understand how to set up the IDE environment in VSCode or anywhere else. I am wasting to much very valuable time in trying.

I have lost this battle, thats is how it is :-S


#15

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


#16

@Mostapha
That is the link @Konrad_K_Sobon revealed and @Gui_Talarico followed up upon… and I answered. So instead of running in circles, let me recap… it still doesnt work for me :-S


#17

Thank you for the folow up @Thomas_Mahon!
kinda sucks you cant do that in pycharm…

I’ve been trying to get this working i Visual Studio, but i can only get Dynamo libraries to work, when using the “search Paths” and specifing the “C:\Program Files\Dynamo\Dynamo Core\1.3” folder it works perfectly.

But when i try the same with Revit libraries using the “C:\Program Files\Autodesk\Revit 2017” folder, it fails!
maybe this is more complicated then i hope, but do you know why this is?


#18

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.


#19

@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.


#20

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: