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 core_webgl* examples · hovedguy/pythonocc-demos@35b0523

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • assets/models
    • 3864470050F1.zip
  • examples
    • core_webgl_threejs_bigfile.py
    • core_webgl_threejs_bigfile_multipleshapes.py
    • core_webgl_threejs_bigfile_oneshape.py
    • core_webgl_threejs_cylinderhead_faces.py
    • core_webgl_x3dom_bigfile_multipleshapes.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎assets/models/3864470050F1.zip‎

Copy file name to clipboard
42.4 MB
Binary file not shown.
Collapse file

‎examples/core_webgl_threejs_bigfile.py‎

Copy file name to clipboard
+31Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env python
2+
3+
##Copyright 2009-2016 Thomas Paviot ([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+
20+
import os
21+
22+
from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeTorus
23+
24+
from OCC.Extend.DataExchange import read_step_file
25+
from OCC.Display.WebGl import threejs_renderer
26+
27+
big_shp = read_step_file(os.path.join('..', 'assets', 'models', 'RC_Buggy_2_front_suspension.stp'))
28+
29+
my_renderer = threejs_renderer.ThreejsRenderer()
30+
my_renderer.DisplayShape(big_shp)
31+
my_renderer.render()
Collapse file

‎examples/core_webgl_threejs_bigfile_multipleshapes.py‎

Copy file name to clipboard
+38Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env python
2+
3+
##Copyright 2009-2016 Thomas Paviot ([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+
20+
import os
21+
22+
from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeTorus
23+
24+
from OCC.Extend.DataExchange import read_step_file
25+
from OCC.Extend.TopologyUtils import TopologyExplorer
26+
from OCC.Display.WebGl import threejs_renderer
27+
28+
# opens a big step file
29+
# render each part of the assembly as a shape
30+
big_shp = read_step_file(os.path.join('..', 'assets', 'models', '3864470050F1.stp'))
31+
32+
all_subshapes = TopologyExplorer(big_shp).solids()
33+
34+
my_renderer = threejs_renderer.ThreejsRenderer()
35+
for single_shape in all_subshapes:
36+
my_renderer.DisplayShape(single_shape)
37+
# then call the renderer
38+
my_renderer.render()
Collapse file

‎examples/core_webgl_threejs_bigfile_oneshape.py‎

Copy file name to clipboard
+33Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env python
2+
3+
##Copyright 2009-2016 Thomas Paviot ([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+
20+
import os
21+
22+
from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeTorus
23+
24+
from OCC.Extend.DataExchange import read_step_file
25+
from OCC.Display.WebGl import threejs_renderer
26+
27+
# opens a big step file
28+
# render the whole assembly as a single shape
29+
big_shp = read_step_file(os.path.join('..', 'assets', 'models', 'RC_Buggy_2_front_suspension.stp'))
30+
31+
my_renderer = threejs_renderer.ThreejsRenderer()
32+
my_renderer.DisplayShape(big_shp)
33+
my_renderer.render()
Collapse file

‎examples/core_webgl_threejs_cylinderhead_faces.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 Thomas Paviot ([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+
20+
from OCC.Display.WebGl import threejs_renderer
21+
from OCC.Core.BRep import BRep_Builder
22+
from OCC.Core.TopoDS import TopoDS_Shape
23+
from OCC.Core.BRepTools import breptools_Read
24+
25+
from OCC.Extend.TopologyUtils import TopologyExplorer
26+
27+
# loads brep shape
28+
cylinder_head = TopoDS_Shape()
29+
builder = BRep_Builder()
30+
breptools_Read(cylinder_head, '../assets/models/cylinder_head.brep', builder)
31+
32+
# render cylinder head in x3dom
33+
my_renderer = threejs_renderer.ThreejsRenderer()
34+
35+
all_faces = TopologyExplorer(cylinder_head).faces()
36+
# display each face
37+
for face in all_faces:
38+
my_renderer.DisplayShape(face)
39+
my_renderer.render()
Collapse file

‎examples/core_webgl_x3dom_bigfile_multipleshapes.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-2016 Thomas Paviot ([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+
20+
import os
21+
22+
from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeTorus
23+
24+
from OCC.Extend.DataExchange import read_step_file
25+
from OCC.Extend.TopologyUtils import TopologyExplorer
26+
from OCC.Display.WebGl import x3dom_renderer
27+
28+
# opens a big step file
29+
# render each part of the assembly as a shape
30+
# The file is from https://grabcad.com/library/briggs-stratton-vangaurd-23-hp-engine-1
31+
big_shp = read_step_file(os.path.join('..', 'assets', 'models', '3864470050F1.stp'))
32+
33+
all_subshapes = TopologyExplorer(big_shp).solids()
34+
35+
my_renderer = x3dom_renderer.X3DomRenderer()
36+
for single_shape in all_subshapes:
37+
my_renderer.DisplayShape(single_shape)
38+
# then call the renderer
39+
my_renderer.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.