XbimGeometry icon indicating copy to clipboard operation
XbimGeometry copied to clipboard

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

Open CCT-Mukund-Thakare opened this issue 1 year ago • 8 comments

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

CCT-Mukund-Thakare avatar Feb 19 '24 12:02 CCT-Mukund-Thakare

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

andyward avatar Feb 19 '24 16:02 andyward

@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 avatar Feb 20 '24 06:02 CCT-Mukund-Thakare

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

Thank you !!

CCT-Mukund-Thakare avatar Feb 26 '24 05:02 CCT-Mukund-Thakare

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?

martin1cerny avatar Feb 26 '24 11:02 martin1cerny

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 avatar Feb 27 '24 06:02 CCT-Mukund-Thakare

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

Thank you !!

CCT-Mukund-Thakare avatar Mar 05 '24 04:03 CCT-Mukund-Thakare

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 !!

CCT-Mukund-Thakare avatar Mar 07 '24 07:03 CCT-Mukund-Thakare

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

andyward avatar Mar 07 '24 10:03 andyward