summaryrefslogtreecommitdiff
path: root/Connections/Shear/Finplate/plate.py
blob: 93093f6af3de0fb2ff5074e1c808e1612143ef93 (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
'''
Created on 29-Nov-2014

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

class Plate(object):
    #
    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