I am using sweep 2 on this geometry which I have given below to get a surface from sweep. Dont know why its giving a false surface.
my input model
what I want
What I am getting
Here is the 3dm file
input:
squareoverhang1.3dm (72.3 KB)
output
squareoverhang2.3dm (107.5 KB)
here is my code
RhinoDoc activeDoc = RhinoDoc.ActiveDoc;
IEnumerable brepObjects1 = activeDoc.Objects.GetObjectList(ObjectType.Brep);
RhinoObject object1 = brepObjects1.ElementAt(0);
Brep Brep_body1 = Brep.TryConvertBrep(object1.Geometry);
A = object1.Geometry;
BrepFace face = Brep_body1.Faces.ElementAt(4);
A = face;
int edgeindexes = face.AdjacentEdges();
List vertices = new List();
List curves = new List();
for (int i = 0; i < face.AdjacentEdges().Length - 1; i++)
{
Curve curve = Brep_body1.Edges.ElementAt(edgeindexes[i]);
Point3d start = curve.PointAtStart;
vertices.Add(start);
curves.Add(curve);
}
//
IEnumerable brepObjects2 = activeDoc.Objects.GetObjectList(ObjectType.Curve);
RhinoObject object2 = brepObjects2.ElementAt(1);
Curve curve2 = object2.Geometry as Curve;
A = curve2;
//// // //// //////
IEnumerable brepObjects3 = activeDoc.Objects.GetObjectList(ObjectType.Curve);
RhinoObject object3 = brepObjects3.ElementAt(2);
Curve curve3 = object3.Geometry as Curve;
A = curve3.IsClosed;
//// // //// //////////
Point3d point1 = vertices[0];
double t;
curve2.ClosestPoint(point1, out t);
Point3d point2 = curve2.PointAt(t);
Line line = new Line(point1, point2);
A = point2;
//// // // ////
////
////
//// // // //////////////
Brep breps = Brep.CreateFromSweep(curve2, curve3, line.ToNurbsCurve(), true, activeDoc.ModelAbsoluteTolerance);
A = breps;
activeDoc.Objects.Add(breps[0]);
activeDoc.Views.Redraw();