Surface roughness/ bumpy surface with Open Cascade

Hi everyone,

I am trying to make a surface roughness from a surface(TopoDS_Face/ or Geom_Surface). Is there any idea where should I start? 

Thank you very much, I really appreciate your help!

 

Kirill Gavrilov's picture

What do you mean by surface roughness? A microsurface material features (these are normally not encoded into B-Spline as it would make surface definition of enormous size) or something else?

tran201_161733's picture

Hi Kirill, 

By surface roughness, I mean I could load on a surface, and make it bumpy (rough) like the top face of the box in pic 1 and the side of the cylinder in pic 2.

So far, I can do it with the box, here is the approach:

_ Read in the box object (TopoDS_Shape) and use TopExp_Explorer to get the top face of the box.

_ Remove the top face by using BRepOffsetAPI_MakeThickSolid

_ Convert the removed face(top face) into BSplineSurface

_ Use the GeomPlate_BuildPlateSurface to build the top rough surface (constraints curves are used from the original removed face and constraints points is modified from the original points from the removed face as well, because of being converted to BSplineSurface, these points and curves are accessible)

The problem is this method only works with a plate surface (kind of planar surface), it does not work with cylindrical surface.

I wonder when I convert the surface into BSplineSurface, can I modified that BSplineSurface? Such as move the point of the surface along their normal vector at the point? I see the Geom_BSplineSurface::Transform that applies the transformation T to this BSpline surface, but is there a function that only transforms a point on the BSpline surface? There is a Geom_BSplineSurface::MovePoint function, but I am confused with the documentation and not sure what it does.

Another approach that I think of is set the poles for the BSpline surface, so that it can bends the surface based on these poles (or rather control points if I am not mistaken).

Last but not least, I see the Geom_CylindricalSurface surface is defined with the a specific parametric equation, as in the OCC tutorial. Is there any way I can create a surface with a defined parametric equation as well? If possible, I would just create an equation that generates the surface that is rough. But ultimately, if I can modify the BSpline surface, that would be the best.

Thank you very much for your time,

I would really appreciate your help!

Tin Tran.

Attachments: 
Kirill Gavrilov's picture

Is there any way I can create a surface with a defined parametric equation as well?
If possible, I would just create an equation that generates the surface that is rough.

All surfaces implement Geom_Surface interface - like methods returning derivatives D0(), D1() and others, so that technically it is possible defining your own analytical surface.
In practice, OCCT algorithms highly rely on a list of predefined surface classes making a custom one (it will have GeomAbs_OtherSurface type) of merely no use - you will have to make a research to see if something will work.

I wonder when I convert the surface into BSplineSurface, can I modified that BSplineSurface?

If you have already found how to modify BSplineSurface create from a plane, then what is the problem?

One thing to take into account is that once Surface is put into TopoDS_Face and then into another Shape (shell, compound, etc.), it should be considered "sealed" or immutable.
So that to modify a Face, you need creating a NEW one (and make a copy of BSpline surface) and then replace original Face with the new one in shape using tools like BRepTools_ReShape (which will produce a new Shape with replaced Face).

tran201_161733's picture

 Hi Kirill, I highly appreciate your help, but it seems like you misunderstood my problem.

If you have already found how to modify BSplineSurface create from a plane, then what is the problem?

My problem is that how to modify a BsplineSurface create from a cylindrical surface

Btw, the reason why I can modify a BsplineSurface create from a plane is that I can use the GeomPlate_BuildPlateSurface to make a surface from constrains. But the GeomPlate_BuildPlateSurface function is not relevant to a cylindrical surface. I really want to modify a BsplineSurface directly. 

How can I modify a BsplineSurface directly?

 I see the Geom_BSplineSurface::Transform that applies the transformation T to this BSpline surface, but is there a function that only transforms a point on the BSpline surface? There is a Geom_BSplineSurface::MovePoint, does that function move the points of the BSplineSurface? If yes, how can I do it? The documentation seems to be confusing.

Thank you very much for your help!

Tin Tran.

Kirill Gavrilov's picture

But the GeomPlate_BuildPlateSurface function is not relevant to a cylindrical surface.

ShapeCustom::ConvertToBSpline() might be helpful for converting into B-Splines, although I don't know if it works with cylindrical surfaces or only on other surface types.

There is a Geom_BSplineSurface::MovePoint, does that function move the points of the BSplineSurface?

Sorry, I'm not much familiar with B-Spline edition mechanics.
Sometimes it might be useful digging into OCCT source code to understand how thing works, if documentation is unclear.

tran201_161733's picture

Submitted by Trong Tin Tran on 12 August, 2020 - 00:15

Hi  Kririll,

Here is an alternative way that I try to approach this problem

I convert the shape in to mesh by using BRepMesh_IncrementalMesh, then modify the nodes by using BRep_Tool:: Triangulation, it seems to work with a sphere but not a planar or cylindrical surface because of not having enough nodes on those surface to move. For example, there are ton of nodes to represent a sphere, but only 3 to 4 nodes to represent a planar surface.

Do you know how to increase the number of nodes when converting a shape into mesh?

Thank you very much!

Kirill Gavrilov's picture

This is expected behavior - BRepMesh tries to emit a minimal amount of triangles required to satisfy deflection parameters, which is just a couple of triangles in case of a planar surface.
Unlike more configurable meshers like Express Mesh, BRepMesh has no parameters like maximal element size.

Either, mesh refining algorithm should be applied as post-processor (splitting triangles into smaller ones) or another meshing algorithm to be used (or BRepMesh itself could be extended with more options).