290 |
The example script of the cube is included with the software in |
The example script of the cube is included with the software in |
291 |
\file{brick.py} in the \ExampleDirectory. |
\file{brick.py} in the \ExampleDirectory. |
292 |
|
|
293 |
|
\section{Alternative File Formats} |
294 |
|
\code{pycad} supports other file formats in including |
295 |
|
I-DEAS universal file, VRML, Nastran and STL. The following example shows how |
296 |
|
to generate the STL file \file{brick.stl}: |
297 |
|
\begin{python} |
298 |
|
from esys.pycad.gmsh import Design |
299 |
|
|
300 |
|
des=Design(dim=3, element_size = 0.1, keep_files=True) |
301 |
|
des.addItems(v, top, bottom, back, front, left , right) |
302 |
|
|
303 |
|
des.setFileFormat(des.STL) |
304 |
|
des.setMeshFileName("brick.stl") |
305 |
|
des.generate() |
306 |
|
\end{python} |
307 |
|
The example script of the cube is included with the software in |
308 |
|
\file{brick_stl.py} in the \ExampleDirectory. |
309 |
|
|
310 |
|
|
311 |
\begin{figure} |
\begin{figure} |
312 |
\centerline{\includegraphics[width=\figwidth]{figures/refine1}} |
\centerline{\includegraphics[width=\figwidth]{figures/refine1}} |
313 |
\caption{Local refinement at the origin by |
\caption{Local refinement at the origin by |
610 |
\end{classdesc} |
\end{classdesc} |
611 |
|
|
612 |
|
|
613 |
|
\begin{memberdesc}[Design]{GMSH} |
614 |
|
gmsh file format~\cite{GMSH}. |
615 |
|
\end{memberdesc} |
616 |
|
|
617 |
|
\begin{memberdesc}[Design]{IDEAS} |
618 |
|
I-DEAS universal file format~\cite{IDEAS}. |
619 |
|
\end{memberdesc} |
620 |
|
|
621 |
|
\begin{memberdesc}[Design]{VRML} |
622 |
|
VRML file format, \cite{VRML}. |
623 |
|
\end{memberdesc} |
624 |
|
|
625 |
|
\begin{memberdesc}[Design]{STL} |
626 |
|
STL file format~\cite{STL}. |
627 |
|
\end{memberdesc} |
628 |
|
\begin{memberdesc}[Design]{NASTRAN} |
629 |
|
NASTRAN bulk data format~\cite{NASTRAN}. |
630 |
|
\end{memberdesc} |
631 |
|
|
632 |
|
\begin{memberdesc}[Design]{MEDIT} |
633 |
|
Medit file format~\cite{MEDIT}. |
634 |
|
\end{memberdesc} |
635 |
|
|
636 |
|
\begin{memberdesc}[Design]{CGNS} |
637 |
|
CGNS file format~\cite{CGNS}. |
638 |
|
\end{memberdesc} |
639 |
|
|
640 |
|
\begin{memberdesc}[Design]{PLOT3D} |
641 |
|
Plot3D file format~\cite{PLOT3D}. |
642 |
|
\end{memberdesc} |
643 |
|
|
644 |
|
|
645 |
|
\begin{memberdesc}[Design]{DIFFPACK} |
646 |
|
Diffpack 3D file format~\cite{DIFFPACK}. |
647 |
|
\end{memberdesc} |
648 |
|
|
649 |
|
\begin{memberdesc}[Design]{DELAUNAY} |
650 |
|
the gmsh Delauny triangulator. |
651 |
|
\end{memberdesc} |
652 |
|
|
653 |
|
\begin{memberdesc}[Design]{TETGEN} |
654 |
|
the TetGen~\cite{TETGEN} triangulator. |
655 |
|
\end{memberdesc} |
656 |
|
|
657 |
|
\begin{memberdesc}[Design]{NETGEN} |
658 |
|
the NETGEN~\cite{NETGEN} triangulator. |
659 |
|
\end{memberdesc} |
660 |
|
|
661 |
|
\begin{methoddesc}[Design]{generate}{} |
662 |
|
generates the mesh file. The data are are written to the file \var{Design.getMeshFileName}. |
663 |
|
\end{methoddesc} |
664 |
|
|
665 |
|
|
666 |
\begin{methoddesc}[Design]{setDim}{\optional{dim=3}} |
\begin{methoddesc}[Design]{setDim}{\optional{dim=3}} |
667 |
sets the spatial dimension which needs to be $1$, $2$ or $3$. |
sets the spatial dimension which needs to be $1$, $2$ or $3$. |
668 |
\end{methoddesc} |
\end{methoddesc} |
679 |
returns the element order. |
returns the element order. |
680 |
\end{methoddesc} |
\end{methoddesc} |
681 |
|
|
|
|
|
682 |
\begin{methoddesc}[Design]{setElementSize}{\optional{element_size=1}} |
\begin{methoddesc}[Design]{setElementSize}{\optional{element_size=1}} |
683 |
set the global element size. The local element size at a point is defined as |
set the global element size. The local element size at a point is defined as |
684 |
the global element size multiplied by the local scale. The element size must be positive. |
the global element size multiplied by the local scale. The element size must be positive. |
689 |
returns the global element size. |
returns the global element size. |
690 |
\end{methoddesc} |
\end{methoddesc} |
691 |
|
|
|
\begin{memberdesc}[Design]{DELAUNAY} |
|
|
the gmsh Delauny triangulator. |
|
|
\end{memberdesc} |
|
692 |
|
|
|
\begin{memberdesc}[Design]{TETGEN} |
|
|
the TetGen~\cite{TETGEN} triangulator. |
|
|
\end{memberdesc} |
|
|
|
|
|
\begin{memberdesc}[Design]{NETGEN} |
|
|
the NETGEN~\cite{NETGEN} triangulator. |
|
|
\end{memberdesc} |
|
693 |
|
|
694 |
\begin{methoddesc}[Design]{setKeepFilesOn}{} |
\begin{methoddesc}[Design]{setKeepFilesOn}{} |
695 |
work files are kept at the end of the generation. |
work files are kept at the end of the generation. |
713 |
|
|
714 |
|
|
715 |
\begin{methoddesc}[Design]{setMeshFileName}{\optional{name=None}} |
\begin{methoddesc}[Design]{setMeshFileName}{\optional{name=None}} |
716 |
sets the name for the gmsh mesh file. if no name is given a name with extension "msh" is generated. |
sets the name for the mesh file. if no name is given a name is generated. |
717 |
|
The format is set by \var{Design.setFileFormat}. |
718 |
\end{methoddesc} |
\end{methoddesc} |
719 |
|
|
720 |
\begin{methoddesc}[Design]{getMeshFileName}{} |
\begin{methoddesc}[Design]{getMeshFileName}{} |
721 |
returns the name of the file for the gmsh msh |
returns the name of the mesh file |
722 |
\end{methoddesc} |
\end{methoddesc} |
723 |
|
|
724 |
|
|
727 |
\warning{If a \PropertySet is added as an item added object that are not |
\warning{If a \PropertySet is added as an item added object that are not |
728 |
part of a \PropertySet are not considered in the messing. |
part of a \PropertySet are not considered in the messing. |
729 |
} |
} |
|
|
|
730 |
\end{methoddesc} |
\end{methoddesc} |
731 |
|
|
732 |
\begin{methoddesc}[Design]{getItems}{} |
\begin{methoddesc}[Design]{getItems}{} |
740 |
\begin{methoddesc}[Design]{getMeshHandler}{} |
\begin{methoddesc}[Design]{getMeshHandler}{} |
741 |
returns a handle to the mesh. The call of this method generates the mesh from the geometry and |
returns a handle to the mesh. The call of this method generates the mesh from the geometry and |
742 |
returns a mechanism to access the mesh data. In the current implementation this |
returns a mechanism to access the mesh data. In the current implementation this |
743 |
method returns a file name for a gmsh file containing the mesh data. |
method returns a file name for a file containing the mesh data. |
744 |
\end{methoddesc} |
\end{methoddesc} |
745 |
|
|
746 |
\begin{methoddesc}[Design]{getScriptString}{} |
\begin{methoddesc}[Design]{getScriptString}{} |
761 |
\begin{methoddesc}[Design]{getTagMap}{} |
\begin{methoddesc}[Design]{getTagMap}{} |
762 |
returns a \class{TagMap} to map the name \class{PropertySet} in the class to tag numbers generated by gmsh. |
returns a \class{TagMap} to map the name \class{PropertySet} in the class to tag numbers generated by gmsh. |
763 |
\end{methoddesc} |
\end{methoddesc} |
764 |
|
|
765 |
|
\begin{methoddesc}[Design]{setFileFormat}{\optional{format=\var{Design.GMSH}}} |
766 |
|
set the file format. \var{format} must be one of the values |
767 |
|
\var{Design.GMSH}, |
768 |
|
\var{Design.IDEAS}, |
769 |
|
\var{Design.VRML}, |
770 |
|
\var{Design.STL}, |
771 |
|
\var{Design.NASTRAN}, |
772 |
|
\var{Design.MEDIT}, |
773 |
|
\var{Design.CGNS}, |
774 |
|
\var{Design.PLOT3D} or |
775 |
|
\var{Design.DIFFPACK}. |
776 |
|
\end{methoddesc} |
777 |
|
|
778 |
|
\begin{methoddesc}[Design]{sgetFileFormat}{} |
779 |
|
returns the file format. |
780 |
|
\end{methoddesc} |