Skip to content
Snippets Groups Projects
Select Git revision
  • d792a3163f7bfe51f68b575e389ef2231ed6b450
  • master default protected
  • patch_releases_4_14
  • overlaps_tags_and_distributed_export
  • overlaps_tags_and_distributed_export_rebased
  • relaying
  • alphashapes
  • steplayer
  • bl
  • pluginMeshQuality
  • fixBugsAmaury
  • hierarchical-basis
  • new_export_boris
  • oras_vs_osm
  • reassign_partitions
  • distributed_fwi
  • rename-classes
  • fix/fortran-api-example-t4
  • robust_partitions
  • reducing_files
  • fix_overlaps
  • gmsh_4_14_0
  • gmsh_4_13_1
  • gmsh_4_13_0
  • gmsh_4_12_2
  • gmsh_4_12_1
  • gmsh_4_12_0
  • gmsh_4_11_1
  • gmsh_4_11_0
  • gmsh_4_10_5
  • gmsh_4_10_4
  • gmsh_4_10_3
  • gmsh_4_10_2
  • gmsh_4_10_1
  • gmsh_4_10_0
  • gmsh_4_9_5
  • gmsh_4_9_4
  • gmsh_4_9_3
  • gmsh_4_9_2
  • gmsh_4_9_1
  • gmsh_4_9_0
41 results

CutPlane.cpp

Blame
  • wikipedia.py 695 B
    #!/usr/bin/env python
    
    from gmshpy import *
    
    # from http://en.wikipedia.org/wiki/Constructive_solid_geometry
    
    R = 1.4;
    s = .7;
    t = 1.25;
    myModel = GModel();
    myModel.addBlock([-R,-R,-R],[R,R,R]);
    
    myTool = GModel();
    myTool.addSphere(0,0,0,R*t);
    
    myModel.computeBooleanIntersection(myTool);
    
    myTool2 = GModel();
    myTool2.addCylinder([-2*R,0,0],[2*R,0,0],R*s);
    
    myTool3 = GModel();
    myTool3.addCylinder([0,-2*R,0],[0,2*R,0],R*s);
    
    myModel2 = GModel();
    myModel2.addCylinder([0,0,-2*R],[0,0,2*R],R*s);
    myModel2.computeBooleanUnion(myTool2);
    myModel2.computeBooleanUnion(myTool3);
    
    myModel.computeBooleanDifference(myModel2);
    
    myModel.setAsCurrent();
    
    myModel.mesh(3);
    
    #FlGui.instance();
    #FlGui.run();