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

How to get outer Edges for an IfcEntity using Xbim library ? #465

Open
CCT-Mukund-Thakare opened this issue Feb 19, 2024 · 8 comments
Open

Comments

@CCT-Mukund-Thakare
Copy link

Hello @andyward,

I want to get the outer edges of the IfcEntity.
Is there any API already implemented in Xbim SDK, that will return the Edges for a IfcEntity ?

If not, How can I add an API in Xbim SDK to get such a edges ?
As per my current understanding and investigation,
I need to modify the XbimGeoemtryEngine repo for getting an edges, since XbimGeometryEngine uses native open cascade code to generate triangulation for an IfcEntity, I could see BrepIncremental mesh function is being used to get the triangulation for an IfcEntity.

Are there methods to get edges from XibmOccShape ?
What is most efficient way to generate edges for an IfcEntity in Xbim SDK ?
Which are the files I should modify in order to use this returnEdge API like any other API ?

What is an edge for a IfcEntity ?
In below reference image of IfcWall, The black outer border are the edges that I am referring to.
image

@andyward
Copy link
Member

I'm assuming you're asking for the wireframe edges rather than the mathematical Edges? Unless @martin1cerny knows better I don't think there's a simple example showing how to extract this. It's possible this is easier in v6 GE now we have the full OCC model to work but it's not my skillset TBH

@CCT-Mukund-Thakare
Copy link
Author

@martin1cerny

How to get wire-frame edges (meaning that discretized edge by triangulation), even if we need to modify implementation of Xbim.Geometry and its APIs ?
Which assembly version (V5.1.0 or V6) I should modify, so that it will be easy for us ?

Things that I have done till now,

  1. Created a new method CreateEdgeGeometry in class XbimGeometryCreator based upon method CreateShapeGeometry.

  2. Created a new method WriteEdgeTriangulation in class XbimOccShape based upon WriteTriangulation method that takes in a Binary Writer and writes the Edge Data.

  3. Created a Wrapper Method in XbimGeometryEngine Class that casts the _engine as XbimGeometryCreator and calls the underlying CreateEdgeGeometry

With these changes we create a custom local package and add it to our project to access the CreateEdgeGeometry from an instance of XbimGeometryEngine
With these things done, we are still trying to figure out the following :

  1. Is this the proper way to add new functionality ?
  2. In the WriteTriangulation method, is the Triangulation is recomputed, for performance reason ?
  3. What Type would be more suitable to pass to the CreateEdgeGeometry method and return the vertices of the edge ?
    We want to pass the XbimShapeInstance and query its edge data?

Also, I've checked the latest v6 branch and see a lot of changes there ?
These Some of these classes are not available or have been refactored there. Could you help us figure out
what would be the proper way to implement this in v6 branch ?

Thank you !!

@CCT-Mukund-Thakare
Copy link
Author

@martin1cerny
Hello,
Did get chance to check the previous comment ? Can you please review the previous comment and share your thoughts ?

Thank you !!

@martin1cerny
Copy link
Member

Hi @CCT-Mukund-Thakare , you are right, there are many changes coming with V6. We have been talking about edge generation for a long time but never got to it properly. It is great you have bought the bullet and went to implement it! I assume you are willing to contribute this back to the Toolkit project? Shall we organise a call to see how to work together on this?

@CCT-Mukund-Thakare
Copy link
Author

Hello @martin1cerny
Yes for sure, let's connect over a call.
These are my teams email ID -
[email protected]
[email protected]
[email protected]
[email protected]

You can schedule a call according to your available time or let me know your available time I will arrange one call.
Agenda will be -

  1. Current API design that we have implemented
  2. OCCT code to get edges.
  3. Ideal API design strategy for getting the edges.

Thank you !!

@CCT-Mukund-Thakare
Copy link
Author

Hello @martin1cerny
Commenting to take update on call\discussion request mentioned in previous comment.

Thank you !!

@CCT-Mukund-Thakare
Copy link
Author

Hello @andyward @martin1cerny

I have code ready at my end for getting the edges, I wanted to commit it.
I have created branch issues/issues465, I am able to commit it locally but I am not able to push the branch to origin.
I am getting this error, it seem's I am not able to access the origin for XbimEssentials and XbimGeometry and I think it is obvious for security reasons.

image

Any idea or suggestions on how can I push this branch to origin so that I can create PR and then have a discussion around it.
Waiting for your reply !!

Thank you !!

@andyward
Copy link
Member

andyward commented Mar 7, 2024

Hi @CCT-Mukund-Thakare

You need to push the commits to your own github repo, and then you can make a PR back to the repo in XbimTeam

i.e.

  1. Fork the relevant xbimTeam repo to your account
  2. Update your local remotes to include your fork
  3. git push to your new fork
  4. create a PR back to the origin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants