Simple C# Component


#1

Hi,

I do not really understand how to use the BuildOutputAst. Let say I just want to create a simple with 3 inputs x,y,z and from that I want to create a point. I know I can create this with the ZeroTouch but I will need the component to have an GUI.

 
[IsDesignScriptCompatible]
[NodeName(“Lines To SmartMesh”)]
[NodeCategory(“Core.Color.Create”)] // Need to change this
[NodeDescription(“Converts a set of Lines into a SmartMesh.”)]
public class CreatePoint : NodeModel
{

public LinesToSmartMesh(WorkspaceModel workspace)
:base(workspace)

{
InPortData.Add(new PortData(“x”, “Set of lines to be converted.”));
InPortData.Add(new PortData(“Y”, “Set of lines to be converted.”));
InPortData.Add(new PortData(“Z”, “Set of lines to be converted.”));
OutPortData.Add(new PortData(“Pt”, “Converted SmartMesh.”));

RegisterAllPorts();

}

public override IEnumerable<AssociativeNode> BuildOutputAst(List<AssociativeNode> inputAstNodes)
{
}

}

}

 

How do I get the information from the inputs and how do I return something to the output?

All the best,

-Miguel


#2

Hi Miguel,

this may help you:

 


#3

Hi Michael,

thank you for the link. I have already read this link, but it is still unclear to me how to use “public override IEnumerable<AssociativeNode> BuildOutputAst(List<AssociativeNode> inputAstNodes)”

 

-Miguel


#4

Hey Miguel, I don’t have great internet now, so won’t be able to respond for a while, but if you post this same question to github, you may get a more immediate response. If you scroll down in that link to where I discuss UI nodes, you can see theres a call to assign output index() or something like that. That assigns some computation to an output port by index from top to bottom of the node.

The IEnumerable of inputAstNodes represents the previous computations that will be streaming into the node. Thats my limited understanding anyway.