IndustryFoundationClasses / Questions

Have a question about IFCs? Ask here. Use Github Issues.
20 stars 4 forks source link

Are all IFC 2x3 files valid IFC 4 files? #10

Open aahoo opened 7 years ago

aahoo commented 7 years ago

Should I convert IFC 2x3 files to IFC 4? If so, where can I find a tool for conversion?

aothms commented 7 years ago

Are all IFC 2x3 files valid IFC 4 files?

They are not. Some 2x3 entities have been removed. Attributes have been added in 4 to prevalent entities. There might be subtleties involving cardinalities and optionality of (inverse) attributes. Even though conceptually for many files the differences might not be that big.

There doesn't seem to be an official straightforward path for migration. The only resource I know about migration is from steptools [1].

[1] http://www.steptools.com/support/stdev_docs/ifcbim/migrate.html

jmirtsch commented 7 years ago

The geometry gym dotnet toolkit simultaneously supports multiple releases (primarily IFC2x3 and IFC4 ), the various serialization methods check release version and formats appropriately.

I've been developing functionality to upgrade and downgrade files. This is still work in progress and not all is in the open source code yet. Certainly it could be improved and made more comprehensive.

For example, in the IfcParameterizedProfileDef class the position attribute was made optional in IFC4. The change release code I've written looks something like this (from here).

    internal override void changeSchema(ReleaseVersion schema)
    {
        IfcAxis2Placement2D position = Position;
        if (schema == ReleaseVersion.IFC2x3)
        {
            if (position == null)
                Position = mDatabase.Factory.Origin2dPlace;
        }
        else if (position != null && position.IsWorldXY)
            Position = null;
    }
martin1cerny commented 7 years ago

If you want to convert just to keep a single codebase you might also want to try xBIM Toolkit (http://docs.xbim.net).

We have implemented both IFC2x3 and IFC4 as complete and separate schemas which they are. On top of that we have developed IFC4 interfaces for both schemas so you can work with IFC2x3 as if it was IFC4. This obviously doesn't expose classes which were removed between versions but you will always get these on the higher level of inheritance hierarchy. And if you hit the floor you can always cast it to the actual underlying type which is 100% safe. There are no quirks to mix the two schemas together. You can check the link above to see some examples. Source code is available here: https://github.com/xBimTeam

I hope you will find this useful,

Best regards

Martin

Dne 3. 1. 2017 18:07 napsal uživatel "Jon Mirtschin" < notifications@github.com>:

The geometry gym dotnet toolkit https://github.com/jmirtsch/GeometryGymIFC simultaneously supports multiple releases (primarily IFC2x3 and IFC4 ), the various serialization methods check release version and formats appropriately.

I've been developing functionality to upgrade and downgrade files. This is still work in progress and not all is in the open source code yet. Certainly it could be improved and made more comprehensive.

For example, in the IfcParameterizedProfileDef class the position attribute was made optional in IFC4. The change release code I've written looks something like this (from here https://github.com/jmirtsch/GeometryGymIFC/blob/master/Core/IFC/IFC%20P.cs ).

internal override void changeSchema(ReleaseVersion schema) { IfcAxis2Placement2D position = Position; if (schema == ReleaseVersion.IFC2x3) { if (position == null) Position = mDatabase.Factory.Origin2dPlace; } else if (position != null && position.IsWorldXY) Position = null; }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/IndustryFoundationClasses/Questions/issues/10#issuecomment-270165848, or mute the thread https://github.com/notifications/unsubscribe-auth/AAvL1tqsMHf01E1bfro2HkpHNvt8ZDNjks5rOoBjgaJpZM4LY0F6 .

aahoo commented 7 years ago

Regarding "addition of attributes", I see it in two different levels:

  • Description method: EXPRESS
  • Implementation methods: STEP-File, STEP-XML, SDAI

The description could be compatible, but the implementation might depend. If there are additions to supertypes (branches not the leafs in the type tree), then standard IFC format (STEP-File) cannot be compatible because the sequences of attributes become too different to project to the higher dimension. But IFC-XML (or JSONized IFC) do not have this problem because attribute names are explicitly stated.

martin1cerny commented 7 years ago

IFC XML is even less compatible between IFC2x3 and IFC4 because conversion conventions have been changed drastically. If you read IFC2x3 STEP21 into IFC4 schema you will most possibly end up with some errors and you would loose certain data but it would work to certain extent. If you try to do the same with XML it will crash completely because XSDs are very different.

Saying so, IFC4 XML is a lot more conscious, less verbose and allows for more tree-like structure if you start serialization from IfcProject as a root element. But that is just an option not a requirement. STEP21 is generally a lot better suited for IFC data.

Best regards

Martin

Dne 4. 1. 2017 14:20 napsal uživatel "aahoo" notifications@github.com:

Regarding "addition of attributes", I see it in two different levels:

  • Description method: EXPRESS
  • Implementation methods: STEP-File, STEP-XML, SDAI

The description could be compatible, but the implementation might depend. If there are additions to supertypes (branches not the leafs in the type tree https://en.wikipedia.org/wiki/Tree_(data_structure)#Terminology_used_in_Trees), then standard IFC format (STEP-File) cannot be compatible because the sequences of attributes become too different to project to the higher dimension. But IFC-XML (or JSONized IFC) do not have this problem because attribute names are explicitly stated.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/IndustryFoundationClasses/Questions/issues/10#issuecomment-270368600, or mute the thread https://github.com/notifications/unsubscribe-auth/AAvL1qhw9cDl6h9ITbHdaolu1FvB7u-Cks5rO5y4gaJpZM4LY0F6 .

aahoo commented 7 years ago

@martin1cerny

I didn't know about those changes to IFC XML. Thanks for clearing that up.

martin1cerny commented 7 years ago

You are welcome :-) It was a good learning exercise to make xBIM toolkit to support all IFC physical formats for both IFC2x3 and IFC4.

Dne 5. 1. 2017 22:47 napsal uživatel "aahoo" notifications@github.com:

@martin1cerny https://github.com/martin1cerny

I didn't know about those changes to IFC XML. Thanks for clearing that up.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/IndustryFoundationClasses/Questions/issues/10#issuecomment-270767076, or mute the thread https://github.com/notifications/unsubscribe-auth/AAvL1krqrNGNi_HDpE5-j8G7vR2Xrj7Cks5rPWT2gaJpZM4LY0F6 .