ThatOpen / web-ifc-viewer

Graphics engine and toolkit for client applications.
MIT License
953 stars 235 forks source link

serializeAllProperties returns lines in a different structure than getLine from ifcApi #168

Closed quasarchimaere closed 1 year ago

quasarchimaere commented 1 year ago

Retrieving all the lines as a properties blob is great, however the lines that are retrieved do not have the same structure as the ones that you get from the getLine function. Digging into IFCWorker.js:88765 the cause is very clear:

getItemProperty(modelID, id, properties) {
        try {
            const props = await this.webIfc.GetLine(modelID, id);
            if (props.type) {
                props.type = IfcTypesMap[props.type]; // ******** Q: Why is the type replaced from the number to the string?
            }
            this.formatItemProperties(props);
            properties[id] = props;
        }
        catch (e) {
            console.log(`There was a problem getting the properties of the item with ID ${id}`);
        }
    }
    formatItemProperties(props) {
        Object.keys(props).forEach((key) => {
            const value = props[key];
            if (value && value.value !== undefined)
                props[key] = value.value; // ************** Q: Why do you set it directly to the value and drop the object structure underneath
            else if (Array.isArray(value))
                props[key] = value.map((item) => {
                    if (item && item.value)
                        return item.value; // ************** Q: Same Question as above
                    return item;
                });
        });
    }

2 Questions:

aka-blackboots commented 1 year ago

::take

agviegas commented 1 year ago

🟢🟢🟢

::take

Hi, @aka-blackboots! Thanks for taking this bounty! The due date is January 2, 2023 UTC.

If you need to submit some pull requests (PR) to complete the tasks, make sure that the last and only the last PR has a title that either starts with the bounty ID or is exactly the same as the bounty name. After the PR is merged, this bounty’s status will automatically changed to done.

If you do not need to make a PR, tell the manager @agviegas to run ::done command after your tasks is confirmed to be done.

Good luck!

aka-blackboots commented 1 year ago

::drop

agviegas commented 1 year ago

🟢🟢🟢

::drop

Hi, @aka-blackboots! Thanks for giving it a try! It’s now once again available for anyone to take.

quasarchimaere commented 1 year ago

::take

agviegas commented 1 year ago

🟢🟢🟢

::take

Hi, @quasarchimaere! Thanks for taking this bounty! The due date is January 2, 2023 UTC.

If you need to submit some pull requests (PR) to complete the tasks, make sure that the last and only the last PR has a title that either starts with the bounty ID or is exactly the same as the bounty name. After the PR is merged, this bounty’s status will automatically changed to done.

If you do not need to make a PR, tell the manager @agviegas to run ::done command after your tasks is confirmed to be done.

Good luck!

quasarchimaere commented 1 year ago

::drop

agviegas commented 1 year ago

🟢🟢🟢

::drop

Hi, @quasarchimaere! Thanks for giving it a try! It’s now once again available for anyone to take.

D4ve-R commented 1 year ago

::take

agviegas commented 1 year ago

🟢🟢🟢

::take

Hi, @D4ve-R! Thanks for taking this bounty! The due date is February 21, 2023 UTC.

If you need to submit some pull requests (PR) to complete the tasks, make sure that the last and only the last PR has a title that either starts with the bounty ID or is exactly the same as the bounty name. After the PR is merged, this bounty’s status will automatically changed to done.

If you do not need to make a PR, tell the manager @agviegas to run ::done command after your tasks is confirmed to be done.

Good luck!

D4ve-R commented 1 year ago

@agviegas can be marked as done, same issues with github's resolve comment, sorry about that!

agviegas commented 1 year ago

🔴🔴🔴

Hi, @D4ve-R! The date is past due, your assignment has been revoked. It’s now available for anyone to take.

agviegas commented 1 year ago

@D4ve-R take this and I'll mark it as done. Sorry for the delay!

D4ve-R commented 1 year ago

@agviegas no worries!

D4ve-R commented 1 year ago

::take

agviegas commented 1 year ago

🟢🟢🟢

::take

Hi, @D4ve-R! Thanks for taking this bounty! The due date is March 19, 2023 UTC.

If you need to submit some pull requests (PR) to complete the tasks, make sure that the last and only the last PR has a title that either starts with the bounty ID or is exactly the same as the bounty name. After the PR is merged, this bounty’s status will automatically changed to done.

If you do not need to make a PR, tell the manager @agviegas to run ::done command after your tasks is confirmed to be done.

Good luck!

agviegas commented 1 year ago

::done

agviegas commented 1 year ago

🟢🟢🟢

::done

Hi, @D4ve-R! Thanks for your contributions! Please submit an expense to IFC.js Open Collective. Then, tell us the invoice number via the ::expense::_____ command (replace the _____ with the invoice number).

D4ve-R commented 1 year ago

::expense::125715

agviegas commented 1 year ago

🟢🟢🟢

::expense::125715

Hi, @D4ve-R! Thanks for the confirmation! We’ll proceed to review the expense. Once it’s approved, the payment will be scheduled.