当前位置: 首页>>代码示例>>C#>>正文


C# Polyline.Transform方法代码示例

本文整理汇总了C#中Polyline.Transform方法的典型用法代码示例。如果您正苦于以下问题:C# Polyline.Transform方法的具体用法?C# Polyline.Transform怎么用?C# Polyline.Transform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Polyline的用法示例。


在下文中一共展示了Polyline.Transform方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RunScript

    /// <summary>
    /// This procedure contains the user code. Input parameters are provided as regular arguments,
    /// Output parameters as ref arguments. You don't have to assign output parameters,
    /// they will have a default value.
    /// </summary>
    private void RunScript(List<Line> x, List<Point3d> y, ref object A, ref object B, ref object C)
    {
        try
        {
            List<IndexPair> id; List<Vertice> vs;
            Vertice.CreateCollection(x, out id, out vs);
            for (int i = 0; i < vs.Count; i++)
            {
                for (int j = 0; j < y.Count; j++)
                {
                    if (vs[i].equalTo(y[j])) { vs[i].energe = 0.8; break; }
                }
            }
            for (int i = 0; i < 10; i++)
            {
                vs.ForEach(delegate(Vertice v) { v.transferEnerge(0.70, ref vs); });
            }

            for (int i = 0; i < vs.Count; i++)
            {
                vs[i].CrateEdges(vs);
                //Print(vs[i].edges.Count.ToString());
            }
            ////////////////

            Mesh mesh = new Mesh();
            for (int i = 0; i < id.Count; i++)
            {
                Polyline pl1 = new Polyline(); Polyline pl2 = new Polyline();
                if (vs[id[i].J].refer.Count == 3)
                {
                    for (int j = 0; j < 3; j++)
                    {
                        if (vs[id[i].J].refer[j] == id[i].I)
                        {
                            pl1 = vs[id[i].J].edges[j]; break;
                        }
                    }
                }
                if (vs[id[i].I].refer.Count == 3)
                {
                    for (int j = 0; j < 3; j++)
                    {
                        if (vs[id[i].I].refer[j] == id[i].J)
                        {
                            pl2 = vs[id[i].I].edges[j]; break;
                        }
                    }
                }
                //Print(pl1.Count.ToString());
                if (pl1.Count == 4 && pl2.Count == 0)
                {
                    Plane p = new Plane(vs[id[i].I].pos, vs[vs[id[i].I].refer[0]].pos - vs[id[i].I].pos);
                    pl2.AddRange(pl1);
                    pl2.Transform(Transform.PlanarProjection(p));

                }
                if (pl1.Count == 0 && pl2.Count == 4)
                {
                    Plane p = new Plane(vs[id[i].J].pos, vs[vs[id[i].J].refer[0]].pos - vs[id[i].J].pos);
                    pl1.AddRange(pl2);
                    pl1.Transform(Transform.PlanarProjection(p));

                }
                if (pl1.Count == 4 && pl2.Count == 4)
                {

                    Plane p1 = new Plane(pl1[0], pl1[1], pl1[2]);
                    Plane p2 = new Plane(pl2[0], pl2[1], pl2[2]);
                    if (Vector3d.VectorAngle(p1.Normal, p2.Normal) > Math.PI / 2) pl2.Reverse();
                    mesh.Append(mc.ClosedBridge(pl1, pl2));

                }
            }

            A = mesh;
        }
        catch (Exception ex) { Print(ex.ToString()); }
    }
开发者ID:panhao4812,项目名称:TempCodesAndStudy,代码行数:84,代码来源:TreePipe.cs

示例2: Intersect

 List<Line> Intersect(Polyline l1, Polyline l2)
 {
     double z1 = l1[0].Z;
     double z2 = l2[0].Z;
     Polyline l3 = new Polyline(l2);
     l3.Transform(Transform.Translation(0, 0, z1 - z2));
     Rhino.Geometry.Intersect.CurveIntersections cis =
       Rhino.Geometry.Intersect.Intersection.CurveCurve(l1.ToNurbsCurve(), l3.ToNurbsCurve(), 0.01, 0.01);
     List<Line> output = new List<Line>();
     Print(cis.Count.ToString());//////////////////////
     if (cis.Count > 0)
     {
         for (int k = 0; k < cis.Count; k++)
         {
             Point3d p = cis[k].PointA;
             output.Add(new Line(p, p + new Vector3d(0, 0, z2 - z1)));
         }
     }
     return output;
 }
开发者ID:panhao4812,项目名称:Fincler,代码行数:20,代码来源:Class1.cs

示例3: RunScript

    /// <summary>
    /// This procedure contains the user code. Input parameters are provided as regular arguments,
    /// Output parameters as ref arguments. You don't have to assign output parameters,
    /// they will have a default value.
    /// </summary>
    private void RunScript(List<Point3d> x, double y, bool z, double u, ref object A, ref object B, ref object C, ref object D, ref object E, ref object F)
    {
        try
        {
            List<Line> ls = new List<Line>();//frofile
            List<Polyline> pls = new List<Polyline>();//frofile
            //////
            List<Polyline> pls01 = new List<Polyline>();//frame1
            List<Polyline> pls02 = new List<Polyline>();//frame2
            ////////
            pls.Add(box(new Line(x[0], x[1])));
            pls.Add(box(new Line(x[1], x[2])));
            Polyline pl = new Polyline();
            pl = box(new Line((x[0] + x[1]) / 2, (x[2] + x[1]) / 2));
            pl.Transform(Transform.Translation(0, 0, -y));
            pls.Add(pl);
            ////////
            ls.Add(new Line(pls[2][0], pls[0][0]));
            ls.Add(new Line(pls[2][1], pls[0][1]));
            ls.Add(new Line(pls[2][2], pls[0][2]));
            ls.Add(new Line(pls[2][3], pls[0][3]));
            ls.Add(new Line(pls[2][0], pls[1][0]));
            ls.Add(new Line(pls[2][1], pls[1][1]));
            ls.Add(new Line(pls[2][2], pls[1][2]));
            ls.Add(new Line(pls[2][3], pls[1][3]));
            ////////
            for (double i = -y; i <= 0.4; i += 0.4)
            {
                Plane p = Plane.WorldXY;
                p.Transform(Transform.Translation(0, 0, i));
                double t = 0;
                Polyline pl0 = new Polyline();
                Rhino.Geometry.Intersect.Intersection.LinePlane(ls[0], p, out t);
                pl0.Add(ls[0].PointAt(t));
                Rhino.Geometry.Intersect.Intersection.LinePlane(ls[1], p, out t);
                pl0.Add(ls[1].PointAt(t));
                Rhino.Geometry.Intersect.Intersection.LinePlane(ls[2], p, out t);
                pl0.Add(ls[2].PointAt(t));
                Rhino.Geometry.Intersect.Intersection.LinePlane(ls[3], p, out t);
                pl0.Add(ls[3].PointAt(t)); pl0.Add(pl0[0]);
                pls01.Add(pl0);
                pl0 = new Polyline();
                Rhino.Geometry.Intersect.Intersection.LinePlane(ls[4], p, out t);
                pl0.Add(ls[4].PointAt(t));
                Rhino.Geometry.Intersect.Intersection.LinePlane(ls[5], p, out t);
                pl0.Add(ls[5].PointAt(t));
                Rhino.Geometry.Intersect.Intersection.LinePlane(ls[6], p, out t);
                pl0.Add(ls[6].PointAt(t));
                Rhino.Geometry.Intersect.Intersection.LinePlane(ls[7], p, out t);
                pl0.Add(ls[7].PointAt(t)); pl0.Add(pl0[0]);
                pls02.Add(pl0);
            }
            ///////////////////////////////////////
            Mesh mesh1 = new Mesh();//frame
            Mesh mesh2 = new Mesh();//screw
            Mesh mesh3 = new Mesh();//Joint
            List<Line> output1 = new List<Line>();//screw M6*40
            List<Polyline> output2 = new List<Polyline>();//frame1&frame2
            List<Line> output3 = new List<Line>();//screw M4*40
            for (int i = 0; i < pls01.Count; i++)
            {
                Polyline pll = offset(pls01[i], 0.1);
                pll.Transform(Transform.Translation(0, 0, 0.1));
                pls01[i] = pll;
                mesh1.Append(desk(pll, 0.2, 0.2));
                if (i > 0)
                {
                    output1.AddRange(Intersect(pls01[i], pls01[i - 1]));
                }
            }
            pls02.RemoveAt(0);
            for (int i = 0; i < pls02.Count; i++)
            {
                Polyline pll = offset(pls02[i], 0.1);
                pll.Transform(Transform.Translation(0, 0, -0.1));
                pls02[i] = pll;
                mesh1.Append(desk(pll, 0.2, 0.2));
                if (i > 0)
                {
                    output1.AddRange(Intersect(pls02[i], pls02[i - 1]));
                }
            }
            ////////////////////////////////////////////////////////
            for (int i = 1; i < pls01.Count; i++)
            {
                mesh3.Append(Joint(pls01[i - 1], pls01[i], 0.2, 0.2, 0.5));
            }
            for (int i = 1; i < pls02.Count; i++)
            {
                Polyline PL01 = new Polyline();
                PL01.Add(pls02[i - 1][2]); PL01.Add(pls02[i - 1][3]); PL01.Add(pls02[i - 1][0]); PL01.Add(pls02[i - 1][1]);
                Polyline PL02 = new Polyline();
                PL02.Add(pls02[i][2]); PL02.Add(pls02[i][3]); PL02.Add(pls02[i][0]); PL02.Add(pls02[i][1]);
                mesh3.Append(Joint(PL01, PL02, 0.2, 0.2, 0.5));
            }
//.........这里部分代码省略.........
开发者ID:panhao4812,项目名称:Fincler,代码行数:101,代码来源:Class1.cs

示例4: desk

 Mesh desk(Polyline l, double t, double u)
 {
     List<Polyline> pls3 = new List<Polyline>();
     Polyline pl11 = offset(l, -u / 2);
     pl11.Transform(Transform.Translation(new Vector3d(0, 0, -t / 2)));
     Polyline pl12 = offset(pl11, u);
     Polyline pl21 = new Polyline(pl11);
     pl21.Transform(Transform.Translation(new Vector3d(0, 0, t)));
     Polyline pl22 = offset(pl21, u);
     pls3.Add(pl11); pls3.Add(pl12); pls3.Add(pl22); pls3.Add(pl21);
     return MT.MeshLoft(pls3, false, true);
 }
开发者ID:panhao4812,项目名称:Fincler,代码行数:12,代码来源:Class1.cs


注:本文中的Polyline.Transform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。