v0.13.0
Classes | Functions | Variables
print_rollers Namespace Reference

Classes

class  RigidBody
 

Functions

def split_string_to_vector3 (txt)
 
def is_not_vtk (file)
 
def get_euler_angles_from_vectors (vec1, vec2)
 
def get_capped_cone (origin, orientation, radius1, angle, height, resolution)
 

Variables

int MAX_NB_OF_ROLLERS = 10
 
int resolution = 64
 
dictionary rigid_bodies_dict = {}
 
 parser
 
 help
 
 nargs
 
 args
 
 unknown
 
 key
 
string file_vtu = os.path.splitext(file)[0] + ".vtu"
 
 mesh = pv.read(file)
 
int index = 0
 
list all_bodies = []
 
 id_array = mesh['_ROLLER_ID'][index]
 
 body_type_id = mesh['_BODY_TYPE'][index]
 
 orientation_vec = mesh['_ORIENTATION'][index]
 
 roller_data = mesh['_ROLLER_DATA'][index]
 
 rigid_body = RigidBody()
 

Function Documentation

◆ get_capped_cone()

def print_rollers.get_capped_cone (   origin,
  orientation,
  radius1,
  angle,
  height,
  resolution 
)

Definition at line 45 of file print_rollers.py.

45 def get_capped_cone(origin, orientation, radius1, angle, height, resolution):
46 
47  orientation_np = np.array(orientation)
48  scale = np.linalg.norm(orientation_np)
49  norm_orientation = orientation_np / scale
50 
51  full_h = radius1 / np.tan(angle * np.pi / 180)
52  new_origin = origin + norm_orientation * (full_h - height) / 2.
53  body_test = pv.Cone(center=new_origin, direction=orientation, height=full_h, radius=radius1, capping=False, angle=None, resolution=resolution)
54  cut_origin = origin + norm_orientation * (height / 2.)
55  slice = body_test.slice(normal=orientation,origin=cut_origin, generate_triangles=True)
56  slice = pv.PolyData(slice.points).delaunay_2d()
57  body_test = body_test.clip(normal=orientation, origin=cut_origin, invert=True)
58  body = pv.MultiBlock([body_test, slice]).combine()
59 
60  return body
61 
def get_capped_cone(origin, orientation, radius1, angle, height, resolution)

◆ get_euler_angles_from_vectors()

def print_rollers.get_euler_angles_from_vectors (   vec1,
  vec2 
)

Definition at line 26 of file print_rollers.py.

26 def get_euler_angles_from_vectors(vec1, vec2):
27 
28  a, b = (vec1 / np.linalg.norm(vec1)).reshape(3), (vec2 /
29  np.linalg.norm(vec2)).reshape(3)
30  v = np.cross(a, b)
31  c = np.dot(a, b)
32  s = np.linalg.norm(v)
33  if s <= 1e-12:
34  return np.array([0, 0, 0])
35  kmat = np.array([[0, -v[2], v[1]], [v[2], 0, -v[0]], [-v[1], v[0], 0]])
36  R = np.eye(3) + kmat + kmat.dot(kmat) * ((1 - c) / (s ** 2))
37 
38  sy = np.sqrt(R[0, 0] * R[0, 0] + R[1, 0] * R[1, 0])
39  angle0 = np.arctan2(R[2, 1], R[2, 2]) * 180 / np.pi
40  angle1 = np.arctan2(-R[2, 0], sy) * 180 / np.pi
41  angle2 = np.arctan2(R[1, 0], R[0, 0]) * 180 / np.pi
42 
43  return np.array([angle0, angle1, angle2])
44 
def get_euler_angles_from_vectors(vec1, vec2)

◆ is_not_vtk()

def print_rollers.is_not_vtk (   file)

Definition at line 22 of file print_rollers.py.

22 def is_not_vtk(file):
23  return not file.endswith('vtk')
24 
25 
def is_not_vtk(file)

◆ split_string_to_vector3()

def print_rollers.split_string_to_vector3 (   txt)

Definition at line 12 of file print_rollers.py.

13  x = txt.split(",")
14  nb_list = []
15  for i in x:
16  nb_list.append(float(i))
17  if len(nb_list) != 3:
18  exit("coords and orientation require 3 numbers: x,y,z")
19  return nb_list
20 
21 
def split_string_to_vector3(txt)

Variable Documentation

◆ all_bodies

list print_rollers.all_bodies = []

Definition at line 271 of file print_rollers.py.

◆ args

print_rollers.args

Definition at line 248 of file print_rollers.py.

◆ body_type_id

print_rollers.body_type_id = mesh['_BODY_TYPE'][index]

Definition at line 275 of file print_rollers.py.

◆ file_vtu

string print_rollers.file_vtu = os.path.splitext(file)[0] + ".vtu"

Definition at line 256 of file print_rollers.py.

◆ help

print_rollers.help

Definition at line 247 of file print_rollers.py.

◆ id_array

print_rollers.id_array = mesh['_ROLLER_ID'][index]

Definition at line 274 of file print_rollers.py.

◆ index

int print_rollers.index = 0

◆ key

print_rollers.key

Definition at line 250 of file print_rollers.py.

◆ MAX_NB_OF_ROLLERS

int print_rollers.MAX_NB_OF_ROLLERS = 10

Definition at line 10 of file print_rollers.py.

◆ mesh

print_rollers.mesh = pv.read(file)

Definition at line 264 of file print_rollers.py.

◆ nargs

print_rollers.nargs

Definition at line 247 of file print_rollers.py.

◆ orientation_vec

print_rollers.orientation_vec = mesh['_ORIENTATION'][index]

Definition at line 276 of file print_rollers.py.

◆ parser

print_rollers.parser
Initial value:
1 = argparse.ArgumentParser(
2  description="Convert multiple vtk roller files to vtk with rollers geometry", add_help=False)

Definition at line 244 of file print_rollers.py.

◆ resolution

print_rollers.resolution = 64

Definition at line 175 of file print_rollers.py.

◆ rigid_bodies_dict

dictionary print_rollers.rigid_bodies_dict = {}

Definition at line 176 of file print_rollers.py.

◆ rigid_body

print_rollers.rigid_body = RigidBody()

Definition at line 279 of file print_rollers.py.

◆ roller_data

print_rollers.roller_data = mesh['_ROLLER_DATA'][index]

Definition at line 277 of file print_rollers.py.

◆ unknown

print_rollers.unknown

Definition at line 248 of file print_rollers.py.