Introduction

In this wiki, we will discuss about taking points in curve.

First, we are going to see the available nodes and techniques for this purpose.

Next, we are going to see how GC script can be used in fulfilling some advanced requirements.

**Taking Points on Curve Using Available Node and Technique **

We are going to place points on curve at a particular distance.

For this we use the node **Point**(technique :**ByDistanceAlongCurve**) and utility node **Functioncall**(function used: **series**).

**Part I:**We attach an existing bspline curve to curve input port of point node. Line, polygon, polyline, arc etc. can also be used as the input.

**Part II:**We attach the length of the curve as the input for the limit port of the series function.

Finally, we get the points by attaching **functioncall1** to the **DistanceAlongCurve** port of the point node.

Points on Curve Simple method.gct

**Taking Points in Curve Leveraging GC Script**

In the above example, we have seen taking points at a fixed interval. In this example, the distance between the points will vary with segments of curve.

**Problem Description: **

The distance between the points for first 10km of the curve with be 500m and for the remaining part of the curve the distance will be between the points will be 1000m.

**Solution:**

We are going to write a function in GC script that will return the list of values required.

If you are new to scripting you can refer this SIG video.

This function is as follow

function (double LengthOfCurve, double SegmentLength, double Interval1, double Interval2) //Creating function with required input ports { double pointinterval= {}; //Defining new empty list for storing the values double distance=0; while (distance<=LengthOfCurve) { if (distance<SegmentLength) { distance=distance+Interval1; pointinterval.Add(distance); //Adding values to the list } else { distance=distance+Interval2; pointinterval.Add(distance); } } return pointinterval; }

The value of **SegmentLength** is entered as 10000.

The value of **Interval1** and **Interval2** is entered as 500 and 1000 respectively.

Points on Curve Using GC Script.gct

Related