[Solved] Intellisense not working for imported .net library


(IVELIN PEYCHEV) #1

Namely this is MathNet.Numerics

after importing it according to using-math-net-numerics-in-ghpython

I noticed that Intellisense is not working for the imported dll.

Then I tried searching through it with dir() and help():

For native commands it works:

EDIT:
While googling the issue I found this https://github.com/Microsoft/PTVS/issues/1149

Could this be the same issue, and in fact the problem is inside MathNet.Numerics not defining namespace properly?

Is there different way to import .net library to get Intellisense working?


(Giulio Piacentino) #2

By ‘Intellisense’ do you mean dir() and help()?

If so, it’s likely. A single .dll contains many equivalents to IronPython ‘modules’ (aka namespaces), therefore dir and help will probably have to target single classes.
Also, they might just not work awesomely, as they do for standard Python types, but I haven’t seen that so far.


(IVELIN PEYCHEV) #4

By Intellisense I mean Intellisense

I cannot add picture of something that doesn’t exist right?

When I type I don’t get a list of all the functions available in the dll.

dir() and help() were the alternative to see the list of the functions available.


(Giulio Piacentino) #5

Is this what you are not getting?

image


(IVELIN PEYCHEV) #6

Thanks @piac, it was my mistake.

I now placed the dll in a folder that doesn’t depend on the user.

Another thing I noticed is that you have to click OK or TEST in order for it to get the path and respectively the dll. Is there another way to include it into the code so that it acts more native?


(Giulio Piacentino) #7

At present, no “intellisense” will happen till the module is loaded. It will be loaded once clr.AddReference__() will be executed. You can understand all implications here. These are the advantages and disadvantages of working directly with a compiled .Net library…

Thanks,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com


(IVELIN PEYCHEV) #8

Hi Giulio,

I was thinking more of a solution like this:

in path C:\Users\User\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\IronPython (xxxxxx-xxx-xxx-xxxx-xxxxxxxx)\settings\lib

creating something like:
2018-05-17%2021_18_34-lib

2018-05-17%2021_19_40-mathnet

2018-05-17%2021_20_05-

2018-05-17%2021_21_03-C

This way theoretically it should be possible to be imported more natively.

Unfortunately, I’m too much of a python noob, and don’t know Rhino.IronPython architecture to be successful in this task.

If you can help me, it will be great.
If not…well, I’ll continue struggling and after a few crashes and periods of giving up and starting again, I’ll probably end up figuring it out. :rofl:


(Giulio Piacentino) #9

This is not an “import” problem and should not be treated as an “import” problem. This is related to “loading” the assembly. That’s why the assembly cannot autocomplete before the first clr.AddReference() method call succeeds.

Once you know more about .Net, you’ll see that “Adding a reference” is not the same as “Importing” a namespace. For example, the C# Scripting components have an obscure interface to add references, that most users ignore and that is not really easy to use, either. The “clr” pseudo-namespace is actually more useful in Python, because it can be programmed.

That being said, when you have a problem to solve, I’ll be happy to help.
Thanks,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com


(IVELIN PEYCHEV) #10

I see.
Thanks for making this more clear.