Warning: Multiple definitions for Revit.Elements.Element found

Hello,

My Dynamo script was working perfectly earlier today. I downloaded the Orchid package this afternoon and initially I got the following error:

Warning: Multiple definitions for ‘Revit.Elements.Element’ are found as Revit.Elements.Element, Orchid.Revit.Elements.Element
No property called Elements on null could be found

Now for whatever reason I get:

Warning: Variable ‘Revit’ hasn’t been defined yet

I Googled the error, but I can’t find any threads on either of the keywords.

Image below and .dyn attached.


RevitExcel DS.dyn (25.4 KB)

Any assistance would be highly appreciated.

Kind regards,
Connor

2 Likes

Your issue is that you have multiple methods with the same name… Nothing to do with the Orchid package… Simply add DSCore. in front of the affected pieces of code… Start with the “Element” then do the same to the “List” etc.

That is the risk when mainly using code-blocks instead of nodes :slight_smile:
See this discussion to further understand what it is you’re facing:

4 Likes

Thanks @Jonathan.Olesen. Sorry for the delayed response - it was a long weekend :slight_smile:

Thanks for the link to the post about methods and names, it makes good sense. @m.rijsmus actually assisted me with DS previously and had DSCore. infront of his lines, and now I know why :). I have made adjustments accordingly, but it still isn’t behaving as expected. Can you please guide me as to what is still wrong with my code?

Referring to the Dynamo Script attached:

  1. The code block at the top is not producing a warning, but my getParam line is feeding out a null value? Everything else after that fails, could you advise as to why?

  2. The code block at the bottom was created straight from Node to Code, with DSCore.Revit.Elements. added in front of Element.GetParameter. This same code works as a node structure. It however is feeding out a null value after node to code with a “Warning: Internal error, please report: Dereferencing a non-pointer.” notification?

PS: Congratulations on the recent completion of your thesis. It looks highly impressive and I look forward to going through it when I am better versed in Dynamo. :slight_smile:

1 Like

No problem, the reason for this is that the namespace for the “GetParameterValueByName” is a Revit related instance rather than a Dynamo one…
This, I know, is confusing… But bear with me…
The only way I’ve found to get around this is not by specifying in the code exactly the package you want to utilize (I know several packages use “Element” namespace (Archilab, Wombat, Orchid) to name a few.

The way to “get around it” would be to write:
Elem<1>.GetParameterValueByName(param<2>);
image
Utilizing a method not available in the custom packages but only in the integrated OOTB one.

This will, confusing as it may be remove the unwanted “DSCore” input in your codeblock:

6 Likes

Day made.

I tried Autodesk.Revit. amongst others previously, but couldn’t get it resolved.

Utilizing a method not available in the custom packages but only in the integrated OOTB one.

Quite interesting - how on Earth did you figure that one out? Haha.

It all makes sense in the end. :slight_smile:

Thanks a lot!

Cheers.

I used the “Node to code” option…
(Sidenote, it didn’t work in Dynamo 2.x so had to go back to 1.3.x to find the method) :slight_smile:

1 Like

I’m having this same issue, having re-installed Orchid (which is excellent). Given I’ve used plenty of code blocks across our dynamo script library, I’m going to uninstall Orchid again and give up on certain functions for Dynamo.

I did fire up Dynamo 1.3 and do some node to code, which works as @Jonathan.Olesen kindly noted above. But, it just seems like if I fix everything, it could just as easily be broken by the next thing. I was using code blocks to really compress my scripts but will go back to nodes for everything I guess.

Can someone explain why some packages cause this issue and not others as I’m still getting my head around it all?
Capture
In the above image, pretty much every individual line gets an error as currently written. Yesterday it was fine :frowning:

The “solution”/answer to your question have to do with namespaces within the packeges you have. The best way is to always define the namespace you’re in.

It is quite well explained in this thread:

1 Like

Appreciate the reply, and I had looked at your example (which helps greatly with my understanding thank you!). I suppose I’m just surprised that I need to get more specific to call the OOTB functions - but I can see now the mechanics of it all. Thanks for you help!

DSCore. does not seem to work in Dynamo 2.12 (Revit 2022). Any ideas if this got changed? I had to use Autodesk.DesignScript.Geometry.

Nice :smiley: thanks! it works