Complex shape

Hi, I need to make a kind of extruded shape from a wire to another wire along a curved path.
The 2nd wire is a scaled and moved copy of the 1st one.
Which class can I use to do that ?


Stephane Routelous's picture

With OpenCASCADE, you can use BRepOffsetAPI_ThruSections to buid a shape from one wire to another one , or BRepOffsetAPI_MakePipe to create a shape from a wire and a path, but I don't know a class to combine the both.

Jerome Monaco's picture

Thanks for your answer Stephane, I've just found the class BRepOffsetAPI_MakePipeShell. This class can do what I need but there are drawing bugs ?!.

You could try the following code :
Best regards

int Test( Handle_AIS_InteractiveContext ais )
double r( 2000.0 );
double angle( 1.047 ); // 60 degres

TopoDS_Wire wbase = BRepBuilderAPI_MakeWire( BRepBuilderAPI_MakeEdge( gp_Circ( gp::XOY(), 120.0 ) ) );
TopoDS_Wire wtop = BRepBuilderAPI_MakeWire( BRepBuilderAPI_MakeEdge( gp_Circ( gp::XOY(), 60.0 ) ) );

// Tourne la section de fin pour la mettre a la bonne position
gp_Trsf rot;
rot.SetRotation( gp_Ax1( gp_Pnt( r, 0.0, 0.0 ), gp::DY() ), angle );
wtop.Move( TopLoc_Location( rot ) );

// Axe du parcours
gp_Ax2 axe( gp_Pnt( r, 0.0, 0.0 ), gp::DY() );
TopoDS_Wire profil = BRepBuilderAPI_MakeWire( BRepBuilderAPI_MakeEdge( gp_Circ( axe, r ), gp::Origin(), gp_Pnt( r - r * cos( angle ), 0.0, r * sin( angle ) ) ) );

// Creation de la coquille
BRepOffsetAPI_MakePipeShell ps( profil );
ps.Add( wbase, Standard_False, Standard_False );
ps.Add( wtop, Standard_False, Standard_False );

// Cree les donnees pour le viewer
Handle(AIS_Shape) aShape = new AIS_Shape( ps.Shape() );
ais->Display( aShape );

return( 0 );

Stephane Routelous's picture

Hi Jerome,

before sending the shape to the visualisation use :
TopoDS_Shape S = ps.Shape();
ShapeFix_Shape fixer(S);
S = fixer.Shape();

It's working better for me.


Stephane Routelous's picture

sorry, forgot to say to set the WithCorrection flag to true :
ps.Add( wbase, Standard_False, Standard_True );
ps.Add( wtop, Standard_False, Standard_True );

Jerome Monaco's picture

Hi, Stephane
I tried to fix the shape, but it doesn't work in shading mode !? even with correction flag.
For information :
- When I replace the 2 circles sections, with regular polygons section, it works very well in all display mode.
- It doesn't work only for some dimensions radius=2000mm and angle=60° other dimensions seems to be ok !!!

To solve this problem I think I'll make many sections along the arc profil and use the ThruSections class.

Thanks for your help.
Best regards.