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

Porting BIMServer to IFC 4.3_RC #1236

Open
dkurillo opened this issue Jan 27, 2022 · 18 comments
Open

Porting BIMServer to IFC 4.3_RC #1236

dkurillo opened this issue Jan 27, 2022 · 18 comments
Labels

Comments

@dkurillo
Copy link

Does somebody plan to port BimServer to the latest version of IFC standard? Is it difficult, are there any pitfalls?

@hlg
Copy link
Member

hlg commented Jan 27, 2022

We are planning to add IFC4.3 with the final version and official release.

@hlg hlg added the feature label Jan 27, 2022
@epeter-
Copy link

epeter- commented Jan 27, 2022 via email

@muren400
Copy link
Contributor

muren400 commented Aug 1, 2023

Hi, are there any news regarding support for IFC4.3?

@muren400
Copy link
Contributor

muren400 commented Aug 8, 2023

If I wanted to add support for IFC4X3 or some other IFC Schema myself, what steps would I go through to accomplish that? Is there some documentation regarding that topic?

@hlg
Copy link
Member

hlg commented Oct 19, 2023

I still have not found the time to review and reproduce the schema update process and thus cannot give instructions from the top of my head. I would go as follows: First compile issues and commits where the schema has been changed previously, e.g. to IFC4 ADD2 TC1 or IFC4 in general, or the process has been discussed (partly). Check the files that have changed and read related code, e.g. CodeMigrator.java.

Basically, I think we need to 1. generate ecore from the new Express files, 2. derive the genmodel from the ecore, 3. generate derived classes, 4. cater for database migrations, 5. adjust any schema specific code. The latter might be easier after #1158, but this would be a larger endeavour.

@PavelWhiteTiger
Copy link

PavelWhiteTiger commented Oct 23, 2023

Do we need models.ecore or IFC4X3_ADD2.ecore ?
And how i can get models.ecore ?

@hlg
Copy link
Member

hlg commented Oct 23, 2023

I think models.ecore is just a collection of the various packages. For example, the IFC2x3 package in models.ecore should be identical to the one in ifc2x3tc1.ecore. I have not done a diff, maybe you can verify. The difference between IFC packages and other packages (store, log, geometry) is just that the EMF models (*.ecore) for IFC packages are derived from EXPRESS models (*.exp) and the other packages are directly maintained as EMF models, for example using Eclipse tooling for modelling. Then, the models are in some regards treated the same, e.g. for database storage.

I forgot that with a new schema, we also need to touch many plugins, most notably IfcPlugins with serializers and deserializers. There are also different predefined queries for each schema. Basically, I would search the whole code base for occurrences of the existing IFC schema names in code or filenames. Then walk through the findings and for each occurrence understand why schemas are treated differently and how to fit in the new schema.

@monrus
Copy link

monrus commented Feb 21, 2024

Hi, we prepared support of ifc4x3. We would like to do PR and publish a new version

@hlg
Copy link
Member

hlg commented Feb 21, 2024

Great, I saw your PR in opensourceBIM/BuildingSMARTLibrary as well as the work in the monrus/IfcPlugins fork with no PR yet. Other than those two and this repository, I think there are no other affected opensourceBIM repositories, are they?

For BIMserver itself I did not find your fork yet. You are welcome to go ahead and submit a PR. As this will be a bit larger of a change and more involved, review and testing will take a bit longer though. I would like to do a release before merging the PR, with the changes currently in master, and then after the merge. In the meantime, others could also build, test and use the snapshot from your fork.

Would you also share documentation of the steps in the procedure, such that we can put that in the Wiki and easily reproduce this in the future for IFC4X4?

@monrus
Copy link

monrus commented Feb 22, 2024

We prepared changes on the BimServer repository but haven't published them on GitHub yet (use our own private repositories). Currently, we work with the version that supports ifc4x3 and it looks good for our use cases via the java client. The main problem with publishing it to GitHub is that we do other changes that need to be separated. I am going to do it next week.

I will prepare documentation with steps (your comments on #1306 were very helpful) and describe some cases which, I think, still contain problems.

@hlg hlg mentioned this issue May 17, 2024
@muren400
Copy link
Contributor

Hi, are there any updates on ifc4x3? I saw that #1315 was closed but not merged.

@monrus
Copy link

monrus commented Jul 22, 2024 via email

@muren400
Copy link
Contributor

Did they say why? Maybe there where too many changes not related to ifc4x3?

Yeah a rough step by step guide would be great. Maybe we can boil it down to a PR purely supporting the new schema. Maybe that will be accepted.

@monrus
Copy link

monrus commented Jul 23, 2024

Did they say why? Maybe there where too many changes not related to ifc4x3?

Yeah a rough step by step guide would be great. Maybe we can boil it down to a PR purely supporting the new schema. Maybe that will be accepted.

There were few reasons, one of them is to many changes not related to ifc4x3. I will prepare a guide. Also, you can write to me by email with any questions.

@muren400
Copy link
Contributor

muren400 commented Jul 30, 2024

Hi,

so I think i could isolate the necessary steps from your commits to this list:

preparing IFC4x3_ADD2.ecore

  • Update ths BuildingSMARTLibrary repository (this has already been done by @hlg right?)
  • Add IFC4x3_ADD2.exp
  • Create Ifc4x3Add2.java containing Code to generate IFC4x3_ADD2.ecore from IFC4x3_ADD2.exp
  • Generate IFC4x3_ADD2.ecore

preparing models.ecore

  • Add a new migration step. In this case Step0057.java
  • Update and execute CodeMigrator to update models.ecore

Generating classes

  • Generate models.genmodel from models.ecore
  • Here IfcProduct.geometry had to be added manually
  • I also removed all the changes to models.genmodel that are not under the ifc4x3 node
  • Generate ifc4x3 classes from models.genmodel

Editing BIMserver classes

Here we have to add schema specific code which after editing a few bits and pieces to make it more generic leaves these steps:

  • add new ifc Schema to org.bimserver.emf.Schema and org.bimserver.plugins.SchemaName
  • Update initHasInverse and getInverseOrOpposite in org.bimserver.emf.PackageMetaData
  • Update org.bimserver.ifc.IfcModel.getMismatches
  • Update APPLICATION_SCHEMA_VERSION in org.bimserver.database.Database
  • Create Ifc4x3OfficialPsets.java
  • Update IfcUtils and the corresponding Unit classes

IfcModel.getMismatches kind of holds the same information as PackageMetaData.initHasInverse and getInverseOrOpposite combined. Maybe there is also room for simplification?

Generate JSON files

  • Create ifc4x3-geometry.json using GenerateGeometryLibrary.java
  • Create ifc4x3-stlib (How do we generate this?)

Updating Plugins

  • Update IfcPlugins
  • Update BIMview.ws
  • Update BIMSurfer
  • IfcOpenShellPlugin
  • Is there more?

Updating BIMsurfer and BIMview.ws requires updating BIMserver-JavaScript-API for wich we need to generate a ifc4x3.json file. Is there a generator for this somewhere or where does it come from?

I saw that you doubled the size of Database.cidToEclass. Was there a specific reason for that? cid is a short so Short.MAX_VALUE is already the max possible value, right?

Did I miss anything?

@hlg
Copy link
Member

hlg commented Jul 30, 2024

Thank you for the overview, very helpful. We have just started a research project, where the IFC4x3 update is in the workplan, but because the funding approval was postponed by ages, this ended up in the schedule only for the beginning of 2025. I am bringing this forward now and will start with it right away (after a release). We would do a clean implementation on the basis of the work done by @monrus. I was not able to go through it in detail yet. If you want to help - great! We can also use email ([email protected]) to organize or have a call.

As for your questions: The stdlib files are boilerplate query includes and I think they are created manually. For ifc4x3-stdlib.json, I would copy ifc4-stdlib.json, go through the changes in the schema and adjust respectively. For the schema files (e.g. ifc4x3.json) I had to search a bit - there is org.bimserver.IfcSchemaToJson.java to generate them. The generated files are then located in BimServer/www/js.

@muren400
Copy link
Contributor

Oh, that's great to hear. I also have a stripped down and a little revisited version of @monrus work that's working but not really tested very well yet. I created the overview based on that. I can push that branch on Thursday and you could check it out and see if you can use any of that.

@monrus
Copy link

monrus commented Jul 31, 2024

Hi,

so I think i could isolate the necessary steps from your commits to this list:

preparing IFC4x3_ADD2.ecore

  • Update ths BuildingSMARTLibrary repository (this has already been done by @hlg right?)
  • Add IFC4x3_ADD2.exp
  • Create Ifc4x3Add2.java containing Code to generate IFC4x3_ADD2.ecore from IFC4x3_ADD2.exp
  • Generate IFC4x3_ADD2.ecore

preparing models.ecore

  • Add a new migration step. In this case Step0057.java
  • Update and execute CodeMigrator to update models.ecore

Generating classes

  • Generate models.genmodel from models.ecore
  • Here IfcProduct.geometry had to be added manually
  • I also removed all the changes to models.genmodel that are not under the ifc4x3 node
  • Generate ifc4x3 classes from models.genmodel

Editing BIMserver classes

Here we have to add schema specific code which after editing a few bits and pieces to make it more generic leaves these steps:

  • add new ifc Schema to org.bimserver.emf.Schema and org.bimserver.plugins.SchemaName
  • Update initHasInverse and getInverseOrOpposite in org.bimserver.emf.PackageMetaData
  • Update org.bimserver.ifc.IfcModel.getMismatches
  • Update APPLICATION_SCHEMA_VERSION in org.bimserver.database.Database
  • Create Ifc4x3OfficialPsets.java
  • Update IfcUtils and the corresponding Unit classes

IfcModel.getMismatches kind of holds the same information as PackageMetaData.initHasInverse and getInverseOrOpposite combined. Maybe there is also room for simplification?

Generate JSON files

  • Create ifc4x3-geometry.json using GenerateGeometryLibrary.java
  • Create ifc4x3-stlib (How do we generate this?)

Updating Plugins

  • Update IfcPlugins
  • Update BIMview.ws
  • Update BIMSurfer
  • IfcOpenShellPlugin
  • Is there more?

Updating BIMsurfer and BIMview.ws requires updating BIMserver-JavaScript-API for wich we need to generate a ifc4x3.json file. Is there a generator for this somewhere or where does it come from?

I saw that you doubled the size of Database.cidToEclass. Was there a specific reason for that? cid is a short so Short.MAX_VALUE is already the max possible value, right?

Did I miss anything?

Hi, I think you have described the steps very well so far and i don't know what else to add. Regarding ifc4x3-stdlib.json, we create it manually from ifc4-stdlib.json. As i remember, we used IfcSchemaToJson but excluded domain because couldn't find a source file which used to extract domain

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

6 participants