Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't export gltf andjson file #24

Open
outsidewindow opened this issue Jun 7, 2021 · 6 comments
Open

can't export gltf andjson file #24

outsidewindow opened this issue Jun 7, 2021 · 6 comments

Comments

@outsidewindow
Copy link

Hi,i just download the code and run Maintests,but the two files don't exsit in bin/debug/net472/Files ,what happened?Hope your reply!

@CBenghi
Copy link
Member

CBenghi commented Jun 7, 2021

Hello,

What files are you expecting to find, please bear in mind that we maintain several packages.
So I've not opened this codebase in a little while.

it would help us if you make your expectations clear when reporting an issue.

Thanks,
Claudio

@outsidewindow
Copy link
Author

hello@CBenghi ,
When I start to download the ximGLTF code and run the example test:Maintests.It is running successfully with no errors,but the json and gltf files don't appear in bin/debug/net472/Files(perhaps in other folder?,i tried other folders,nothing found),i don't know how to solve it.

@CBenghi
Copy link
Member

CBenghi commented Jun 8, 2021

Sorry the question is still not clear.
Are you running the test suite via Visual Studio Test Explorer?
What files are you expecting to find in the output folder?
Are you trying to convert your own files, or just running the test suite?
Do you get any Exceptions?

@outsidewindow
Copy link
Author

Hello,I download the project XbimGLtf,and use nuget to reference the library in my project via Visual Studio,then i try to rebuild the MainTests.I haven't take other action ,only use the example OneWallTwoWindows.ifc .
As expected,Through ConversionTests.cs and SemanticTests.cs,the code will generates OneWallTwoWindows.GLtf and OneWallTwoWindows.json file.(Am I right to say that?)But I can't convert .ifc file to .GLtf and .json file,which I expect to find in the output folder.
If it's not right,how can i convert .ifc file to .GLtf and .json file?

@CBenghi
Copy link
Member

CBenghi commented Jun 8, 2021

If you want to pass your own files, you will have to reference the library in your code and use code similar to the one in the tests, but pointing to your own IFC file.

Can you share the code you are using to point to your file on the disk?

@outsidewindow
Copy link
Author

outsidewindow commented Jun 8, 2021

Sorry,I just try to use the example ConversionTests.cs .Can't this test convert OneWallTwoWindows.ifc file to .GLtf and .json file?

public void CanConvertOneFile()        {            var ifc = new FileInfo("OneWallTwoWindows.ifc");            var xbim = CreateGeometry(ifc, true, false);
            using (var s = IfcStore.Open(xbim.FullName))            {                Stopwatch sw = new Stopwatch();                sw.Start();
                var savename = Path.ChangeExtension(s.FileName, ".gltf");                var bldr = new Builder();                var ret = bldr.BuildInstancedScene(s, XbimMatrix3D.Identity);                glTFLoader.Interface.SaveModel(ret, savename);
                Debug.WriteLine($"Gltf Model exported to '{savename}' in {sw.ElapsedMilliseconds} ms.");                FileInfo f = new FileInfo(s.FileName);
                // write json                //                var jsonFileName = Path.ChangeExtension(s.FileName, "json");                var bme = new Xbim.GLTF.SemanticExport.BuildingModelExtractor();                var rep = bme.GetModel(s);                rep.Export(jsonFileName);            }        }



private static FileInfo CreateGeometry(FileInfo f, bool mode, bool useAlternativeExtruder)        {            IfcStore.ModelProviderFactory.UseHeuristicModelProvider();            using (var m = IfcStore.Open(f.FullName))            {                var c = new Xbim3DModelContext(m);                c.CreateContext(null, mode);                var newName = Path.ChangeExtension(f.FullName, mode + ".xbim");                m.SaveAs(newName);                return new FileInfo(newName);            }        }


Is this unable to achieve the goal?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants