コード例 #1
0
ファイル: BrepTests.cs プロジェクト: xc0derx/speckle-sharp
        public void BrepToNative(string fileName)
        {
            // Read and obtain `base` object.
            var contents  = System.IO.File.ReadAllText(TestFolder + fileName);
            var converter = new ConverterRevit();
            var @base     = Operations.Deserialize(contents);

            // You read the wrong file, OOOPS!!
            if (!(@base is Brep brep))
            {
                throw new Exception("Object was not a brep, did you choose the right file?");
            }
            DirectShape native = null;

            xru.RunInTransaction(() =>
            {
                converter.SetContextDocument(fixture.NewDoc);
                native = converter.BrepToDirectShape(brep);
            }, fixture.NewDoc).Wait();

            Assert.True(native.get_Geometry(new Options()).First() is Solid);
        }