示例#1
0
        public void  TestDrawMultiSegment()
        {
            var scene = new GltfSceneBuilder();

            using (var dc = scene.Create3DContext())
            {
                var style = new LineStyle(COLOR.Red, LineCapStyle.Round, LineCapStyle.Triangle).WithOutline(COLOR.Black, 1);

                Decompose3D.DrawSegment(dc, Point3.Array((0, 0, 0), (17, 0, 0), (20, 10, 0), (20, 20, 0)), 5, style);

                Decompose3D.DrawSegment(dc, Point3.Array((0, 0, 20), (0, 15, 20), (30, 0, 20), (0, 0, 20)), 3, style);

                Decompose3D.DrawSegment(dc, Point3.Array((0, 0, 40), (0, 15, 40)), 3, style);
            }

            AttachmentInfo
            .From("extrude1.glb")
            .WriteObject(f => scene.Save(f));
        }
示例#2
0
        public static string AttachToCurrentTest(this Record3D batch, string filePath)
        {
            var ainfo = NUnit.Framework.AttachmentInfo.From(filePath);

            if (filePath.ToLower().EndsWith(".stl"))
            {
                throw new NotImplementedException();

                /*
                 * var mb = new Backends.STLMeshBuilder();
                 * batch.DrawTo(mb);
                 * var wfcontent = mb.ToAsciiSTL();
                 * System.IO.File.WriteAllText(filePath, wfcontent);
                 * NUnit.Framework.TestContext.AddTestAttachment(filePath);
                 * return;
                 */
            }

            if (filePath.ToLower().EndsWith(".html"))
            {
                var html = PlotlyDocumentBuilder.ConvertToHtml(batch);
                ainfo.WriteAllText(html);
            }

            if (filePath.ToLower().EndsWith(".InteropDrawing"))
            {
            }

            if (filePath.ToLower().EndsWith(".gltf") || filePath.ToLower().EndsWith(".glb") || filePath.ToLower().EndsWith(".obj"))
            {
                var model = GltfSceneBuilder
                            .Convert(batch)
                            .ToGltf2();

                ainfo.WriteObject(f => model.Save(f));
            }

            return(filePath);
        }
示例#3
0
 public _GltfDrawing3DContext(GltfSceneBuilder owner, Matrix4x4 xform)
 {
     _Owner     = owner;
     _Transform = xform;
 }