Creating Package that contains both Zero touch & Custom UI nodes in Visual Studio c#

Hi!

I’m wondering if it’s possible to create a package that has the following structures:

Category
SubCategory
NodeA(Zero Touch Node)
NodeB(Custom UI Node using WPF)
NodeC(Zero Touch Node)

Where I’m mixing the use of zero touch nodes and custom UI nodes and still have the structure above.

Thanks

Its possible, but not within the same Visual Studio project as you cannot mix Zero Touch with MVVM (assuming that’s the object model you plan to use with WPF).

If you use the same namespace (what you call ‘category’) and class (what you call ‘subcategory’) in both libraries, the resultant nodes will be organised in the Dynamo library together in the structure you need. Alternatively, you can override the organisation of nodes in the library using the DynamoCustomizations.xml. If you download the Mesh Toolkit from the package manager, you can examine its xml from the root directory as an example.

1 Like

Thanks Thomas. I’m using the customization xml right now and it’s working great. It’s just a bit unfortunate that the project needs to be splited between zero touch and “WPF Nodes”. But I guess there are no other workarounds.

I don’t see why they couldn’t be mixed as part of the same DLL, allowing you to order them as you wish.
Yes, the WPF one would have to call functionality from a separate DLL (from what I understand, @teocomi might want to confirm) but if you’re willing to split the code like that, it’s doable :slight_smile:

You can’t compile if MVVM and ZT are mixed in one project. I believe it’s a limitation in Dynamo’s node model

Can’t confirm as I haven’t tried but the Dynamo
Library itself mixes and matches them so it should be possible.

All I know is (for some reason) the method called in the nodemodel needs to be in separate assembly, see @teocomi hello world sample
https://github.com/teocomi/HelloDynamo

I can confirm, as I’ve tried it, and it doesn’t work! :wink:
Dynamo must have separate dll’s also. I think this limitation is documented somewhere on the github.

On the note of separate dlls, I have realized that if I use methods from a referenced external dll, I get an error saying dereferencing a non-pointer, where as if I create a function in another assembly in my project which does nothing else than calling my method, then it works. I find that quite strange. Any thoughts?

:+1: just had a look at repo and they are in separate projects indeed, at least the Core.Web namespace that I’m familiar with.

Quick question: Is it allowed to have a zero touch project and a custom UI node project in the same solution?

Because when I try, I can get it to compile but strange things happen.

I answered my own question through trial and error. It’s possible to do this :slight_smile:

If you care to share, I would love to see how you achieved it.

Create two projects (ZeroTouch and NodeModel) in one solution.

In the ZeroTouch program, find the DynamoCustomization.xml:

<?xml version="1.0"?>
<doc>
  <assembly>
    <name>Put your namespace here</name>
  </assembly>
  <namespaces>
    <namespace name="Put your namespace here">
      <category>PackageName.OptionalSubPackageName</category>
    </namespace>
  </namespaces>
</doc>

Then, your custom Dynamonodes should be put in a class that has the name of the category you want.

In the NodeModel program, add to each node you create:

[NodeName("Category.NodeName")]
[NodeCategory("PackageName.OptionalSubPackageName", ElementCategory = "PackageName.OptionalSubPackageName")]

Where the Category name is of course the same as with the ZT package.

I think you have to include the .customization node libraries in your pkg.json files in both programs as well, but I’m not 100% sure.

Hope this helps

1 Like