GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Added an helix example with Webgl/threejs · hovedguy/pythonocc-demos@3e94157

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • examples
    • core_webgl_threejs_helix.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎examples/core_webgl_threejs_helix.py‎

Copy file name to clipboard
+39Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env python
2+
3+
##Copyright 2009-2014 Jelle Feringa ([email protected])
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()

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.