IfcOpenShell / IfcOpenShell

Open source IFC library and geometry engine
GNU Lesser General Public License v3.0
1.83k stars 723 forks source link

IfcTester webapp development #2480

Open Moult opened 1 year ago

Moult commented 1 year ago

There is an ultra lightweight half-built vanilla JS (no framework) purely client-side webapp for IfcTester.

You can view it live at https://blenderbim.org/ifctester/ - download https://raw.githubusercontent.com/buildingSMART/IDS/master/Documentation/library/sample.ids as a sample file, click "New Spec", then press "Load". Code is here https://github.com/IfcOpenShell/IfcOpenShell/tree/v0.7.0/src/ifctester/webapp

The sample.ids is an XML file. The purpose of IfcTester is to edit that XML file using a friendly web interface that looks like a document editor. Notice how you can rename text with contenteditable fields and press the save button. Basic features for deleting and simple editing are done.

Still need to build the ability to add new sections and add new bullet points, drag and drop reorder, drag and drop between specs. Would require knowledge of Javascript (especially vanilla JS without frameworks so things like HTML5 custom elements, and very basic binding through event listeners).

This would require building some new custom elements, firing new events, little dropdown UIs, little autocomplete/autovalidate events on fields.

aothms commented 1 year ago

Awesome. It's really clean, neat yet powerful.

So what happens when you post to /audit?

Did you consider PyScript? I haven't looked at it yet, but from what I heard they got binary packages such as numpy and pandas working so why couldn't we?

We can do a parser-only build of ifcopenshell for this without opencascade so that you don't get a million mb blob in your browser.

This could be a nice initiative to finally begin experimenting with this.

Moult commented 1 year ago

Posting just does this https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.7.0/src/ifctester/webapp/app.py#L55-L77 - basic results are displayed but don't expect it on the blenderbim domain since I don't want people uploading files to my server :) and I have very little experience in what it takes to secure a Python webserver upload.

I haven't considered PyScript, it would be awesome if there was a parser only build somehow, that would also remove the need for uploading.

aothms commented 1 year ago

what it takes to secure a Python webserver upload

That's easy. Just remove ifcopenshell.

I haven't considered PyScript, it would be awesome if there was a parser only build somehow, that would also remove the need for uploading.

I think we need to do this: https://pyodide.org/en/stable/development/new-packages.html but it's all kind of new to me. Do we know anybody who might want to work on this? Maybe our CI wrangler @Krande ?

Krande commented 1 year ago

Hey, this sounds interesting. I am pretty busy up until Christmas and I am not sure if I possess the right skills for this. I don't have much frontend experience. Or have I misunderstood the task?

Moult commented 1 year ago

That's easy. Just remove ifcopenshell.

Hehehe I guess the best solution would be to put it in some rented VM in a container that can be easily wiped and redeployed :)

@Krande I think @aothms was asking about how to build IfcOpenShell sans OpenCASCADE so it could be run with PyScript in a webbrowser.

aothms commented 1 year ago

I was thinking of the CI system to setup a pyodide/wasm module for ifopsh, it's quite similar to conda (there's also some organizational ties to anaconda).

pyodide is the python interpreter ported to wasm. it can load compiled wasm-compiled python modules. pyscript is some machinery on top of pyodide to use inline python in html script tags interpreted by pyodide.

I think this is going to be awesome. Sooner or later Blender will be available in a WASM build, maybe it will have some collaborative possibilities. That's going to make BlenderBIM decades years ahead.

But sorry @Krande I'll do my own homework first and see how it goes :)

Krande commented 1 year ago

Oh, no apology needed:) I'll gladly help out in-between other things. In the meantime let me know if you have any progress! :)

BalrajDhakad commented 7 months ago

Hey, This is Balraj, I am willing to work on this project as a part of GSOC 2024. Can you guide towards the 1st step that I can take. I have good Front-end development skills and I can work on this web app.

BalrajDhakad commented 7 months ago

@Moult

BalrajDhakad commented 7 months ago

Hey is there any update on this issue, I want to work on this one, Please guide me

BalrajDhakad commented 7 months ago

@Moult

vulevukusej commented 7 months ago

@BalrajDhakad I can give you some pointers to get started, are you familiar with some backend frameworks like fastapi or flask?

BalrajDhakad commented 7 months ago

Not much familiar but I am keen towards learning new techs

BalrajDhakad commented 7 months ago

I have a strong command on javascript so I can go with other backend techs and learn them quite quick

vulevukusej commented 7 months ago

Ok, I'll write some steps for you tomorrow 💪

BalrajDhakad commented 7 months ago

Also I am familiar with Python, so it will not be hard for me to learn

BalrajDhakad commented 7 months ago

For now may I start learning about fastapi and flask

vulevukusej commented 7 months ago

Morning @BalrajDhakad! Here are some basic steps:

To start with I'd strongly recommend writing the frontend in typescript. You will benefit from all that typescript has to offer and the process of creating types to mirror the IDS facets, specifications etc. will speed up your understanding of them immensely. Ideally, we want to rely on IfcOpenShell and display the information it produces with as little translation as possible. TS will help us to control the inputs such that the user is only able to input information that is consistent with the IDS schema.

On the backend side, I'd recommend going with FastAPI, simply because the documentation is user-friendly and contains everything you need to cover the scope of this app. Having said that, I initially created a similar app using Flask, so at the end of the day it's more personal preference than anything else. The server will serve your compiled frontend code and also provide an api which we will use to load IFC files as well as edit and load IDS files.

Start by creating a single endpoint that accepts an IDS file and returns it's data as JSON. Experiment with how you do this, as you can either return all the data or partial snapshots, depending on what your UI looks like. Once you achieve this step, you're well on your way to achieving what you need for this app :).

BalrajDhakad commented 7 months ago

Okay Thanks for guiding me, I will get back to you after following and learning what all is needed 😄

BalrajDhakad commented 7 months ago

@vulevukusej

BalrajDhakad commented 7 months ago

Just one more thing is this project a part of GSOC 2024