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


C# TextNode.SetPosition方法代码示例

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


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

示例1: planeAngleToolStripMenuItem_Click

        private void planeAngleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // plane
            Vector3 planeDir = Vector3.UNIT_Z;
            TopoShape plane1 = GlobalInstance.BrepTools.MakePlaneFace(Vector3.ZERO, planeDir, -100, 100, -100, 100);

            {
                GeomSurface gs = new GeomSurface();
                gs.Initialize(plane1);
                List<Vector3> rst = gs.D1(gs.FirstUParameter(), gs.FirstVParameter());
                Vector3 dir2 = rst[1].CrossProduct(rst[2]);

                MessageBox.Show(dir2.ToString());
            }
    

            Vector3 normal = new Vector3(0,1,1);
            normal.Normalize();
            TopoShape plane2 = GlobalInstance.BrepTools.MakePlaneFace(Vector3.ZERO, normal, -100, 100, -100, 100);

            renderView.ShowGeometry(plane1, ++shapeId);
            renderView.ShowGeometry(plane2, ++shapeId);

            LineStyle style = new LineStyle();
            style.SetColor(ColorValue.GREEN);
            // witness
            Vector3 end1 =  new Vector3(0, 0, 100);
            LineNode line1 = new LineNode();
            line1.Set(Vector3.ZERO, end1);
            line1.SetLineStyle(style);
            renderView.ShowSceneNode(line1);

            Vector3 end2 = normal * 100;
            LineNode line2 = new LineNode();
            line2.Set(Vector3.ZERO, end2);
            line2.SetLineStyle(style);
            renderView.ShowSceneNode(line2);

            // angle
            float angle = normal.AngleBetween(planeDir);

            Vector3 dir = normal.CrossProduct(planeDir);
            dir.Normalize();
            TopoShape arc = GlobalInstance.BrepTools.MakeArc(end2, end1, Vector3.ZERO, dir);
            SceneNode arcNode = renderView.ShowGeometry(arc, ++shapeId);
            arcNode.SetLineStyle(style);

            // text
            TextNode text = new TextNode();
            text.SetText(angle.ToString());
            Vector3 pos = end2 + end1;
            pos = pos * 0.5f;
            text.SetPosition(pos);
            renderView.ShowSceneNode(text);

            renderView.RequestDraw();
        }
开发者ID:xazk027,项目名称:anycadnetsdkpro,代码行数:57,代码来源:FormMain.cs

示例2: curveToolStripMenuItem_Click

        private void curveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            renderView.SetStandardView(EnumStandardView.SV_Top);

            Platform.LineStyle lineStyle = new Platform.LineStyle();
            lineStyle.SetLineWidth(0.5f);
            lineStyle.SetColor(ColorValue.BLUE);
            Platform.LineStyle lineStyle2 = new Platform.LineStyle();
            lineStyle2.SetLineWidth(0.5f);
            lineStyle2.SetColor(ColorValue.GREEN);

            Platform.TopoShape arc = GlobalInstance.BrepTools.MakeEllipseArc(Vector3.ZERO, 100, 50, 45, 270, Vector3.UNIT_Z);
            renderView.ShowGeometry(arc, 100);
 
            {
                GeomCurve curve = new GeomCurve();
                curve.Initialize(arc);

                float paramStart = curve.FirstParameter();
                float paramEnd = curve.LastParameter();

                float step = (paramEnd - paramStart) * 0.1f;

                for (float uu = paramStart; uu <= paramEnd; uu += step)
                {
                    Vector3 dir = curve.DN(uu, 1);
                    Vector3 pos = curve.Value(uu);

                    // 切线
                    {
                        Platform.TopoShape line = GlobalInstance.BrepTools.MakeLine(pos, pos + dir);
                        Platform.SceneNode node = renderView.ShowGeometry(line, 101);
                        node.SetLineStyle(lineStyle);
                    }
                    // 法线
                    {
                        Vector3 dirN = dir.CrossProduct(Vector3.UNIT_Z);
                        Platform.TopoShape line = GlobalInstance.BrepTools.MakeLine(pos, pos + dirN);
                        Platform.SceneNode node = renderView.ShowGeometry(line, 101);
                        node.SetLineStyle(lineStyle2);
                    }

                }

            }

            TopoShapeProperty property = new TopoShapeProperty();
            property.SetShape(arc);

            float len = property.EdgeLength();

            TextNode text = new TextNode();
            text.SetText(String.Format("Arc Length: {0}", len));
            text.SetPosition(new Vector3(100, 100, 0));

            renderView.SceneManager.ClearNodes2d();
            renderView.SceneManager.AddNode2d(text);

            renderView.RequestDraw();
        }
开发者ID:xazk027,项目名称:anycadnetsdkpro,代码行数:60,代码来源:FormMain.cs

示例3: surfaceToolStripMenuItem_Click

        private void surfaceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Platform.LineStyle lineStyle = new Platform.LineStyle();
            lineStyle.SetLineWidth(0.5f);
            lineStyle.SetColor(ColorValue.RED);

            var points = new System.Collections.Generic.List<Vector3>();
            points.Add(new Vector3(0, 0, 0));
            points.Add(new Vector3(50, 0, 0));
            points.Add(new Vector3(100, 0, 0));

            points.Add(new Vector3(0, 50, 0));
            points.Add(new Vector3(50, 50, 5));
            points.Add(new Vector3(100, 50, -5));

            points.Add(new Vector3(0, 150, 5));
            points.Add(new Vector3(50, 150, -5));
            points.Add(new Vector3(100, 150, 0));

            TopoShape face = GlobalInstance.BrepTools.MakeSurfaceFromPoints(points, 3, 3);

            renderView.ShowGeometry(face, 101);

            GeomSurface surface = new GeomSurface();
            surface.Initialize(face);
            float ufirst = surface.FirstUParameter();
            float uLarst = surface.LastUParameter();
            float vfirst = surface.FirstVParameter();
            float vLast = surface.LastVParameter();

            float ustep = (uLarst - ufirst) * 0.1f;
            float vstep = (vLast - vfirst) * 0.1f;
            for(float ii=ufirst; ii<=uLarst; ii+= ustep)
                for (float jj = vfirst; jj <= vLast; jj += vstep)
                {
                    var data = surface.D1(ii, jj);

                    Vector3 pos = data[0];
                    Vector3 dirU = data[1];
                    Vector3 dirV = data[2];
                    Vector3 dir = dirV.CrossProduct(dirU);
                    dir.Normalize();
                    {
                        Platform.TopoShape line = GlobalInstance.BrepTools.MakeLine(pos, pos + dir*10.0f);
                        Platform.SceneNode node = renderView.ShowGeometry(line, 101);

                        node.SetLineStyle(lineStyle);
                    }
                }

            TopoShapeProperty property = new TopoShapeProperty();
            property.SetShape(face);

            float area = property.SurfaceArea();

            TextNode text = new TextNode();
            text.SetText(String.Format("Surface Area: {0}", area));
            text.SetPosition(new Vector3(100, 100, 0));
            renderView.SceneManager.ClearNodes2d();
            renderView.SceneManager.AddNode2d(text);

            renderView.RequestDraw();
        }
开发者ID:xazk027,项目名称:anycadnetsdkpro,代码行数:63,代码来源:FormMain.cs

示例4: textToolStripMenuItem_Click

        private void textToolStripMenuItem_Click(object sender, EventArgs e)
        {
            {
                GlobalInstance.FontManager.SetDefaultFont("FangSong (TrueType)");
                TextNode text = new TextNode();
                text.SetPosition(new Vector3(200, 200, 200));
                text.SetText("AnyCAD .Net SDK Pro 专业版");
                text.SetTextColor(new ColorValue(1, 0, 0, 1));

                renderView.SceneManager.AddNode(text);
            }
            {
                TextNode text = new TextNode();
                text.SetPosition(new Vector3(10, 50, 0));
                text.SetText("AnyCAD .Net SDK Pro 2D");
                text.SetTextColor(new ColorValue(0, 1, 0, 1));
                renderView.SceneManager.AddNode2d(text);
            }

            renderView.RequestDraw();
        }
开发者ID:xazk027,项目名称:anycadnetsdkpro,代码行数:21,代码来源:FormMain.cs


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