Skip to content

Commit

Permalink
Docs for scripts done.
Browse files Browse the repository at this point in the history
  • Loading branch information
senthurayyappan committed Aug 29, 2020
1 parent 7b54bfc commit 822f66e
Show file tree
Hide file tree
Showing 17 changed files with 357 additions and 260 deletions.
111 changes: 53 additions & 58 deletions definer.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ def draw_arrow(gp_frame, p: tuple, norm: tuple, d: tuple, size: int, reverse: bo
return gp_stroke

class Anton_OT_DirectionUpdater(bpy.types.Operator):
"""Visualizes direction vector of applied force with grease pencil
"""
bl_idname = "anton.directionupdate"
bl_label = ""

Expand All @@ -86,7 +84,7 @@ class Anton_OT_DirectionUpdater(bpy.types.Operator):

def execute(self, context):
"""Instantiates an arrow at the centroid of a face on which force is applied. The instantiated arrow is
a grease pencil object whose color corresponds to the applied force.
a grease pencil object whose color corresponds to the applied force. Arrow head flips when direction sign is changed.
:return: ``FINISHED`` if successful, ``CANCELLED`` otherwise
"""
Expand Down Expand Up @@ -177,32 +175,32 @@ def execute(self, context):
return{'CANCELLED'}

class Anton_OT_Definer(bpy.types.Operator):
"""An operator class that creates a tetrahedral finite element mesh of the model with **gmsh_api**,
interprets the forces acting on the model and stores the required variables as a numpy binary file (.npy).
"""
bl_idname = 'anton.define'
bl_label = 'Anton_Definer'
bl_description = 'Defines the problem.'

def execute(self, context):
"""Iterates through all the faces of the model and creates sets of face indices.
:ivar nodes:
:vartype nodes: numpy.array
:ivar elements:
:vartype elements: numpy.array
:ivar fixed_nodes:
:vartype fixed_nodes: numpy.array
:ivar no_design_nodes:
:vartype no_design_nodes: numpy.array
:ivar forced_nodes:
:vartype forced_nodes: numpy.array
:ivar directions:
:vartype directions: OrderedDict
:ivar distributed_force:
:vartype distributed_force: OrderedDict
"""Defines the problem after creation of a tetrahedral finite element mesh and stores
the mesh variables as a binary numpy file which is accessed by ``Anton_OT_Processor``
:ivar nodes: Cartesian position of nodes
:vartype nodes: *numpy.array* of ``float``
:ivar elements: Connectivity array of nodes
:vartype elements: *numpy.array* of ``int``
:ivar fixed_nodes: Indices of fixed nodes
:vartype fixed_nodes: *numpy.array* of ``int``
:ivar no_design_nodes: Indices of non-design nodes
:vartype no_design_nodes: *numpy.array* of ``int``
:ivar forced_nodes: Indices of forced nodes
:vartype forced_nodes: *numpy.array* of ``int``
:ivar directions: Direction vector corresponding to each force
:vartype directions: ``dict``
:ivar distributed_force: Magnitude per area of each force
:vartype distributed_force: ``dict``
:return: ``FINISHED`` if successful, ``CANCELLED`` otherwise
\\
"""
scene = context.scene
active_object = bpy.data.objects[scene.anton.filename]
Expand Down Expand Up @@ -374,43 +372,40 @@ def create_geo(self,
curve_loop,
clmax):

"""Creates a tetrahedral finite element mesh of the model
:param path:
:type path: str
:param filename:
:type filename: str
:param fixed_faces:
:type fixed_faces: set
:param no_design_faces:
:type no_design_faces: set
:param forced_faces:
:type forced_faces: OrderedDict
:param forced_magnitudes:
:type forced_magnitudes: OrderedDict
"""Creates a tetrahedral finite element mesh of the object with **gmsh_api**, adds physical groups for fixed, forced and non-design space faces
and retrieves direction of each applied force from assigned vertex groups.
:param path: Workspace path
:type path: ``str``
:param filename: Name of the initialized object
:type filename: ``str``
:param fixed_faces: Indices of fixed faces
:type fixed_faces: ``set``
:param no_design_faces: Indices of non-design space faces
:type no_design_faces: ``set``
:param forced_faces: Indices of faces corresponding to each force
:type forced_faces: ``dict``
:param forced_magnitudes: Magnitude of each force
:type forced_magnitudes: ``dict``
:param forced_directions:
:type forced_directions: OrderedDict
:param forced_direction_signs:
:type forced_direction_signs: OrderedDict
:param points:
:type points: OrderedDict
:param edges:
:type edges: OrderedDict
:param curve_loop:
:type curve_loop: OrderedDict
:param geo_points:
:type geo_points: OrderedDict
:param geo_edges:
:type geo_edges: OrderedDict
:param clmax:
:type clmax: float
:return: nodes, elements, fixed_nodes, no_design_nodes, forced_nodes, directions, distributed_force
:param forced_directions: Direction of each force
:type forced_directions: ``dict``
:param forced_direction_signs: Direction sign of each force
:type forced_direction_signs: ``dict``
:param curve_loop: Connectivity of each triangle of the object
:type curve_loop: ``dict``
:param geo_points: Vertices of the object
:type geo_points: ``dict``
:param geo_edges: Edges of the object
:type geo_edges: ``dict``
:param clmax: Maximum element size
:type clmax: ``float``
:return: ``nodes``, ``elements``, ``fixed_nodes``, ``no_design_nodes``, ``forced_nodes``, ``directions``, ``distributed_force``
"""

geo = gmsh.model.geo
Expand Down
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/_build/doctrees/index.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/license.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/scripts.doctree
Binary file not shown.
16 changes: 16 additions & 0 deletions docs/_build/html/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@
Welcome to anton's documentation!
=================================

.. image:: https://img.shields.io/badge/Blender-2.80%2B-orange
:target: https://www.blender.org/
:alt: Blender

.. image:: https://app.codacy.com/project/badge/Grade/e0da62cdb7bc499b95bf70c18e8013cd
:target: https://www.codacy.com?utm_source=github.com&utm_medium=referral&utm_content=blender-for-science/anton&utm_campaign=Badge_Grade
:alt: Codacy

.. image:: https://img.shields.io/github/license/blender-for-science/blendmsh
:target: https://github.com/blender-for-science/anton/blob/master/LICENSE.md
:alt: License

.. image:: https://badges.gitter.im/blender-for-science/community.svg
:target: https://gitter.im/blender-for-science/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge
:alt: Gitter

anton is a generative design framework built on Blender, the open-source 3D creation suite.

.. image:: ../anton.gif
Expand Down
7 changes: 7 additions & 0 deletions docs/_build/html/_sources/license.rst.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
License
=======

anton is licensed to you under the `GNU General Public License <https://github.com/blender-for-science/anton/blob/master/LICENSE.md>`_ (GPL, or “free software”).

The GNU General Public License is a free, `copyleft <https://en.wikipedia.org/wiki/Copyleft>`_ license for software and other kinds of works.
The licenses for most software and other practical works are designed to take away your freedom to share
and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free software for all its users.
4 changes: 4 additions & 0 deletions docs/_build/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@

<div class="section" id="welcome-to-anton-s-documentation">
<h1>Welcome to anton’s documentation!<a class="headerlink" href="#welcome-to-anton-s-documentation" title="Permalink to this headline"></a></h1>
<a class="reference external image-reference" href="https://www.blender.org/"><img alt="Blender" src="https://img.shields.io/badge/Blender-2.80%2B-orange" /></a>
<a class="reference external image-reference" href="https://www.codacy.com?utm_source=github.com&amp;amp;utm_medium=referral&amp;amp;utm_content=blender-for-science/anton&amp;amp;utm_campaign=Badge_Grade"><img alt="Codacy" src="https://app.codacy.com/project/badge/Grade/e0da62cdb7bc499b95bf70c18e8013cd" /></a>
<a class="reference external image-reference" href="https://github.com/blender-for-science/anton/blob/master/LICENSE.md"><img alt="License" src="https://img.shields.io/github/license/blender-for-science/blendmsh" /></a>
<a class="reference external image-reference" href="https://gitter.im/blender-for-science/community?utm_source=badge&amp;utm_medium=badge&amp;utm_campaign=pr-badge"><img alt="Gitter" src="https://badges.gitter.im/blender-for-science/community.svg" /></a>
<p>anton is a generative design framework built on Blender, the open-source 3D creation suite.</p>
<img alt="anton" src="_images/anton.gif" />
<div class="toctree-wrapper compound">
Expand Down
5 changes: 5 additions & 0 deletions docs/_build/html/license.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@

<div class="section" id="license">
<h1>License<a class="headerlink" href="#license" title="Permalink to this headline"></a></h1>
<p>anton is licensed to you under the <a class="reference external" href="https://github.com/blender-for-science/anton/blob/master/LICENSE.md">GNU General Public License</a> (GPL, or “free software”).</p>
<p>The GNU General Public License is a free, <a class="reference external" href="https://en.wikipedia.org/wiki/Copyleft">copyleft</a> license for software and other kinds of works.
The licenses for most software and other practical works are designed to take away your freedom to share
and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program–to make sure it remains free software for all its users.</p>
</div>


Expand Down
Loading

0 comments on commit 822f66e

Please sign in to comment.