Zero touch - multi return. Unexpected input

Hi,

I’m trying to create a zero touch node that outputs multiple revision settings. However, I’m getting two separate nodes one with revision settings and other with all the properties

I’m not sure why they are separate?

Here’s my code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Revit.DB;
using Autodesk.Revit.ApplicationServices;
using Autodesk.DesignScript.Runtime;
using RevitServices.Persistence;
using RevitServices.Transactions;
using Revit.Elements;



namespace Revit
{
    public class Revisions
    {

        public static Document doc = DocumentManager.Instance.CurrentDBDocument;
        Double Spacing = RevisionSettings.GetRevisionSettings(doc).RevisionCloudSpacing * 304.8;
        RevisionNumbering Numbering = RevisionSettings.GetRevisionSettings(doc).RevisionNumbering;
        IList<string> revSequence = RevisionSettings.GetRevisionSettings(doc).GetAlphanumericRevisionSettings().GetSequence();
        int revStartNo = RevisionSettings.GetRevisionSettings(doc).GetNumericRevisionSettings().StartNumber;
        string revAlphaPrefix = RevisionSettings.GetRevisionSettings(doc).GetAlphanumericRevisionSettings().Prefix;
        string revAlphaSuffix = RevisionSettings.GetRevisionSettings(doc).GetAlphanumericRevisionSettings().Suffix;
        string revNumPrefix = RevisionSettings.GetRevisionSettings(doc).GetNumericRevisionSettings().Prefix;
        string revNumSuffix = RevisionSettings.GetRevisionSettings(doc).GetNumericRevisionSettings().Suffix;

        [MultiReturn(new[] { "Spacing", "Numbering", "revSequence", "revStartNo", "revAlphaPrefix", "revAlphaSuffix", "revNumPrefix", "revNumSuffix" })]
        public Dictionary<string, object> DocumentRevisions() => new Dictionary<string, object>
                {
                    { "Spacing",Spacing },
                    { "Numbering",Numbering},
                    { "revSequence",revSequence},
                    { "revStartNo",revStartNo},
                    {"revAlphaPrefix",revAlphaPrefix},
                    {"revAlphaSuffix",revAlphaSuffix},
                    {"revNumPrefix",revNumPrefix},
                    {"revNumSuffix",revNumSuffix}
                };


    }
    
}

You need to make your method static so it doesn’t require and instance of your Revisions class. The unexpected node is there becuase every class in C has a constructor, hence you see it in the library (Create nodes = constructors). To prevent this, declare your own default constructor and set its access level to private; this will prevent it from importing (and therefore appearing in the library as a node).

All of the above is explained in the document I linked here, plus it will resolve your other issues too:

5 Likes

Thanks, I’ll try that.
Thank you for sharing the link

Another good reference here.