WRL to BREP

Technical discussions
John McAdams
Posts: 2
Joined: Tue Jan 21, 2020 7:16 am

WRL to BREP

Postby John McAdams » Tue Jan 21, 2020 7:20 am

Hello
I have one general question about KernelCAD 6. Does it have any facility to convert existing file formats to the BREP format? That is, could I load a WRL or STL file and have a BREP file saved without needing to perform my own conversion process? I'm just working out what I may need to do when I move to KC6. The BREP format looks really good for performing more advanced 3D editing.
I would appreciate any insights
Thank you

nickz
Site Admin
Posts: 202
Joined: Fri Jul 26, 2013 3:58 am

Re: WRL to BREP

Postby nickz » Wed Jan 22, 2020 2:15 am

Hi John
It is a good question

DGK loads and saves brep objects OK. DataFlow sample has a filter for it. But the problem is that during saving to brep DGK persistence skips mesh and other objects which do not have step-compliant internal geometry.

So the main thing is how the surface is defined internally. Formats are a secondary thing.

Converting point cloud to mesh is relatively simple algorithm. So mesh is practically raw data consisting of points. Step/brep format on the other hand defines surfaces with equations. Getting equations out or raw data is a problem for which there is not automatic generic solution. Often it is just not possible.

So DGK does not do anything about mesh to step (brep) conversion. There is no message about it as we assume we are inside some application and it is up to the developer to show messages or not. This can be checked using IEntity_DG.GetGeometryType(). We will look at adding something like IModel_DG.IsMixedGeometryTypes() in 6.1.

This conversion is possible when you have some additional information about the surface. For example if you know approximately where the faces/patches are. Then the surface of each patch can be approximated using the points (after some mess of extracting the relevant subset). So unfortunately it is specific work.

Conversion of step/brep to mesh is easy. It is used to do rendering. In code it can be done using IGeometry_DG.Copy(IGeometry_DG) like

Code: Select all

iMyMeshGeometry.Copy(iMyBrepGeometry);

Regards

John McAdams
Posts: 2
Joined: Tue Jan 21, 2020 7:16 am

Re: WRL to BREP

Postby John McAdams » Thu Jan 23, 2020 3:21 am

Thank you, Nick

I've found the BREP format can store both mesh and solids. It looks quite sophisticated. I wrote an export function yesterday and found it stores mesh data in the same way you store it internally in KC3. It stores vertex locations as a list, then facet indices referencing the list.

My aim now is to have some way to translate my current mesh geometry (VRML or STL) to a solid format so I can perform boolean operations. BREP would be one format I could work with. I have to start with STL/VRML as that's the geometry created by 3D foot scanners.

I played with the ACIS SAT (Spatial Technology) format a few years ago. It appears to be similar to BREP in that it can store mesh and solid geometry together. I wrote an export function to write a SAT file. That worked successfully but the SAT file I created (mesh only) was very slow to manipulate in a CAD program.

John

nickz
Site Admin
Posts: 202
Joined: Fri Jul 26, 2013 3:58 am

Re: WRL to BREP

Postby nickz » Mon Jan 27, 2020 2:51 am

Thank you, John
We need to look at it asap
Regards


Return to “General Issues”

Who is online

Users browsing this forum: No registered users and 1 guest