Boundries on a bspline surface

Everything DG Kernel: Technical discussions and issues
Post Reply
Abhinav R S
Posts: 1
Joined: Mon Nov 04, 2024 10:23 pm

Boundries on a bspline surface

Post by Abhinav R S »

Hi,

I need to build mesh out of some surfaces with curved boundaries. I can use IStdShape_DG to create a surface, but I do not understand how to set the constraints on the boundaries: I have boundaries as B-spline curves (lines, ellipses, ...). How can I add these boundaries to the surface and get a mesh in the end?

Best regards,
XYZ
Posts: 1
Joined: Tue Nov 05, 2024 7:33 pm

Re: Boundries on a bspline surface

Post by XYZ »

This is what the brep structures are for. They mix surfaces and curves to form faces, which can be converted to mesh.

Create an entity with BRep geometry:

Code: Select all

IEntity_DG entity = m_gen.Create<IEntity_DG>("BRep").As<IEntity_DG>();
IGeometry_DG geometry = entity.GetGeometry().As<IGeometry_DG>();
IBRepGeometry_DG brepGeom = geometry.As<IBRepGeometry_DG>();
Code from DGKernel_7_2\Samples\NET\C#\ObjArray\NewGenericObjectForm.cs.

Add a face and attach the surface:

Code: Select all

IBRepShape_DG shape = iGeomBRep.CreateShape(ShapeType_DG.Face);
IBRepFace_DG face = shape.As<IBRepFace_DG>();
face.Surface = yourIUVSurface_DG;
Adding the boundary (wire)

Code: Select all

IBRepWire_DG wire = face.AddNewWire();
IBRepEdge_DG edge = wire.AddNewEdge(true);
edge.SetCurve(yourICurve_DG);
This assumes you have a single closed curve. For a multi-edge case repeat AddNewEdge() and SetCurve() calls.

Also, this needs the curves to be located exactly on the surface, otherwise you will have exceptions at some point. One way to ensure that is to define the curve(s) in the surface's u,v parameters and use IBRepEdge_DG.SetPCurve().
Another way is using projections like IUVSurface_DG.GetCurveProjection().

In case of multiple edges, ends of the curves must coincide up to like e-8 tolerance.

To get the mesh use entity.SetGeometryTypeEx()
and query IMesh_DG either out of the return or the entity.

Or add the entity to a new model instead and save as a mesh format: vrml, stl, obj.

Regards
Post Reply