xBimTeam / XbimWebUI

Web components for xBIM Toolkit
http://xbimteam.github.io/XbimWebUI/
Other
202 stars 121 forks source link

How to Convert ifc TO wexbim #1

Closed bhavneetsinghthakur closed 9 years ago

bhavneetsinghthakur commented 9 years ago

Plz any one Tell me procedure Because i have old XBIM Souce there it only Convertes into xbim,ifcxml like that format not convert into wexbim format.

benjymous commented 9 years ago

Hi,

Here's a snippet stripped down from XbimConvert (from the codeplex version, as it doesn't seem to have made its way over to github yet)

  using (XbimModel model = ParseModelFile(ifcFileName, xbimFileName, true))
  {
      var m3D = new Xbim3DModelContext(model);
      try
      {
          m3D.CreateContext(geomStorageType: XbimGeometryType.PolyhedronBinary);
          var bw = new BinaryWriter(new FileStream(wexbimFileName, FileMode.Create));
          m3D.Write(bw);
          bw.Close();
      }
      catch (Exception ce)
      {
          Console.WriteLine("Error compiling geometry\n" + ce.Message);
      }

      model.Close();
      watch.Stop();
  }
bhavneetsinghthakur commented 9 years ago

thks benjymous but is it possible with Xbim.Geometry.Engine.Tests ==> ReadAndWriteWexBimFile() function

martin1cerny commented 9 years ago

Yes bhavneetsinghthakur, this should also work.

bhavneetsinghthakur commented 9 years ago

Plz anyone give it to me these two dll file or send me the link there i get this dll otherwise tell me the solution how i can get this dll

1) Xbim.Geometry.Engine32.dll 2) Xbim.Geometry.Engine64.dll

SteveLockley commented 9 years ago

If you download and use the Xbim.Geometry package from Nuget it will install them into your project automatically

From: bhavneetsinghthakur [mailto:notifications@github.com] Sent: 24 January 2015 15:26 To: xBimTeam/XbimWebUI Subject: Re: [XbimWebUI] How to Convert ifc TO wexbim (#1)

Plz anyone give it to me these two dll file or send me the link there i get this dll otherwise tell me the solution how i can get this dll

1) Xbim.Geometry.Engine32.dll 2) Xbim.Geometry.Engine64.dll

— Reply to this email directly or view it on GitHubhttps://github.com/xBimTeam/XbimWebUI/issues/1#issuecomment-71322159.

bhavneetsinghthakur commented 9 years ago

thanks Steve i got dll but i am facing this issue plz tell me solution At the time of conversion i got error StackOverFlow m3D.CreateContext(XbimGeometryType.PolyhedronBinary); above this function return me error CreateContext() is metadata so i am unable to debug Why i am getting this error

LloydPickering commented 9 years ago

The function is clearly doing something recursive, and has fallen into the trap of calling itself over and over until the stack runs out.

It might be a mismatch of versions, it might be a bug in Steve's code, but in the meanwhile, another possibility is the file is bad.

Is the file you are trying to convert ok? It doesn't have anything weird and wonderful in it? does it open in any other IFC supporting viewers/tools? (Solibri, DDS CAD, Tekla BIMSight etc?)

bhavneetsinghthakur commented 9 years ago

hi LloydPickering my ifc file is correct i checked with Xbim Xplorer and i also check version of assembly that is also correct my assembly version is 3.0 runtime version is 4.0

if i am missing anything then please tell me?

LloydPickering commented 9 years ago

If you have built XbimXplorer from the source at https://github.com/xBimTeam/XbimWindowsUI then you are good to go. If you have it from elsewhere, then it's probably an old version

bhavneetsinghthakur commented 9 years ago

hi LloydPickering i downloaded that project but i am facing problem in nuget i tried to configure in csproj file but i don't get solution to successfully run that project

my error is-- Error 1 This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Xbim.Geometry.3.0.3-Prerelease\build\net45\Xbim.Geometry.targets. D:\XbimWindowsUI-master\XbimWindowsUI-master\Xbim.Presentation\Xbim.Presentation.csproj 321 5 Xbim.Presentation

plz send me solution ?

LloydPickering commented 9 years ago

If you right click on the solution and choose 'Enable NuGet Package Restore', it should auto restore the packages for you when you build.

bhavneetsinghthakur commented 9 years ago

After Implementing All the things Again i got this Error

An unhandled exception of type 'System.StackOverflowException' occurred in Xbim.Geometry.Engine32.dll

is it bugs in steve code or i am lacking somewhere plz help me?

LloydPickering commented 9 years ago

It could be a bug in Steve's code, or it could be something strange with your source IFC file. Any chance you could share it so Steve can take a look and either fix the bug, or tell you what's wrong with your input file?

bhavneetsinghthakur commented 9 years ago

Hi Steve below is a link of my ifc file http://we.tl/fQa30iOMme

plz have a look and my code is

const string ifcFileFullName = "Duplex_A_20110907.ifc"; var fileName = Path.GetFileName(ifcFileFullName); var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName); //var workingDir = Directory.GetCurrentDirectory(); var workingDir = "D:\"; var coreFileName = Path.Combine(workingDir, fileNameWithoutExtension); var wexBimFileName = Path.ChangeExtension(coreFileName, "wexbim"); var xbimFile = Path.ChangeExtension(coreFileName, "xbim"); try {

                using (var wexBimFile = new FileStream(wexBimFileName, FileMode.Create))
                {
                    using (var binaryWriter = new BinaryWriter(wexBimFile))
                    {

                        using (var model = new XbimModel())
                        {
                            model.CreateFrom(ifcFileFullName, xbimFile, null, true, false);
                            Xbim3DModelContext geomContext = new Xbim3DModelContext(model); // ISGenetrated is false here
                           geomContext .CreateContext(XbimGeometryType.Polyhedron); // Stack OverFlow Exception
                            geomContext.Write(binaryWriter);

                        }
                    }
                }
            }

in this code Xbim3DModelContext ===> IsGenerated Return me false and after that it throws me StackOverFlow Exception in geomContext.CreateContext();

plz solve my problem.

bhavneetsinghthakur commented 9 years ago

Any One plz give me Reply or tell me When you will provide Latest Xbim Xplorer on github....

LloydPickering commented 9 years ago

I'm having issues too. I can create teh context no problem, but when I try to write, I'm getting an OutOfMemoryException. I'll give Steve a bell as he doesn't seem to be watching this thread.

bhavneetsinghthakur commented 9 years ago

ok..thanks LloydPickering but plz you guys provide for us a complete solution.

if possible then plz provide your code snippet..

SteveLockley commented 9 years ago

Bhavneetsinghthakur

It should be XbimGeometryType.PolyhedronBinary for the argument to CreateContext

From: bhavneetsinghthakur [mailto:notifications@github.com] Sent: 30 January 2015 05:00 To: xBimTeam/XbimWebUI Cc: Steve Lockley Subject: Re: [XbimWebUI] How to Convert ifc TO wexbim (#1)

Hi Steve below is a link of my ifc file http://we.tl/fQa30iOMme

plz have a look and my code is

const string ifcFileFullName = "Duplex_A_20110907.ifc"; var fileName = Path.GetFileName(ifcFileFullName); var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName); //var workingDir = Directory.GetCurrentDirectory(); var workingDir = "D:\"; var coreFileName = Path.Combine(workingDir, fileNameWithoutExtension); var wexBimFileName = Path.ChangeExtension(coreFileName, "wexbim"); var xbimFile = Path.ChangeExtension(coreFileName, "xbim"); try {

            using (var wexBimFile = new FileStream(wexBimFileName, FileMode.Create))

            {

                using (var binaryWriter = new BinaryWriter(wexBimFile))

                {

                    using (var model = new XbimModel())

                    {

                        model.CreateFrom(ifcFileFullName, xbimFile, null, true, false);

                        Xbim3DModelContext geomContext = new Xbim3DModelContext(model); // ISGenetrated is false here

                       geomContext .CreateContext(XbimGeometryType.Polyhedron); // Stack OverFlow Exception

                        geomContext.Write(binaryWriter);

                    }

                }

            }

        }

in this code Xbim3DModelContext ===> IsGenerated Return me false and after that it throws me StackOverFlow Exception in geomContext.CreateContext();

plz solve my problem.

— Reply to this email directly or view it on GitHubhttps://github.com/xBimTeam/XbimWebUI/issues/1#issuecomment-72154476.

bhavneetsinghthakur commented 9 years ago

i used XbimGeometryType.PolyhedronBinary for the argument to CreateContext then only i got same error. untitled12

untitled11

CBenghi commented 9 years ago

Hi I've added an export item to the file menu of Xplorer (the wpf one). Please have a look at that and let me know if it works for you to generate wexbim. I have tested your IFC file and it does not generate errors for me.

At the moment my guess is that the problem might be connected with the 32 bit version of the operating system (which I think you are using from some other parts of the thread).

Thanks, Claudio

SteveLockley commented 9 years ago

There was a bug in the WexBIM convertor in Xbim.Geometry caused by some changes getting lost in the move to GitHub

This has been fixed and submitted, you will need to update with Nuget

From: Claudio Benghi [mailto:notifications@github.com] Sent: 04 February 2015 02:22 To: xBimTeam/XbimWebUI Cc: Steve Lockley Subject: Re: [XbimWebUI] How to Convert ifc TO wexbim (#1)

Hi I've added an export item to the file menu of Xplorer (the wpf one). Please have a look at that and let me know if it works for you to generate wexbim. I have tested your IFC file and it does not generate errors for me.

At the moment my guess is that the problem might be connected with the 32 bit version of the operating system (which I think you are using from some other parts of the thread).

Thanks, Claudio

— Reply to this email directly or view it on GitHubhttps://github.com/xBimTeam/XbimWebUI/issues/1#issuecomment-72778477.

LloydPickering commented 9 years ago

Bhavneetsinghthakur does this solve your issue, and can we close it?

bhavneetsinghthakur commented 9 years ago

Thnks for Your Help But Still i am unable to open Xbim Xplorer Due to nuget Problem. I'll Try from my Side... You should Close This Issue.

Thanks To All Xbim Team For Providing a Lot of Information.

LloydPickering commented 9 years ago

No problems. If you have further problems, just open up a new Issue :)

DangerX commented 9 years ago

I can not find definition for Xbim3DModelContext anymore :(

martin1cerny commented 9 years ago

Hi DangerX,

Steve is finishing important improvements of the geometry engine. I'll ask him to advice you where Xbim3DModelContext is located now. Changes should have minimal impact on API while having significant positive impact on a geometry processing which is important for large IFC models. This should be finished in just a few days but this part of xBIM is likely to be unstable in development branch until then.

2015-03-18 10:43 GMT+01:00 DangerX notifications@github.com:

I can not find definition for Xbim3DModelContext anymore :(

— Reply to this email directly or view it on GitHub https://github.com/xBimTeam/XbimWebUI/issues/1#issuecomment-82854493.

krosoftware commented 8 years ago

Hello is it possible to download compiled converter to convert IFC to wexbim? I'm not familiar with C# and want to use only WebUI but need to convert Ifc somehow.. Thank you.

martin1cerny commented 8 years ago

Hi @krosoftware , we don't provide any compiled binaries as part of xBIM Toolkit. But converting from IFC to wexBIM only takes about 15 lines of code which you can get from here.

It is slightly different now in develop but again only a few lines of code. Develop branch is more flexible and more performant.