Skip to content

Filter issue when null #2

@DominicBeer

Description

@DominicBeer

Ensure nulls are set when null is an input - fails if null is last item in a list...

protected override void SolveInstance(IGH_DataAccess DA)
{
IGH_Goo goo = null;
if (!DA.GetData(0, ref goo))
{
return;
}
GH_ObjectivismObject obj;
if (goo is GH_ObjectivismObject ghObj)
{
obj = ghObj;
}
else
{
this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Can only filter ojects built with Objectivism");
return;
}
TypeNames.Add(obj.Value.TypeName);
foreach ((int i, var param) in Params.Output.Enumerate())
{
string name = param.NickName;
if(obj.Value.TypeName == name)
{
DA.SetData(i, obj);
}
else
{
DA.SetData(i, null);
}
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions