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

Open Ifc file from Stream #69

Closed
GrzegorzBlok opened this issue Jan 12, 2017 · 2 comments
Closed

Open Ifc file from Stream #69

GrzegorzBlok opened this issue Jan 12, 2017 · 2 comments
Labels

Comments

@GrzegorzBlok
Copy link

Hi,

I use following code to convert ifc file to wexbim. However I can't find a way to open Ifc file that comes as a Stream, e.g. MemoryStream. I don't have access to file system. Is there any way to open Ifc file and convert it to wexbim with the use of streams?

string ifcAbsolutePath = "c:\\file.ifc";

using (var wexBimStream = new MemoryStream())
using (var m = IfcStore.Open(ifcAbsolutePath))
{
    var geomContext = new Xbim3DModelContext(m);
    geomContext.CreateContext();

    using (var bw = new BinaryWriter(wexBimStream))
    {
        m.SaveAsWexBim(bw);
        bw.Close();
    }
    m.Close();
}

Regards

@martin1cerny
Copy link
Member

Yes, it is just an overload to IfcStore.Open():

public static IfcStore Open(Stream data, IfcStorageType dataType, IfcSchemaVersion schema, XbimModelType modelType, XbimEditorCredentials editorDetails = null, XbimDBAccess accessMode = XbimDBAccess.Read, ReportProgressDelegate progDelegate = null)

See this line: https://github.com/xBimTeam/XbimEssentials/blob/master/Xbim.Ifc/IfcStore.cs#L167

@GrzegorzBlok
Copy link
Author

Thank you! It looks like I just need to update my nuget packages :)

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

No branches or pull requests

2 participants