From aee3d7c1ac4a690fd9baddd867b080a4f660cf0d Mon Sep 17 00:00:00 2001 From: imsenthur Date: Tue, 1 Sep 2020 03:22:34 +0530 Subject: [PATCH] Moved imports. --- definer.py | 11 +++++++---- initializer.py | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/definer.py b/definer.py index bb350d9..015497b 100644 --- a/definer.py +++ b/definer.py @@ -1,7 +1,6 @@ from collections import OrderedDict import bpy import numpy as np -import gmsh_api.gmsh as gmsh import os def get_grease_pencil(gpencil_obj_name='GPencil') -> bpy.types.GreasePencil: @@ -203,6 +202,8 @@ def execute(self, context): \\ """ + import gmsh_api.gmsh as gmsh + scene = context.scene active_object = bpy.data.objects[scene.anton.filename] @@ -374,7 +375,7 @@ def create_geo(self, clmax): """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. + and retrieves direction of each applied force from assigned vertex groups. :param path: Workspace path :type path: ``str`` @@ -389,7 +390,7 @@ def create_geo(self, :type forced_faces: ``dict`` :param forced_magnitudes: Magnitude of each force :type forced_magnitudes: ``dict`` - + :param forced_directions: Direction of each force :type forced_directions: ``dict`` :param forced_direction_signs: Direction sign of each force @@ -409,6 +410,8 @@ def create_geo(self, :return: ``nodes``, ``elements``, ``fixed_nodes``, ``non_design_nodes``, ``forced_nodes``, ``directions``, ``distributed_force`` """ + import gmsh_api.gmsh as gmsh + geo = gmsh.model.geo lc = clmax @@ -540,7 +543,7 @@ def compute_direction(points): return vec/vec_mag @staticmethod - def compute_area(points): + def compute_area(points): v1 = points[1] - points[0] v2 = points[2] - points[0] v3 = np.cross(v1, v2) diff --git a/initializer.py b/initializer.py index 0549f70..973caa6 100644 --- a/initializer.py +++ b/initializer.py @@ -1,7 +1,6 @@ import bpy import numpy as np import os -from scipy.spatial import ConvexHull class Anton_OT_ForceUpdater(bpy.types.Operator): bl_idname = "anton.forceupdate" @@ -96,6 +95,7 @@ def execute(self, context): if not scene.anton.defined: if scene.anton.mode == 'HULL': + from scipy.spatial import ConvexHull objects = list() points = list()