Skip to content

Instantly share code, notes, and snippets.

@arnholm
Last active July 16, 2019 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arnholm/cf42fa8000bf253bada605c2ae8d71ac to your computer and use it in GitHub Desktop.
Save arnholm/cf42fa8000bf253bada605c2ae8d71ac to your computer and use it in GitHub Desktop.

OpenSCAD sample from http://forum.openscad.org/OpenSCAD-performance-numbers-td4707.html

num=20;
for (i=[0:num-1])
  rotate([0,0,i*360/num])
    translate([40,0,0])
      rotate([0,i*90,0])
        scale([0.7,1,1])
          rotate_extrude() translate([10,0,0]) circle(r=2);
OpenSCAD 2019.03.31
https://www.openscad.org/

Copyright (C) 2009-2019 The OpenSCAD Developers

This program is free software; you can redistribute it and/or modify 
it under the terms of the GNU General Public License as published by 
the Free Software Foundation; either version 2 of the License, 
or (at your option) any later version.

Loaded design '/home/ca/STL/bracelet.scad'.
Compiling design (CSG Tree generation)...
Compiling design (CSG Products generation)...
Geometries in cache: 3
Geometry cache size in bytes: 30776
CGAL Polyhedrons in cache: 0
CGAL cache size in bytes: 0
Compiling design (CSG Products normalization)...
Normalized CSG tree has 20 elements
Compile and preview finished.
Total rendering time: 0 hours, 0 minutes, 0 seconds

Parsing design (AST generation)...
Compiling design (CSG Tree generation)...
Rendering Polygon Mesh using CGAL...
Geometries in cache: 32
Geometry cache size in bytes: 912144
CGAL Polyhedrons in cache: 1
CGAL cache size in bytes: 10311392
Total rendering time: 0 hours, 0 minutes, 15 seconds
Top level object is a 3D object:
Simple: yes
Vertices: 4200
Halfedges: 24032
Edges: 12016
Halffacets: 15632
Facets: 7816
Volumes: 21
Rendering finished.
$ polyfix bracelet.stl 

Parameters:
  input_file = bracelet.stl


polyhedron 0 ================= volume=9558.08, dtol=0.01, atol=1e-06, maxiter=10
iteration 0: vertices=25200 faces=8400
             warning: nonmanifold edges: uc(1)=25200 
             merged 21000 vertices
             total changes=21000
             no warnings

iteration 1: vertices=4200 faces=8400
             total changes=0
             no warnings

Summary: 
             polyhedron 0: vertices=4200 faces=8400 : no warnings

Writing: bracelet_1.stl

... polyfix finished, time used: 0d 00h 00m 00s

Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

AngelCAD version

shape@ main_shape()
{
   solid@ obj = null;
   uint num = 20;
   for(uint i=0;i<num;i++) {
      solid@ part = rotate_z(deg:i*360.0/num)
                    *translate(40,0,0)
                    *rotate_y(deg:i*90)
                    *scale(0.7,1,1)
                    *rotate_x(deg:90)  // To duplicate OpenSCAD definition
                    *rotate_extrude(translate(10,0,0)*circle(r:2),deg:360);
      if(@obj == null) @obj = part;
      else             @obj = obj + part;
                    
   }
   return obj;
}

void main()
{
   shape@ obj = main_shape();
   obj.write_xcsg(GetInputFullPath(),secant_tolerance:0.14);
}
as_csg started.

Created XCSG file: xcsg/bracelet.xcsg
as_csg v1.3-01 finished, time used: 0d 00h 00m 00.010s

23347 > "/home/ca/cpde_usr/bin/xcsg" --dxf --stl --svg --fullpath "/home/ca/STL/xcsg/bracelet.xcsg"
xcsg processing: /home/ca/STL/xcsg/bracelet.xcsg
processing solid: union3d
...completed CSG tree: 19 boolean operations to process.
...starting boolean operations
...boolean progress: 5.2% 
...boolean progress: 10.5% 
...boolean progress: 15.7% 
...boolean progress: 21% 
...boolean progress: 26.3% 
...boolean progress: 31.5% 
...boolean progress: 36.8% 
...boolean progress: 42.1% 
...boolean progress: 47.3% 
...boolean progress: 52.6% 
...boolean progress: 57.8% 
...boolean progress: 63.1% 
...boolean progress: 68.4% 
...boolean progress: 73.6% 
...boolean progress: 78.9% 
...boolean progress: 84.2% 
...boolean progress: 89.4% 
...boolean progress: 94.7% 
...boolean progress: 100% 
...completed boolean operations in 1.337 [sec] 
...result model contains 20 lumps.
...lump 1: 210 vertices, 170 polygon faces.
...Polyhedron is water-tight (edge use-count check OK)
...Polyhedron has no degenerated faces (face area check OK)
...Polyhedron has 170 non-triangular faces
...Triangulating lump ... 
...Triangulation completed with 420 triangle faces in 0.008 [sec]
...lump 2: 210 vertices, 170 polygon faces.
...Polyhedron is water-tight (edge use-count check OK)
...Polyhedron has no degenerated faces (face area check OK)
...Polyhedron has 170 non-triangular faces
...Triangulating lump ... 
...Triangulation completed with 420 triangle faces in 0.016 [sec]
...lump 3: 210 vertices, 170 polygon faces.
...Polyhedron is water-tight (edge use-count check OK)
...Polyhedron has no degenerated faces (face area check OK)
...Polyhedron has 170 non-triangular faces
...Triangulating lump ... 
...Triangulation completed with 420 triangle faces in 0.025 [sec]
...lump 4: 210 vertices, 170 polygon faces.
...Polyhedron is water-tight (edge use-count check OK)
...Polyhedron has no degenerated faces (face area check OK)
...Polyhedron has 170 non-triangular faces
...Triangulating lump ... 
...Triangulation completed with 420 triangle faces in 0.033 [sec]
...lump 5: 210 vertices, 170 polygon faces.
...Polyhedron is water-tight (edge use-count check OK)
...Polyhedron has no degenerated faces (face area check OK)
...Polyhedron has 170 non-triangular faces
...Triangulating lump ... 
...Triangulation completed with 420 triangle faces in 0.041 [sec]
...lump 6: 210 vertices, 170 polygon faces.
...Polyhedron is water-tight (edge use-count check OK)
...Polyhedron has no degenerated faces (face area check OK)
...Polyhedron has 170 non-triangular faces
...Triangulating lump ... 
...Triangulation completed with 420 triangle faces in 0.05 [sec]
...lump 7: 210 vertices, 170 polygon faces.
...Polyhedron is water-tight (edge use-count check OK)
...Polyhedron has no degenerated faces (face area check OK)
...Polyhedron has 170 non-triangular faces
...Triangulating lump ... 
...Triangulation completed with 420 triangle faces in 0.058 [sec]
...lump 8: 210 vertices, 170 polygon faces.
...Polyhedron is water-tight (edge use-count check OK)
...Polyhedron has no degenerated faces (face area check OK)
...Polyhedron has 170 non-triangular faces
...Triangulating lump ... 
...Triangulation completed with 420 triangle faces in 0.067 [sec]
...lump 9: 210 vertices, 170 polygon faces.
...Polyhedron is water-tight (edge use-count check OK)
...Polyhedron has no degenerated faces (face area check OK)
...Polyhedron has 170 non-triangular faces
...Triangulating lump ... 
...Triangulation completed with 420 triangle faces in 0.075 [sec]
...lump 10: 210 vertices, 170 polygon faces.
...Polyhedron is water-tight (edge use-count check OK)
...Polyhedron has no degenerated faces (face area check OK)
...Polyhedron has 170 non-triangular faces
...Triangulating lump ... 
...Triangulation completed with 420 triangle faces in 0.084 [sec]
...lump 11: 210 vertices, 170 polygon faces.
...Polyhedron is water-tight (edge use-count check OK)
...Polyhedron has no degenerated faces (face area check OK)
...Polyhedron has 170 non-triangular faces
...Triangulating lump ... 
...Triangulation completed with 420 triangle faces in 0.092 [sec]
...lump 12: 210 vertices, 170 polygon faces.
...Polyhedron is water-tight (edge use-count check OK)
...Polyhedron has no degenerated faces (face area check OK)
...Polyhedron has 170 non-triangular faces
...Triangulating lump ... 
...Triangulation completed with 420 triangle faces in 0.1 [sec]
...lump 13: 210 vertices, 170 polygon faces.
...Polyhedron is water-tight (edge use-count check OK)
...Polyhedron has no degenerated faces (face area check OK)
...Polyhedron has 170 non-triangular faces
...Triangulating lump ... 
...Triangulation completed with 420 triangle faces in 0.108 [sec]
...lump 14: 210 vertices, 170 polygon faces.
...Polyhedron is water-tight (edge use-count check OK)
...Polyhedron has no degenerated faces (face area check OK)
...Polyhedron has 170 non-triangular faces
...Triangulating lump ... 
...Triangulation completed with 420 triangle faces in 0.117 [sec]
...lump 15: 210 vertices, 170 polygon faces.
...Polyhedron is water-tight (edge use-count check OK)
...Polyhedron has no degenerated faces (face area check OK)
...Polyhedron has 170 non-triangular faces
...Triangulating lump ... 
...Triangulation completed with 420 triangle faces in 0.125 [sec]
...lump 16: 210 vertices, 170 polygon faces.
...Polyhedron is water-tight (edge use-count check OK)
...Polyhedron has no degenerated faces (face area check OK)
...Polyhedron has 170 non-triangular faces
...Triangulating lump ... 
...Triangulation completed with 420 triangle faces in 0.133 [sec]
...lump 17: 210 vertices, 170 polygon faces.
...Polyhedron is water-tight (edge use-count check OK)
...Polyhedron has no degenerated faces (face area check OK)
...Polyhedron has 170 non-triangular faces
...Triangulating lump ... 
...Triangulation completed with 420 triangle faces in 0.141 [sec]
...lump 18: 210 vertices, 170 polygon faces.
...Polyhedron is water-tight (edge use-count check OK)
...Polyhedron has no degenerated faces (face area check OK)
...Polyhedron has 170 non-triangular faces
...Triangulating lump ... 
...Triangulation completed with 420 triangle faces in 0.15 [sec]
...lump 19: 210 vertices, 170 polygon faces.
...Polyhedron is water-tight (edge use-count check OK)
...Polyhedron has no degenerated faces (face area check OK)
...Polyhedron has 170 non-triangular faces
...Triangulating lump ... 
...Triangulation completed with 420 triangle faces in 0.158 [sec]
...lump 20: 210 vertices, 170 polygon faces.
...Polyhedron is water-tight (edge use-count check OK)
...Polyhedron has no degenerated faces (face area check OK)
...Polyhedron has 170 non-triangular faces
...Triangulating lump ... 
...Triangulation completed with 420 triangle faces in 0.166 [sec]
...Exporting results 
Created STL file     : /home/ca/STL/xcsg/bracelet.stl
xcsg finished using 0h 0m 1.51s
$ polyfix bracelet.stl 

Parameters:
  input_file = bracelet.stl


polyhedron 0 ================= volume=10187.2, dtol=0.01, atol=1e-06, maxiter=10
iteration 0: vertices=25200 faces=8400
             warning: nonmanifold edges: uc(1)=25200 
             merged 21000 vertices
             total changes=21000
             no warnings

iteration 1: vertices=4200 faces=8400
             total changes=0
             no warnings

Summary: 
             polyhedron 0: vertices=4200 faces=8400 : no warnings

Writing: bracelet_1.stl

... polyfix finished, time used: 0d 00h 00m 00s

Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment