Hello,
I am using GenerativeComponents Update 8 (10.08.00.40).
I am trying to build upon the C# Sample Solution to create a Generative Component in C# which produces a PointNode as an output parameter but I am having no success and I cannot locate the SDK documentation for the GC Object Model. Please see a simple conceptual example for a generative component which takes two points and a coordinate system as inputs, and should provide a point node as an output that can be used for other purposes.
public class MidpointTestNode : ElementBasedNode { [GCDefaultTechnique] public NodeUpdateResult Default ( NodeUpdateContext updateContext, [GCDgnModelProvider] CoordinateSystemNode InputCoordSystem, IPointNode StartPoint, IPointNode EndPoint, [GCOut] ref PointNode MidPoint ) { // check inputs for validity if (StartPoint == EndPoint) return new NodeUpdateResult.TechniqueInvalidArguments(nameof(StartPoint), nameof(EndPoint)); DPoint3d startPt = StartPoint.GetDPoint3d(); DPoint3d endPt = EndPoint.GetDPoint3d(); DPoint3d uorStartPt = NativeDgnTools.FromMUToUOR(startPt); DPoint3d uorEndPt = NativeDgnTools.FromMUToUOR(endPt); // get the midpoint of the two input points DPoint3d midPt = 0.5 * (uorStartPt + uorEndPt); // create the midpoint node as an output MidPoint = new PointNode(); MidPoint.FromDPoint3d(midPt); // <-- this generates a NullReferenceException return NodeUpdateResult.Success; } }
I am guessing that I am supposed to use one of the static methods like PointNode.CreatePointNode() or PointNode.CreateConstituentNode() but without the SDK documentation or any sample code to adapt, I am not sure how to use them.
Can someone provide an example of how to return a Point node as an output parameter?
Regards,
Trevor