engine_web-ifc
engine_web-ifc copied to clipboard
Add support for inverse attributes
::drop
🟢🟢🟢
::drop
Hi, @agviegas! Thanks for giving it a try! It’s now once again available for anyone to take.
::take
::take
🟢🟢🟢
::take
Hi, @agviegas! Thanks for taking this bounty! The due date is November 10, 2022 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!
::drop
🟢🟢🟢
::drop
Hi, @agviegas! Thanks for giving it a try! It’s now once again available for anyone to take.
::take
🟢🟢🟢
::take
Hi, @beachtom! Thanks for taking this bounty! The due date is November 10, 2022 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!
PR Submitted - I need to do a PR to web-ifc-three to add the inverse flag to the methods but will do that once this is approved and finalized
@beachtom, PR merged. Please proceed!
@aka-blackboots thanks! I think I will need to wait for a new release before I can do so though
::done
::done
I had a quick glance at the PR and I see IFC4x2 and IFC2x4 ... can you confirm how this feature is used? Both IFC2X4 and IFC4X2 are not ISO-standardised schema identifiers, so are you sure you've parsed the inverses from the correct EXPRESS definition? I would assume to see IFC2X3 and IFC4.
Is it possible to attach a code snippet demonstrating how this feature is used?
Hi Dion - thanks for commenting. At the moment this feature is not available in the web-ifc-three or the viewer until the core team release a new version. - but all you need to do is change the final parameter of getLine to true and it will fetch the inverse properties i .e.
const lineData = await ifcAPI.GetLine(modelID, lineNo, true,true);
I do agree with the inconsistent naming to be honest. I just changed what was already there for this issue - but perhaps it is something that should be looked at.
@agviegas do you have any thoughts on this.
I've tested this out and it seems we can only go one level deep. Eg. IfcSite --> IfcRelContainedInSpatialStructure --> IfcBuilding . But it stops there.
Is there a way we can traverse the whole graph database?
@myoualid you are right - there is an error here. I have raised a PR to fix
@beachtom I just chatted with @myoualid and there was a misunderstanding. Because this function returns a nested object it should never traverse inverse attribute relationships since they will always be cyclical. The way you've done it looks good (I saw on @myoualid 's screen). Congrats!
Food for thought as a completely separate feature, if you do want to recursively traverse, you can do it on direct attributes only, as the subgraph will be acyclic.
Happy to close this issue, but would be good to get some closure on the weird schema identifiers.
@Moult thanks! After I did some code and tried that I realised that of course it will always be cyclical. I think it is better to leave for the developer using this API call to decide how they want to traverse inverse attributes - I could add some checks to ensure no cyclical references are returned - but this will still lead to large traversals which may not always be what someone needs/wants.
Can someone close this?- For the schema identifier can you raise a separate issue - I'm planning on contributing more to web-ifc - so it may well be something I can look at.