summaryrefslogtreecommitdiff
path: root/Connections/Shear/Finplate/plate.py
blob: afc0b975b367824afca03df8462d82cb9ac08519 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
'''
Created on 29-Nov-2014

@author: deepa
'''
import numpy
from ModelUtils import *



class Plate(object):
    '''
    
                                    a2   XX-------------------------+
                                         |X                          X
                                         | X                          X
                                         |  X                          X
                                         |   X--------------------------X
                                         |   |                          |
+-------------->                         |   |  a1                      |
|               w dir                    |   |                          |
|                                        |   |                          |
|                                        |   |    +---------->  gDir    |
|                                        |   |    |                     |
|                                        |   |    |                     |
|                                        |   |    |                     |
|                                        |   |    |                     |
v                                        |   |    |                     |
                                         |   |    v                     |
v dir                                    |   |                          |
                                         |   |    pDir                  |
                                         |   |                          |
                                         |   |                          |
                                         |   |                          |
                                         |   |                          |
                                    a3   X   |                          |
                                          X  |                          |
                                            X+--------------------------+

                                             a4

    '''
    
    def __init__(self,L, W, T):        
        self.L = L
        self.W = W 
        self.T = T
        self.secOrigin = numpy.array([0, 0, 0])
        self.uDir = numpy.array([1.0, 0, 0])
        self.wDir = numpy.array([0.0, 0, 1.0])
        self.vDir = self.wDir * self.uDir
        self.computeParams()
    
    def place(self, secOrigin, uDir, wDir):
        self.secOrigin = secOrigin
        self.uDir = uDir
        self.wDir = wDir        
        self.computeParams()
        
    def computeParams(self):
        self.vDir = numpy.cross(self.wDir, self.uDir)
        self.a1 = self.secOrigin + (self.T/2.0) * self.uDir + (self.L/2.0) * self.vDir
        self.a2 = self.secOrigin + (-self.T/2.0) * self.uDir + (self.L/2.0) * self.vDir 
        self.a3 = self.secOrigin + (-self.T/2.0) * self.uDir + (-self.L/2.0) * self.vDir
        self.a4 = self.secOrigin + (self.T/2.0) * self.uDir + (-self.L/2.0) * self.vDir
        self.points = [self.a1, self.a2, self.a3, self.a4]
       
        
    def createModel(self):
        edges = makeEdgesFromPoints(self.points)
        wire = makeWireFromEdges(edges)
        aFace = makeFaceFromWire(wire)
        extrudeDir = self.W * self.wDir # extrudeDir is a numpy array
        prism =  makePrismFromFace(aFace, extrudeDir)
        
        return prism