protected override void SolveInstance(IGH_DataAccess DA) { Curve cv1 = null; DA.GetData("curve", ref cv1); Curve cv2 = null; Curve cv3 = null; Surface srf = null; DA.GetData("srf", ref srf); //srf.ToBrep(); Brep b = null; b = srf.ToBrep(); BrepFace bf = null; bf = b.Faces[0]; Curve[] cvs = new Curve[0]; double s = new double(); if ((DA.GetData("strength", ref s)) == false) { s = 0.05; } double it = new double(); DA.GetData("iterations", ref it); // double r = new double(); DA.GetData("range", ref r); SmoothingCoordinateSystem sm = new SmoothingCoordinateSystem(); for (int i = 0; i < it; i++) { //int num = new int(); num = cv1.SpanCount; cv2 = cv1.Smooth(s, true, true, true, true, sm); //cv2 = cv1; cvs = Curve.PullToBrepFace(cv2, bf, 0.01); cv1 = cvs[0]; cv1 = cv1.Fit(3, 0.1, 0.0); } DA.SetData("curve", cv1); }
protected override void SolveInstance(IGH_DataAccess DA) { Curve cv = null; Curve cv1 = null; double sm = new double(); double it = new double(); /* bool x = new bool(); x = true; * bool y = new bool(); y = true; * bool z = new bool(); z = true; * // Plane pl = new Plane(); pl = Plane.WorldXY;*/ DA.GetData("curve", ref cv); DA.GetData("factor", ref sm); DA.GetData("iterations", ref it); /* DA.GetData("smooth-X", ref x); * DA.GetData("smooth-Y", ref y); * DA.GetData("smooth-Z", ref z); * DA.GetData("referencePlane", ref pl); */ SmoothingCoordinateSystem pl = new SmoothingCoordinateSystem(); for (int i = 0; i < it; i++) { cv1 = cv.Smooth(sm, true, true, true, true, pl); cv = cv1; } DA.SetData("curve", cv1); }
protected override void SolveInstance(IGH_DataAccess DA) { Surface s1 = null; DA.GetData("surface", ref s1); s1.ToNurbsSurface(); //NurbsSurface s2 = null; s2 = s1; double st = new double(); DA.GetData("strength", ref st); double it = new double(); DA.GetData("iterations", ref it); SmoothingCoordinateSystem pl = new SmoothingCoordinateSystem(); Surface s2 = null; bool t = new bool(); DA.GetData("fixed", ref t); for (int i = 0; i < it; i++) { s2 = s1.Smooth(st, false, false, true, t, pl); // s1.Smooth(st, true, true, true) s1 = s2; } DA.SetData("smoothSurface", s1); }