Problem with DropDown

Im only use a class for one problem and create for 1 node .

try removing the “.” from the name space and give your namespace a name that is the same or close to your assembly name

I tried . and remove .MEP But Same Problem

then i think you can create another “baseclass” that inherits RevitDropDownBase queries all the element type based on the type that it is fed.

try this:

[NodeName("Duct Types")]
[NodeDescription("Get All Duct Type From Model Dropdown")]
[NodeCategory("DynaMEP.MEP.Ducts")]
[IsDesignScriptCompatible]
public class DuctTypes : GenericGetAllElementOfTypeDropDown
{
    private const string outPutName = "Duct Type";
    private const string NO_DUCT_TYPES = "No Duct Types Found.";

    public DuctTypes() : base(outPutName, NO_DUCT_TYPES, typeof(DuctType)) { }

    [JsonConstructor]
    public DuctTypes(IEnumerable<PortModel> inPorts, IEnumerable<PortModel> outPorts) : base(outPutName, NO_DUCT_TYPES, typeof(DuctType), inPorts, outPorts) { }
}

public class GenericGetAllElementOfTypeDropDown : RevitDropDownBase
{
    private string NO_TYPE_FOUND { get; set; } = "No Type Found";
    private Type ClassType { get; set; }
    private SelectionState _selectionState = SelectionState.Done;

    public GenericGetAllElementOfTypeDropDown(string name, string noEnumFound, Type enumType) :
        base(name)
    {
        this.ClassType = enumType;
        this.NO_TYPE_FOUND = noEnumFound;
        PopulateDropDownItems();
    }

    [Newtonsoft.Json.JsonConstructor]
    public GenericGetAllElementOfTypeDropDown(string name, string noEnumFound, Type enumType, IEnumerable<PortModel> inPorts, IEnumerable<PortModel> outPorts) :
        base(name, inPorts, outPorts)
    {
        this.ClassType = enumType;
        this.NO_TYPE_FOUND = noEnumFound;
        PopulateDropDownItems();
    }

    public void PopulateDropDownItems()
    {
        if (this.ClassType != null)
        {
            // Clear the dropdown list
            Items.Clear();
            Items.Clear();

            Dictionary<int, string> eleNameInt = new Dictionary<int, string>();

            using (FilteredElementCollector col = new FilteredElementCollector(DocumentManager.Instance.CurrentDBDocument).OfClass(typeof(DuctType)))
            {
                var eles = col.ToElements();
                if (!eles.Any())
                {
                    Items.Add(new DynamoDropDownItem(NO_TYPE_FOUND, null));
                    SelectedIndex = 0;
                    _selectionState = SelectionState.Done;
                }
                foreach (var ele in eles)
                    eleNameInt.Add(ele.Id.IntegerValue, ele.Name);
            }

            Items = eleNameInt.Select(x => new DynamoDropDownItem(x.Value, x.Key)).OrderBy(x => x.Name).ToObservableCollection();
            _selectionState = SelectionState.Restore;
        }
    }

    protected override SelectionState PopulateItemsCore(string currentSelection)
    {
        PopulateDropDownItems();
        return _selectionState;
    }

    public override IEnumerable<AssociativeNode> BuildOutputAst(List<AssociativeNode> inputAstNodes)
    {
        if (!CanBuildOutputAst(NO_TYPE_FOUND))
            return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) };

        List<AssociativeNode> args = new List<AssociativeNode>()
        {
            AstFactory.BuildIntNode((int)Items[SelectedIndex].Item),
            AstFactory.BuildBooleanNode(true),
        };

        Func<System.Int32, System.Boolean, Revit.Elements.Element> func = new Func<System.Int32, System.Boolean, Revit.Elements.Element>(Revit.Elements.ElementSelector.ByElementId);

        AssociativeNode callFunctionNode = AstFactory.BuildFunctionCall<System.Int32, System.Boolean, Revit.Elements.Element>(
            Revit.Elements.ElementSelector.ByElementId,
            args
            );

        BinaryExpressionNode assign1 = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), callFunctionNode);

        return new[]
        {
            assign1
        };

        bool CanBuildOutputAst(string itemValueToIgnore = null, string selectedValueToIgnore = null)
        {
            if (Items.Count == 0 || SelectedIndex < 0)
                return false;
            if (!string.IsNullOrEmpty(itemValueToIgnore) && Items[0].Name == itemValueToIgnore)
                return false;
            if (!string.IsNullOrEmpty(selectedValueToIgnore) && Items[SelectedIndex].Name == selectedValueToIgnore)
                return false;
            return true;
        }
    }

}

Same Problem

The ‘+’ character, hexadecimal value 0x2B, cannot be included in a name