Is there an easy way to make a cylinder with one slanted end ?
I've succeded with the boolean Cut operator, but it's quite heavy...
Thanks
John
Gianluca Antoniacci Tue, 04/27/2021 - 16:41
What if you create the boundary curves (one circle and one ellipse) and then you create a mesh surface from the first cuve to the second one? This would give the lateral surface. Usinig the top and the bottom surfaces, you could build a shell and eventually the solid associated to the cilindrical wedge...
Hey Gianluca,
Thanks for you answer, this is exactly what I've been trying .
For both ends of the cylinder (including the slanted one) are OK.
For some reason, the outer cylinder doesn't appear.
Here is the code :
// Left Surface wire.
BRepBuilderAPI_MakeWire LeftSurface_Outer_WireMaker;
// Outer Wire : Left outer diameter.
Handle(Geom_Circle) LeftSurface_OuterCircle = GC_MakeCircle(LeftSurface_Axis, EdgeRadius );
TopoDS_Edge LeftSurface_OuterCircle_Edge = BRepBuilderAPI_MakeEdge( LeftSurface_OuterCircle );
LeftSurface_Outer_WireMaker.Add( LeftSurface_OuterCircle_Edge );
// Make a face from the Outer wire.
TopoDS_Face LeftSurface_Face = BRepBuilderAPI_MakeFace( LeftSurface_Outer_WireMaker, Standard_True );
// Right WEDGE surface
// Right Surface Normal.
gp_Dir RightSurface_Normal_gpDir( Geometry_RightSurface_Vertex_GlobalBasis.Nx, Geometry_RightSurface_Vertex_GlobalBasis.Ny, Geometry_RightSurface_Vertex_GlobalBasis.Nz );
// Right Surface Vertex.
gp_Pnt RightSurface_Vertex_gpPnt( Geometry_RightSurface_Vertex_GlobalBasis.X, Geometry_RightSurface_Vertex_GlobalBasis.Y, Geometry_RightSurface_Vertex_GlobalBasis.Z );
// Basis.
auto RightSurface_Axis = gp_Ax2( RightSurface_Vertex_gpPnt, RightSurface_Normal_gpDir );
// Right Surface wire.
BRepBuilderAPI_MakeWire RightSurface_WireMaker;
// Right Wire : Right outer diameter.
Handle(Geom_Ellipse) RightSurface_WedgeEllipse = GC_MakeEllipse( RightSurface_Axis, EdgeRadius/( IRISmath::cos( WedgeAngle )), EdgeRadius );
TopoDS_Edge RightSurface_OuterCircle_Edge = BRepBuilderAPI_MakeEdge( RightSurface_WedgeEllipse );
RightSurface_WireMaker.Add( RightSurface_OuterCircle_Edge );
// Make a face from the Outer wire.
TopoDS_Face RightSurface_Face = BRepBuilderAPI_MakeFace( RightSurface_WireMaker, Standard_True );
// Cylindrical Edge of the window.
// Outer Cylinder surface
TopoDS_Face EdgeCylinder_Face = BRepBuilderAPI_MakeFace( gp_Cylinder( LeftSurface_Axis , EdgeRadius ), 0.0, 2*M_PI, 0.0, - ( Thickness + EdgeRadius/( IRISmath::cos( WedgeAngle )) ) );
// Modify face according to the Right wire.
EdgeCylinder_Face = BRepBuilderAPI_MakeFace( EdgeCylinder_Face, RightSurface_WireMaker);
for the outer cylinder I was thinking of something like this:
// C# syntax
//ConvertToBspline is a function of yours that does exactly what you think! ;)
Geom_BSplineCurve splineCurve1 = ConvertToBspline(leftCurve);
Geom_BSplineCurve splineCurve2 = ConverrtToBspline(rightCurve);
GeomFill_BSplineCurves curves = new GeomFill_BSplineCurves(splineCurve1, splineCurve2, GeomFill_FillingStyle.GeomFill_CoonsStyle);
Geom_BSplineSurface surface = curves.Surface();
Now you can build the outer TopoDS_Face out of this surface.
Tue, 04/27/2021 - 16:41
What if you create the boundary curves (one circle and one ellipse) and then you create a mesh surface from the first cuve to the second one? This would give the lateral surface. Usinig the top and the bottom surfaces, you could build a shell and eventually the solid associated to the cilindrical wedge...
Gianluca
Tue, 04/27/2021 - 18:05
Hey Gianluca,
Thanks for you answer, this is exactly what I've been trying .
For both ends of the cylinder (including the slanted one) are OK.
For some reason, the outer cylinder doesn't appear.
Here is the code :
// Left Surface wire.
BRepBuilderAPI_MakeWire LeftSurface_Outer_WireMaker;
// Outer Wire : Left outer diameter.
Handle(Geom_Circle) LeftSurface_OuterCircle = GC_MakeCircle(LeftSurface_Axis, EdgeRadius );
TopoDS_Edge LeftSurface_OuterCircle_Edge = BRepBuilderAPI_MakeEdge( LeftSurface_OuterCircle );
LeftSurface_Outer_WireMaker.Add( LeftSurface_OuterCircle_Edge );
// Make a face from the Outer wire.
TopoDS_Face LeftSurface_Face = BRepBuilderAPI_MakeFace( LeftSurface_Outer_WireMaker, Standard_True );
// Right WEDGE surface
// Right Surface Normal.
gp_Dir RightSurface_Normal_gpDir( Geometry_RightSurface_Vertex_GlobalBasis.Nx, Geometry_RightSurface_Vertex_GlobalBasis.Ny, Geometry_RightSurface_Vertex_GlobalBasis.Nz );
// Right Surface Vertex.
gp_Pnt RightSurface_Vertex_gpPnt( Geometry_RightSurface_Vertex_GlobalBasis.X, Geometry_RightSurface_Vertex_GlobalBasis.Y, Geometry_RightSurface_Vertex_GlobalBasis.Z );
// Basis.
auto RightSurface_Axis = gp_Ax2( RightSurface_Vertex_gpPnt, RightSurface_Normal_gpDir );
// Right Surface wire.
BRepBuilderAPI_MakeWire RightSurface_WireMaker;
// Right Wire : Right outer diameter.
Handle(Geom_Ellipse) RightSurface_WedgeEllipse = GC_MakeEllipse( RightSurface_Axis, EdgeRadius/( IRISmath::cos( WedgeAngle )), EdgeRadius );
TopoDS_Edge RightSurface_OuterCircle_Edge = BRepBuilderAPI_MakeEdge( RightSurface_WedgeEllipse );
RightSurface_WireMaker.Add( RightSurface_OuterCircle_Edge );
// Make a face from the Outer wire.
TopoDS_Face RightSurface_Face = BRepBuilderAPI_MakeFace( RightSurface_WireMaker, Standard_True );
// Cylindrical Edge of the window.
// Outer Cylinder surface
TopoDS_Face EdgeCylinder_Face = BRepBuilderAPI_MakeFace( gp_Cylinder( LeftSurface_Axis , EdgeRadius ), 0.0, 2*M_PI, 0.0, - ( Thickness + EdgeRadius/( IRISmath::cos( WedgeAngle )) ) );
// Modify face according to the Right wire.
EdgeCylinder_Face = BRepBuilderAPI_MakeFace( EdgeCylinder_Face, RightSurface_WireMaker);
Tue, 04/27/2021 - 20:03
Hint: use "Insert code snippet" to post your code for better readability.
Wed, 04/28/2021 - 09:30
Hello Robert,
for the outer cylinder I was thinking of something like this:
Now you can build the outer TopoDS_Face out of this surface.
I hope this might help...
Gianluca
Wed, 04/28/2021 - 00:13
Hey Kirill,
Understood, thanks !
Any suggestions concerning the slanted cylinder ;)
Regards,
John