|
| 1 | +#!/usr/bin/env python |
| 2 | + |
| 3 | + |
| 4 | +## |
| 5 | +##This file is part of pythonOCC. |
| 6 | +## |
| 7 | +##pythonOCC is free software: you can redistribute it and/or modify |
| 8 | +##it under the terms of the GNU Lesser General Public License as published by |
| 9 | +##the Free Software Foundation, either version 3 of the License, or |
| 10 | +##(at your option) any later version. |
| 11 | +## |
| 12 | +##pythonOCC is distributed in the hope that it will be useful, |
| 13 | +##but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | +##MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | +##GNU Lesser General Public License for more details. |
| 16 | +## |
| 17 | +##You should have received a copy of the GNU Lesser General Public License |
| 18 | +##along with pythonOCC. If not, see <http://www.gnu.org/licenses/>. |
| 19 | +from math import pi |
| 20 | + |
| 21 | +from OCC.Core.gp import gp_Pnt2d, gp_XOY, gp_Lin2d |
| 22 | +from OCC.Core.Geom2dAPI import Geom2dAPI_Interpolate, Geom2dAPI_PointsToBSpline |
| 23 | +from OCC.Core.TColgp import TColgp_HArray1OfPnt2d, TColgp_Array1OfPnt2d |
| 24 | +from OCC.Core.BRepBuilderAPI import BRepBuilderAPI_MakeEdge, BRepBuilderAPI_MakeEdge2d |
| 25 | +from OCC.Display.WebGl import threejs_renderer |
| 26 | +from OCC.Core.gp import gp_XOY, gp_Ax3, gp_Dir2d |
| 27 | +from OCC.Core.Geom import Geom_CylindricalSurface |
| 28 | +from OCC.Core.GCE2d import GCE2d_MakeSegment |
| 29 | + |
| 30 | +# First buil an helix |
| 31 | +aCylinder = Geom_CylindricalSurface(gp_Ax3(gp_XOY()), 6.0) |
| 32 | +aLine2d = gp_Lin2d (gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 1.0)) |
| 33 | +aSegment = GCE2d_MakeSegment(aLine2d, 0.0, pi * 2.0) |
| 34 | + |
| 35 | +helix_edge = BRepBuilderAPI_MakeEdge(aSegment.Value(), aCylinder.GetHandle(), 0.0, 6.0 * pi).Edge() |
| 36 | + |
| 37 | +display = threejs_renderer.ThreejsRenderer() |
| 38 | +display.DisplayShape(helix_edge, color=(1, 0, 0), line_width=1.) |
| 39 | +display.render() |