def __init__(self, D, B, T, t, s, l, t1, H): self.B = B self.T = T self.D = D self.t = t self.l = l self.s = s self.t1 = t1 self.H = H self.sec_origin = numpy.array([0, 0, 0]) self.uDir = numpy.array([1.0, 0, 0]) self.wDir = numpy.array([0.0, 0, 1.0]) self.Plate1 = Plate(t1, H, l) self.Plate2 = Plate(t1, H, l) self.channel1 = Channel(B, T, D, t, 0, 0, H) self.channel2 = Channel(B, T, D, t, 0, 0, H)
def __init__(self, D, B, T, t, T1, t1, d, b, H, s): self.B = B self.T = T self.D = D self.t = t self.T1 = T1 self.t1 = t1 self.d = d self.b = b self.H = H self.s = s self.B = 2 * self.s - 2 * T1 self.d = 2 * self.s self.sec_origin = numpy.array([0, 0, 0]) self.uDir = numpy.array([1.0, 0, 0]) self.wDir = numpy.array([0.0, 0, 1.0]) self.channel1 = Channel(b, T1, self.d, t1, 0, 0, H) self.isection = ISection(self.B, T, D, t, 0, 0, 0, H, None)
from OCC.Display.SimpleGui import init_display display, start_display, add_menu, add_function_to_menu = init_display() Obj = 'Star Angles' #'Back to Back Channels' # 'Channels' #' #'Angles' # or 'Back to Back Angles' 'Channels' or # weld_size = 6 # s = max(15, weld_size) plate = GassetPlate(L=360 + 50, H=205.0, T=10, degree=30) bolt = Bolt(R=8, T=5, H=6, r=3) nut = Nut(R=bolt.R, T=bolt.T, H=bolt.T + 1, innerR1=bolt.r) intermittentPlate = Plate(L= 2*125 , W=70, T=plate.T) if Obj == 'Channels' or Obj == 'Back to Back Channels': member = Channel(B=50, T=6.6, D=125, t=3, R1=6.0, R2=2.4, L=4000) # plate_intercept = plate.L - s - 50 if Obj == 'Channels': nut_space = member.t + plate.T + nut.T # member.T + plate.T + nut.T else: nut_space = 2 * member.t + plate.T + nut.T # 2*member.T + plate.T + nut.T # plateObj = 0.0 nut_bolt_array = NutBoltArray(Obj, nut, bolt, nut_space) intermittentConnection = IntermittentNutBoltPlateArray(Obj, nut, bolt, intermittentPlate, nut_space) tensionCAD = TensionChannelBoltCAD(Obj, member, plate, nut_bolt_array, intermittentConnection) else: member = Angle(L=2000.0, A=90.0, B=65.0, T=10.0, R1=8.0, R2=0.0)
from OCC.gp import gp_Pnt from OCC.Display.SimpleGui import init_display display, start_display, add_menu, add_function_to_menu = init_display() member_data = 'Star Angles' #'Back to Back Channels'# #'Channels' # 'Back to Back Angles' #'Angles' #' loc = 'Long Leg' # 'Short Leg'# weld_size = 6 s = max(15, weld_size) intermittentPlate = Plate(L=195, W=80, T=16) welds = FilletWeld(h=5, b=5, L=intermittentPlate.W) weld_plate_array = IntermittentWelds(member_data, welds, intermittentPlate) if member_data == 'Channels' or member_data == 'Back to Back Channels': member = Channel(B=75, T=10.2, D=175, t=6, R1=0, R2=0, L=2000) plate = GassetPlate(L=560 + 50, H=210, T=16, degree=30) plate_intercept = plate.L - s - 50 inline_weld = FilletWeld(b=weld_size, h=weld_size, L=plate_intercept) opline_weld = FilletWeld(b=weld_size, h=weld_size, L=member.D) tensionCAD = TensionChannelWeldCAD(member_data, member, plate, inline_weld, opline_weld, weld_plate_array) else: member = Angle(L=2000.0, A=70.0, B=20.0, T=5.0, R1=0.0, R2=0.0) plate = GassetPlate(L=540 + 50, H=255, T=16, degree=30) plate_intercept = plate.L - s - 50 inline_weld = FilletWeld(b=weld_size, h=weld_size, L=plate_intercept) if loc == 'Long Leg': opline_weld = FilletWeld(b=weld_size, h=weld_size, L=member.A)
class ISectionChannel(object): def __init__(self, D, B, T, t, T1, t1, d, b, H, s): self.B = B self.T = T self.D = D self.t = t self.T1 = T1 self.t1 = t1 self.d = d self.b = b self.H = H self.s = s self.B = 2 * self.s - 2 * T1 self.d = 2 * self.s self.sec_origin = numpy.array([0, 0, 0]) self.uDir = numpy.array([1.0, 0, 0]) self.wDir = numpy.array([0.0, 0, 1.0]) self.channel1 = Channel(b, T1, self.d, t1, 0, 0, H) self.isection = ISection(self.B, T, D, t, 0, 0, 0, H, None) #self.compute_params() def place(self, sec_origin, uDir, wDir): self.sec_origin = sec_origin self.uDir = uDir self.wDir = wDir D = self.D / 2 origin = numpy.array([-D + self.b - self.t1, 0., 0.]) self.channel1.place(origin, self.uDir, self.wDir) origin1 = numpy.array([self.s, 0., 0.]) self.isection.place(origin1, self.uDir, self.wDir) def compute_params(self): self.channel1.compute_params() self.channel1.points = self.rotateZ(self.channel1.points) self.isection.compute_params() # self.isection.points = self.rotateZ(self.isection.points) def create_model(self): prism1 = self.channel1.create_model() prism3 = self.isection.create_model() prism = BRepAlgoAPI_Fuse(prism1, prism3).Shape() return prism def rotateZ(self, points): rotated_points = [] rmatrix = numpy.array([[0, 1, 0], [-1, 0, 0], [0, 0, 1]]) for point in points: point = numpy.matmul(rmatrix, point) rotated_points.append(point) return rotated_points def create_marking(self): middel_pnt = [] line = [] labels = ["z", "y", "u", "v"] offset = self.D uvoffset = offset / numpy.sqrt(2) x = self.B / 2 + self.T1 z_points = [ numpy.array([-offset + x, 0, self.H / 2]), numpy.array([offset + x, 0, self.H / 2]) ] line.append(makeEdgesFromPoints(z_points)) y_points = [ numpy.array([x, -offset, self.H / 2]), numpy.array([x, offset, self.H / 2]) ] line.append(makeEdgesFromPoints(y_points)) u_points = [ numpy.array([-uvoffset + x, uvoffset, self.H / 2]), numpy.array([uvoffset + x, -uvoffset, self.H / 2]) ] line.append(makeEdgesFromPoints(u_points)) v_points = [ numpy.array([-uvoffset + x, -uvoffset, self.H / 2]), numpy.array([uvoffset + x, uvoffset, self.H / 2]) ] line.append(makeEdgesFromPoints(v_points)) start_pnt = [[-offset + x, 0, self.H / 2], [x, -offset + 1, self.H / 2], [uvoffset + x, -uvoffset, self.H / 2], [uvoffset + x, uvoffset, self.H / 2]] end_pnt = [[offset + x, 0, self.H / 2], [x, offset - 2, self.H / 2], [-uvoffset + x, uvoffset, self.H / 2], [-uvoffset + x, -uvoffset, self.H / 2]] return line, [start_pnt, end_pnt], labels
class ChannelSectionOpposite(object): def __init__(self, D, B, T, t, s, l, t1, H): self.B = B self.T = T self.D = D self.t = t self.l = l self.s = s self.t1 = t1 self.H = H self.sec_origin = numpy.array([0, 0, 0]) self.uDir = numpy.array([1.0, 0, 0]) self.wDir = numpy.array([0.0, 0, 1.0]) self.Plate1 = Plate(t1, H, l) self.Plate2 = Plate(t1, H, l) self.channel1 = Channel(B, T, D, t, 0, 0, H) self.channel2 = Channel(B, T, D, t, 0, 0, H) #self.compute_params() def place(self, sec_origin, uDir, wDir): self.sec_origin = sec_origin self.uDir = uDir self.wDir = wDir space = self.s / 2 + self.B origin = numpy.array([space, 0., 0.]) self.channel1.place(origin, self.uDir, self.wDir) origin1 = numpy.array([space, 0., 0.]) self.channel2.place(origin1, self.uDir, self.wDir) origin2 = numpy.array([0., -self.t1 / 2, 0.]) self.Plate1.place(origin2, self.uDir, self.wDir) origin3 = numpy.array([0., self.D + self.t1 / 2, 0.]) self.Plate2.place(origin3, self.uDir, self.wDir) #self.compute_params() def compute_params(self): self.channel1.compute_params() self.channel2.compute_params() self.channel2.points = self.rotateY(self.channel2.points) self.channel2.points = self.rotateY(self.channel2.points) self.Plate1.compute_params() self.Plate2.compute_params() def create_model(self): prism1 = self.channel1.create_model() prism2 = self.channel2.create_model() prism3 = self.Plate1.create_model() prism4 = self.Plate2.create_model() prism = BRepAlgoAPI_Fuse(prism1, prism2).Shape() # prism = BRepAlgoAPI_Fuse(prism, prism3).Shape() # prism = BRepAlgoAPI_Fuse(prism, prism4).Shape() return prism, [prism3, prism4] def rotateY(self, points): rotated_points = [] rmatrix = numpy.array([[0, 0, 1], [0, 1, 0], [-1, 0, 0]]) for point in points: point = numpy.matmul(rmatrix, point) rotated_points.append(point) return rotated_points def create_marking(self): middel_pnt = [] line = [] labels = ["z", "y", "u", "v"] offset = self.s + 2 * self.B uvoffset = offset / numpy.sqrt(2) z_points = [ numpy.array([-offset, self.D / 2, self.H / 2]), numpy.array([offset, self.D / 2, self.H / 2]) ] line.append(makeEdgesFromPoints(z_points)) y_points = [ numpy.array([0., -offset + self.D / 2, self.H / 2]), numpy.array([0, offset + self.D / 2, self.H / 2]) ] line.append(makeEdgesFromPoints(y_points)) u_points = [ numpy.array([-uvoffset, uvoffset + self.D / 2, self.H / 2]), numpy.array([uvoffset, -uvoffset + self.D / 2, self.H / 2]) ] line.append(makeEdgesFromPoints(u_points)) v_points = [ numpy.array([-uvoffset, -uvoffset + self.D / 2, self.H / 2]), numpy.array([uvoffset, uvoffset + self.D / 2, self.H / 2]) ] line.append(makeEdgesFromPoints(v_points)) start_pnt = [[-offset, self.D / 2, self.H / 2], [0, -offset + self.D / 2 + 1, self.H / 2], [uvoffset, -uvoffset + self.D / 2, self.H / 2], [uvoffset, uvoffset + self.D / 2, self.H / 2]] end_pnt = [[offset, self.D / 2, self.H / 2], [0, offset + self.D / 2 - 2, self.H / 2], [-uvoffset, uvoffset + self.D / 2, self.H / 2], [-uvoffset, -uvoffset + self.D / 2, self.H / 2]] return line, [start_pnt, end_pnt], labels