Grasshopper

algorithmic modeling for Rhino

Hello,

I use C# component in grasshopper at a really basic level. I am trying to divide/split a brep surface by a curve and to return splitted brep surfaces. I attached my gh and rhino file. I found some related topics on the forum, I used some of the methods that suggested there, however, I couldn't achieve what I want. Is there anyone who could help me? 

Thanks in advance,

Irem 

Views: 2562

Attachments:

Replies to This Discussion

I attached the gh file that I split the brep surface, yet I cannot return splitted surfaces separately (in Brep suface array)

Attachments:

Brep[] splitResult = B1.Split(B2, 0.1);
A = splitResult[0];
B = splitResult[1];

You can also just split the faces with the curve directly. You only need one component:

private void RunScript(Brep S, Curve C, ref object A, ref object B)
{
  BrepFace face = S.Faces[0];
  Brep result = face.Split(new Curve[]{C}, 0.1);

  A = result.Faces[0].DuplicateFace(false);
  if (result.Faces.Count > 1)
    B = result.Faces[1].DuplicateFace(false);
}

Thank you very much for your reply! It works that way. I tried to apply transformation operations to the result:

private void RunScript(Brep S, Curve C, Point3d pt, Vector3d v, ref object A, ref object B)
{
BrepFace face = S.Faces[0];
Brep result = face.Split(new Curve[]{C}, 0.1);
Brep r1 = new Brep ();
Brep r2 = new Brep ();
r2 = r1.AddSurface(Surface(result.Faces[0].DuplicateFace(false)));
A = r2.Transform(Transform.Rotation(1, v, pt));

//A = result.Faces[0].DuplicateFace(false);
if (result.Faces.Count > 1)
B = result.Faces[1].DuplicateFace(false);
}

but I cant transform the splitted surface like this. How can I do this, and is it possible to join the splitted surfaces after applying transformation? 

Thanks in advance, 

Irem

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service