|  | 
 
| 本帖最后由 panhao1 于 2012-12-10 02:11 编辑 
 Mesh mesh = new Mesh();
 x.FaceNormals.ComputeFaceNormals();
 List<Curve> ls = new List<Curve>();
 Rhino.Geometry.Collections.MeshTopologyEdgeList el = x.TopologyEdges;
 for(int i = 0;i < el.Count;i++){
 Line L = el.EdgeLine(i);
 if (el.GetConnectedFaces(i).Length == 1) ls.Add(L.ToNurbsCurve());
 }
 Curve[] cs = Rhino.Geometry.Curve.JoinCurves(ls, doc.ModelAbsoluteTolerance * 10);
 Vector3d v = new Vector3d(x.FaceNormals[0]);
 v.Unitize();v /= 2;
 PolylineCurve pl = cs[0].ToPolyline(0, 0, Math.PI, 99999, 0, 0, 0.1, 0, true);
 
 for(int i = 0;i < pl.PointCount;i++){
 mesh.Vertices.Add(pl.Point(i) + v);
 mesh.Vertices.Add(pl.Point(i) - v);
 
 if(i < pl.PointCount - 1)   mesh.Faces.AddFace(new MeshFace(i * 2, i * 2 + 1, i * 2 + 3, i * 2 + 2));
 }
 mesh.Faces.AddFace(new MeshFace(cs.Length * 2 - 2, cs.Length * 2 - 1, 1, 0));
 mesh.Compact();
 mesh.Normals.ComputeNormals();
 
 A = mesh;
 | 
 |