Code Block "Categories.ByName" error

How does one write Category.ByName in the Code Block with multiple packages installed? For me it shows error like this:

Warning: Multiple definitions for ‘Revit.Elements.Category’ are found as Revit.Elements.Category, Rhythm.Revit.Elements.Category
Multiple definitions for ‘Revit.Elements.Category’ are found as Revit.Elements.Category, Rhythm.Revit.Elements.Category
‘archilab.Revit.Elements.Elements.Category’ is not a static property
Internal error, please report: Dereferencing a non-pointer.

grafik

use Autodesk namespace

Still it doesnt work

Please guide me if I am missing anything.

grafik

Try node to code (warning this may cause a crash).

apologies, these nodes are actually not in the Autodesk namespace - unfortunately:

the full namespace is Revit.Elements… @Aparajit_Pratap is there a solution here besides using the node?

1 Like

Apparently it doesnt work for this node.

try it on Category.ByName (I think you’ll probably get the same error)

gives the same error.

Hi @Raja

Which Rhythm version your using?

Hi @Kulkul version 2018.9.7

@Raja Uninstall your current version and install Rhythm version 2019.4.25 should resolve your issue.

@Kulkul it works flawlessly. Thanks a lot :slight_smile:

grafik

You’re Welcome!

1 Like

With the namespace conflicts existing with @Raja’s setup of installed packages, unfortunately there is no way that Dynamo can uniquely resolve the class “Category”. The warning on the node indicates there is a conflict between “Revit.Elements.Category” and “Rhythm.Revit.Elements.Category” so no matter what prefix you use:
“Revit.Category”
“Elements.Category” or
“Category”,
all the above combinations will conflict with Rhythm as they could apply to the “Category” class in Rhythm as well. The only way is what @Kulkul suggested, to uninstall Rhythm or use a later version that has renamed these namespaces (which I think is what was done).

3 Likes