Revision 1060 - (hide annotations)
Mon Mar 26 05:11:10 2007 UTC (14 years, 1 month ago) by ksteube
File MIME type: text/x-python
File size: 1337 byte(s)
```A new pycad example which shows how to have an object with a cutout area

```
 1 ksteube 1060 """ 2 a trapezoid with a cutout 3 4 @var __author__: Ken Steube 5 @var __url__: http://www.iservo.edu.au/esys/escript 6 @var __date__: 26 March 2007 7 """ 8 9 10 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF 11 12 Primary Business: Queensland, Australia""" 13 __license__="""Licensed under the Open Software License version 3.0 14 15 __author__="Ken Steube, k.steube@uq.edu.au" 16 __url__= 17 __version__="\$Revision\$" 18 __date__="\$Date\$" 19 20 from esys.pycad import * 21 from esys.pycad.gmsh import Design 22 from esys.finley import MakeDomain 23 24 # A trapezoid 25 p0=Point(0.0, 0.0, 0.0) 26 p1=Point(1.0, 0.0, 0.0) 27 p2=Point(1.0, 0.5, 0.0) 28 p3=Point(0.0, 1.0, 0.0) 29 l01=Line(p0, p1) 30 l12=Line(p1, p2) 31 l23=Line(p2, p3) 32 l30=Line(p3, p0) 33 c=CurveLoop(l01, l12, l23, l30) 34 35 # A small triangular cutout 36 x0=Point(0.1, 0.1, 0.0) 37 x1=Point(0.5, 0.1, 0.0) 38 x2=Point(0.5, 0.2, 0.0) 39 x01=Line(x0, x1) 40 x12=Line(x1, x2) 41 x20=Line(x2, x0) 42 cutout=CurveLoop(x01, x12, x20) 43 44 s=PlaneSurface(c, holes=[cutout]) 45 46 d=Design(dim=2, element_size=0.05) 47 d.addItems(s) 48 49 d.setScriptFileName("trapezoid.geo") 50 d.setMeshFileName("trapezoid.msh") 51 dom=MakeDomain(d, integrationOrder=-1, reducedIntegrationOrder=-1, optimizeLabeling=True) 52 dom.write("trapezoid.fly") 53