Error (CS1503) in visual studio when compiling a grasshopper project

Hello,
please tell me I created the code in visual studio, but when checking compilers, I get an error

Do I need to process the list in a loop back or how to do it differently? Please tell me how to fix the code?

image

“Error (CS1503): Argument 1: cannot convert from ‘Rhino.Geometry.Point’ to ‘Rhino.Geometry.Point’”

protected override void SolveInstance(IGH_DataAccess DA)
    {
        var points = new List<Point>();

        if (!DA.GetDataList(0, points)) return;

        List<Curve> Circle1 = new List<Curve>();
        Circle1 = CurveBig(points);

        DA.SetDataList(0, Circle1);
    }

    //private CurveBig(List<Point> points)
    //{
    //throw new NotImplementedException();
    //}

    public Circle CurveBig(List<Point3d> points)
    {
    }

Why not using Point3d instead?

protected override void SolveInstance(IGH_DataAccess DA)
{
    var points = new List<Point3d>();
    if (!DA.GetDataList(0, points)) return;
    var circle = CurveBig(points);
    DA.SetData(0, circle);
}
public Circle CurveBig(List<Point3d> points)
{
    //...
}
1 Like

Thank you very much for your answer, you mean like this?

image

or something else? Can you tell me how best to do it?

Point3d is a type name. You don’t need to change the variable name. I recommend you to go through C# basics first.

1 Like

I looked at the c # help and it seemed like I found a working construction, but the result in the node is not output at all
Can you please tell me how to finish such a structure, or what am I doing wrong?

EROOR1

    protected override void SolveInstance(IGH_DataAccess DA)
    {
        List<Point3d> points = new List<Point3d>();
        List<Circle> Circle1 = new List<Circle>();

        if (!DA.GetDataList(0, points)) return;

        foreach (Circle C in Circle1)
        {
            Circle1.Add(CurveBig(points));
        }

        

        DA.SetDataList(0, Circle1);
    }

    //private CurveBig(List<Point> points)
    //{
    //throw new NotImplementedException();
    //}

    public Circle CurveBig(List<Point3d> points)
    {
    }

List<Circle> Circle1 = new List<Circle>();
This line creates an empty list of circles.

foreach (Circle C in Circle1)
This line iterating over that empty list.

1 Like

thanks for the answer

    foreach (Circle C in Circle1)
    {
        Circle1.Add(CurveBig(points));
    }

doesn’t this construct add meaning after the point processing?

maybe someone will tell me how this can be done, I could not find the answer myself? :roll_eyes: :disappointed_relieved:

What exactly do you want to archieve?

2 Likes

Your data does not seem to match

List<Point3d> points = new List<Point3d>();
List<Circle> Circle1 = new List<Circle>();

if (!DA.GetDataList(0, points)) return;

Circle1.Add(CurveBig(points));
    
DA.SetDataList(0, Circle1);

CurveBig takes a list of point3d objects and outputs a single circle. Therefore you need the entire list of points in the function and not just a single point like how you planned to send the data in.

2 Likes

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

The problem we have is that nobody knows what the CurveBig function does so until you explain what it does or post the code for it, there is no way of helping you.

1 Like

thank you very much for the answer, I should have published the code right away :innocent: :grinning:

  public static Circle CurveBig(List<Point3d> Triangle) {
        Circle circle = new Circle();
        Point3d item = Triangle[0];
        double num = item.DistanceTo(Triangle[1]);
        item = Triangle[1];
        double num1 = item.DistanceTo(Triangle[2]);
        item = Triangle[2];
        double num2 = item.DistanceTo(Triangle[0]);
        double num3 = (num + num1 + num2) / 2;
        double num4 = Math.Sqrt(num3 * (num3 - num) * (num3 - num1) * (num3 - num2));
        double num5 = 2 * num4 / (num + num1 + num2);
        circle.Radius = (num5);
        double num6 = Vector3d.VectorAngle(Triangle[1] - Triangle[0], Triangle[2] - Triangle[0]) / 2;
        double num7 = 1 / Math.Sin(num6) * num5;
        Vector3d vector3d = Triangle[1] - Triangle[0];
        Vector3d item1 = Triangle[2] - Triangle[0];
        vector3d.Unitize();
        item1.Unitize();
        Vector3d vector3d1 = vector3d + item1;
        vector3d1.Unitize();
        vector3d1 *= num7;
        Point3d point3d = Triangle[0] + vector3d1;
        Vector3d item2 = Triangle[2] - Triangle[1];
        Vector3d vector3d2 = Triangle[1] - Triangle[0];
        item2.Unitize();
        vector3d2.Unitize();
        Vector3d vector3d3 = Vector3d.CrossProduct(item2, vector3d2);
        circle.Plane = (new Plane(point3d, vector3d3));
        return circle;
    }

Are you trying to create multiple circles, or single circles.

From AlexWer’s post which might be deleted by now, it looked like there is a large list of points and you want to output a list of circles for each set of three points in the list.

But that is just a guess. You will need to explain the use case for the project.

1 Like

My guess is you want to add the circles to the list, like this:

List<Circle> circles = new List<Circle>();
    circles.Add(CurveBig(pts));

Edit: I just saw it was already proposed by @christopher.ho

1 Like

yes, you need a separate circle line for each set of points, you understood everything correctly :grinning:

On the assumption that the list is in sets of 3 points such that it should be a multiple of 3 values:

for(int i = 0; i < Math.Floor(points.Count()/3.0);i++)
{
    Circle1.Add(CurveBig(new List<Point3d>(){points[i*3],points[i*3+1],points[i*3+2]}));
}
1 Like

christopher.hoThank you for your help, what you need !!! :+1: :handshake: