diff options
author | deepa-chaudhari | 2015-06-08 23:23:34 +0530 |
---|---|---|
committer | deepa-chaudhari | 2015-06-08 23:23:34 +0530 |
commit | 4d9df2cc747de8af9234bf105cc052d3fd5681d7 (patch) | |
tree | 36779a36e76d01ef4af01c9fbc1c9a39a1faaded | |
parent | a57cb415d3873120a89e3bd71aac75afba4c4a74 (diff) | |
download | OsdagLive-4d9df2cc747de8af9234bf105cc052d3fd5681d7.tar.gz OsdagLive-4d9df2cc747de8af9234bf105cc052d3fd5681d7.tar.bz2 OsdagLive-4d9df2cc747de8af9234bf105cc052d3fd5681d7.zip |
arranging nutbolt assembly
-rw-r--r-- | Connections/Shear/Finplate/bolt.py | 14 | ||||
-rw-r--r-- | Connections/Shear/Finplate/colWebBeamWebConnectivity.py | 165 | ||||
-rw-r--r-- | Connections/Shear/Finplate/finPlateMain.py | 49 | ||||
-rw-r--r-- | Connections/Shear/Finplate/nut.py | 122 | ||||
-rw-r--r-- | Connections/Shear/Finplate/nutBoltPlacement.py | 70 | ||||
-rw-r--r-- | Connections/Shear/Finplate/plate.py | 1 |
6 files changed, 213 insertions, 208 deletions
diff --git a/Connections/Shear/Finplate/bolt.py b/Connections/Shear/Finplate/bolt.py index b3d654a..4badc86 100644 --- a/Connections/Shear/Finplate/bolt.py +++ b/Connections/Shear/Finplate/bolt.py @@ -10,7 +10,10 @@ from OCC.BRepPrimAPI import BRepPrimAPI_MakeCylinder from OCC.BRepAlgo import BRepAlgo_BooleanOperations from OCC.gp import gp_Pnt, gp_Dir, gp_Pln, gp_Ax2 from OCC.BRepAlgoAPI import BRepAlgoAPI_Fuse - +from OCC.BRepFilletAPI import BRepFilletAPI_MakeFillet +from OCC.TopAbs import TopAbs_EDGE +from OCC.TopoDS import topods +from OCC.TopExp import TopExp_Explorer class Bolt(object): # @@ -55,10 +58,19 @@ class Bolt(object): aFace = makeFaceFromWire(wire) extrudeDir = self.T * self.wDir # extrudeDir is a numpy array boltHead = makePrismFromFace(aFace, extrudeDir) + mkFillet = BRepFilletAPI_MakeFillet(boltHead) + anEdgeExplorer = TopExp_Explorer(boltHead, TopAbs_EDGE) + while anEdgeExplorer.More(): + aEdge = topods.Edge(anEdgeExplorer.Current()) + mkFillet.Add(self.T / 17. , aEdge) + anEdgeExplorer.Next() + + boltHead = mkFillet.Shape() cylOrigin = self.secOrigin + self.T * self.wDir boltCylinder = BRepPrimAPI_MakeCylinder(gp_Ax2(getGpPt(cylOrigin), getGpDir(self.wDir)), self.r, self.H).Shape() whole_Bolt = BRepAlgoAPI_Fuse(boltHead,boltCylinder).Shape() + mkFillet = BRepFilletAPI_MakeFillet(whole_Bolt) return whole_Bolt diff --git a/Connections/Shear/Finplate/colWebBeamWebConnectivity.py b/Connections/Shear/Finplate/colWebBeamWebConnectivity.py index 6a98a99..46bdc27 100644 --- a/Connections/Shear/Finplate/colWebBeamWebConnectivity.py +++ b/Connections/Shear/Finplate/colWebBeamWebConnectivity.py @@ -12,51 +12,54 @@ from nut import Nut import copy from OCC.BRepPrimAPI import BRepPrimAPI_MakeSphere from OCC.gp import gp_Pnt -from Connections.Shear.Finplate.nutBoltPlacement import NutBoltArray +from nutBoltPlacement import NutBoltArray +#from Connections.Shear.Finplate.nutBoltPlacement import NutBoltArray class ColWebBeamWeb(object): - def __init__(self,column,beam,Fweld,plate,NutBoltArray): + def __init__(self,column,beam,Fweld,plate,nutBoltArray): self.column = column self.beam = beam self.weldLeft = Fweld self.weldRight = copy.deepcopy(Fweld) self.plate = plate - self.NutBoltArray = NutBoltArray + self.nutBoltArray = nutBoltArray self.columnModel = None self.beamModel = None self.weldModelLeft = None self.weldModelRight = None self.plateModel = None -# self.bolts =[] -# self.nuts = [] -# self.boltModels = [] -# self.nutModels = [] self.clearDist = 20.0 # This distance between edge of the column web/flange and beam cross section def create_3dmodel(self): - - # ISection COLUMN + self.creatColumGeometry() + self.createBeamGeometry() + self.createPlateGeometry() + self.createFilletWeldGeometry() + self.createNutBoltArray() + + # Call for createModel + self.columnModel = self.column.createModel() + self.beamModel = self.beam.createModel() + self.plateModel = self.plate.createModel() + self.weldModelLeft = self.weldLeft.createModel() + self.weldModelRight = self.weldRight.createModel() + self.nutboltArrayModels = self.nutBoltArray.createModel() + + def creatColumGeometry(self): columnOrigin = numpy.array([0, 0, 0]) column_uDir = numpy.array([1.0, 0, 0]) wDir1 = numpy.array([0.0, 0, 1.0]) - t = 8.9 - weldThick = 8 - self.column.place(columnOrigin, column_uDir, wDir1) - # ISection BEAM - uDir2 = numpy.array([0, 1.0, 0]) - wDir2 = numpy.array([1.0, 0, 0.0]) - d = t/2.0 + weldThick - origin2 = columnOrigin + (self.column.t/2 * self.column.uDir) + (self.column.length/2 * self.column.wDir) + (self.clearDist * self.column.uDir) - #origin2 = numpy.array([0, 0, 500]) + (d+7.55) * wDir2 - #origin2 = numpy.array([0, 0, 500]) + 20 * wDir2 - #self.beam = ISection(B = 140, T = 16,D = 400,t = 8.9, R1 = 14, R2 = 7, alpha = 98,length = 500) - self.beam.place(origin2, uDir2, wDir2) + def createBeamGeometry(self): + uDir = numpy.array([0, 1.0, 0]) + wDir = numpy.array([1.0, 0, 0.0]) + origin2 = self.column.secOrigin + (self.column.t/2 * self.column.uDir) + (self.column.length/2 * self.column.wDir) + (self.clearDist * self.column.uDir) + self.beam.place(origin2, uDir, wDir) - # # WELD - # + def createButtWeld(self): + pass # plateThickness = 10 # uDir3 = numpy.array([0, 1.0, 0]) # wDir3 = numpy.array([1.0, 0, 0.0]) @@ -67,107 +70,43 @@ class ColWebBeamWeb(object): # self.weld.W/2.0 * (-self.beam.uDir)) # #origin3 = numpy.array([0, 0, 500]) + t/2.0 *wDir3 + plateThickness/2.0 * (-self.beam.uDir) # self.weld.place(origin3, uDir3, wDir3) - - # PLATE - uDir4 = numpy.array([0, 1.0, 0]) - wDir4 = numpy.array([1.0, 0, 0.0]) - #origin4 = self.weld.secOrigin + self.weld.T * self.weld.wDir + def createPlateGeometry(self): plateOrigin = (self.column.secOrigin + self.column.t/2.0 * self.column.uDir + self.column.length/2.0 * self.column.wDir + self.beam.t/2.0 * (-self.beam.uDir)+ self.plate.T/2.0 * (-self.beam.uDir)) - #origin4 = self.column.secOrigin + self.weld.T * self.weld.wDir - - self.plate.place(plateOrigin, uDir4, wDir4) - -# # Weld - uDir5 = numpy.array([1.0, 0.0, 0]) - wDir5 = numpy.array([0.0, 0.0, 1.0]) - filletWeld1Origin = (plateOrigin + self.plate.T/2.0 *self.weldLeft.vDir + self.weldLeft.L/2.0 * (-self.weldLeft.wDir) ) - self.weldLeft.place(filletWeld1Origin, uDir5, wDir5) + uDir = numpy.array([0, 1.0, 0]) + wDir = numpy.array([1.0, 0, 0.0]) + self.plate.place(plateOrigin, uDir, wDir) + + def createFilletWeldGeometry(self): + uDir = numpy.array([1.0, 0.0, 0]) + wDir = numpy.array([0.0, 0.0, 1.0]) + filletWeld1Origin = (self.plate.secOrigin + self.plate.T/2.0 *self.weldLeft.vDir + self.weldLeft.L/2.0 * (-self.weldLeft.wDir) ) + self.weldLeft.place(filletWeld1Origin, uDir, wDir) - - uDir555 = numpy.array([0.0, -1.0, 0]) - wDir5 = numpy.array([0.0, 0.0, 1.0]) + uDir1 = numpy.array([0.0, -1.0, 0]) + wDir1 = numpy.array([0.0, 0.0, 1.0]) filletWeld2Origin = (filletWeld1Origin + self.plate.T * (-self.weldLeft.vDir)) - self.weldRight.place(filletWeld2Origin,uDir555,wDir5) - - - - # BOLT BODY - #self.NutBoltArray.place(platestartpt, -self.plate.vDir, -self.plate.uDir) - - bolt_T = 6.0 - origin51 = (self.plate.secOrigin + (- - self.plate.T/2.0 - bolt_T) * self.plate.uDir + - self.plate.W/2.0 * self.plate.wDir) - - uDir5 = self.plate.wDir - wDir5 = self.plate.uDir + self.weldRight.place(filletWeld2Origin,uDir1,wDir1) -# ## Bolt1 -# bolt1 = Bolt(R = self.boltRadius,T = bolt_T, H = 30.0, r = 4.0 ) -# bolt1.place(origin51, uDir5, wDir5) -# -# ## Bolt2 -# bolt2 = Bolt(R = self.boltRadius, T = bolt_T, H = 30.0, r = 4.0 ) -# origin52 = origin51 + 50 *self.plate.vDir -# bolt2.place(origin52, uDir5, wDir5) -# - ## Bolt3 - bolt3 = Bolt(R = self.boltRadius,T = bolt_T, H = 30.0, r = 4.0 ) - origin53 = origin51 - 50*self.plate.vDir - bolt3.place(origin53, uDir5, wDir5) - #self.bolts =[bolt1,bolt2,bolt3] - - #nutbody = Nut(R = 10.0,T = 10.0, H = 6.1, innerR1 = 6.0, outerR2 = 8.3) - # NUTBODY - ## Nut1 - nut1 = Nut(R = self.nutRadius,T = 10.0, H = 11, innerR1 = 4.0, outerR2 = 8.3) - uDir = uDir5 - wDir = wDir5 - nut_Origin1 = origin51 + (bolt1.T/2 * self.plate.uDir)+(self.plate.T *self.plate.uDir)+ (self.beam.T/2 * self.plate.uDir) - nut1.place(nut_Origin1, uDir, wDir) - - ## Nut2 - nut2 = Nut(R = self.nutRadius,T = 10.0, H = 11, innerR1 = 4.0, outerR2 = 8.3) - nut_Origin2 = origin52 + (bolt1.T/2 * self.plate.uDir)+(self.plate.T *self.plate.uDir)+ (self.beam.T/2 * self.plate.uDir) - nut2.place(nut_Origin2, uDir, wDir) - - ## Nut3 - nut3 =Nut(R = self.nutRadius, T = 10.0, H = 11, innerR1 = 4.0, outerR2 = 8.3) - nut_Origin3 = origin53 + (bolt1.T/2 * self.plate.uDir)+(self.plate.T *self.plate.uDir)+ (self.beam.T/2 * self.plate.uDir) - nut3.place(nut_Origin3, uDir5, wDir5) - self.nuts = [nut1,nut2,nut3] - - - # Call for createModel - self.columnModel = self.column.createModel() - self.beamModel = self.beam.createModel() - self.plateModel = self.plate.createModel() - self.weldModelLeft = self.weldLeft.createModel() - self.weldModelRight = self.weldRight.createModel() - self. - for bolt in self.bolts: - self.boltModels.append(bolt.createModel()) - - #color = Quantity_NOC_SADDLEBROWN, - for nut in self.nuts: - self.nutModels.append(nut.createModel()) - - # memberList = [iSectionModel1,iSectionModel2,weldModel1,weldModel2, - # plateModel] + boltModels + nutModels - # objshearfinplate = ShearFinPlate(iSectionModel1,iSectionModel2,) - # - # print("memberList #####") - # print(len(memberList)) - #return memberList + def createNutBoltArray(self): + nutboltArrayOrigin = self.plate.secOrigin + self.plate.T/2.0 * self.plate.uDir - self.plate.L/2.0 * self.plate.vDir + gaugeDir = self.plate.wDir + pitchDir = self.plate.vDir + boltDir = self.plate.uDir + self.nutBoltArray.place(nutboltArrayOrigin, gaugeDir, pitchDir,boltDir) def get_models(self): - ''' + '''Returning 3D models ''' return [self.columnModel,self.beamModel, self.weldModelLeft,self.weldModelRight, - self.plateModel]+self.boltModels + self.nutModels
\ No newline at end of file + self.plateModel]+ self.nutBoltArray.getnutboltModels() + + + + +
\ No newline at end of file diff --git a/Connections/Shear/Finplate/finPlateMain.py b/Connections/Shear/Finplate/finPlateMain.py index 2823b59..a615acb 100644 --- a/Connections/Shear/Finplate/finPlateMain.py +++ b/Connections/Shear/Finplate/finPlateMain.py @@ -10,7 +10,8 @@ from OCC.TopoDS import topods, TopoDS_Shape from OCC.BRepPrimAPI import BRepPrimAPI_MakeBox, BRepPrimAPI_MakeCylinder,\ BRepPrimAPI_MakeSphere from OCC.gp import gp_Pnt -from Connections.Shear.Finplate.nutBoltPlacement import NutBoltArray +from nutBoltPlacement import NutBoltArray +#from Connections.Shear.Finplate.nutBoltPlacement import NutBoltArray ''' Created on 21-Aug-2014 @@ -642,7 +643,7 @@ class MainController(QtGui.QMainWindow): elif component == "Model": self.display.EraseAll() #osdagDisplayShape(self.display, cadlist[0], update=True) - #osdagDisplayShape(self.display, cadlist[1],material = Graphic3d_NOT_2D_ALUMINUM, update=True) + osdagDisplayShape(self.display, cadlist[1],material = Graphic3d_NOT_2D_ALUMINUM, update=True) #osdagDisplayShape(self.display,cadlist[2],color = 'red', update = True) #osdagDisplayShape(self.display,cadlist[3],color = 'red', update = True) osdagDisplayShape(self.display, cadlist[4], color = 'blue', update = True) @@ -662,17 +663,19 @@ class MainController(QtGui.QMainWindow): column_sec = self.ui.comboColSec.currentText() dictcoldata = get_columndata(column_sec) return dictcoldata + def create3DColWebBeamWeb(self): ''' creating 3d cad model with column web beam web ''' uiObj = self.getuser_inputs() resultObj = finConn(uiObj) + if len(resultObj) == 0: - self.display.DisplayMessage(gp_Pnt(0,0,0),'Sorry can not create 3D model',color = 'white') + self.display.DisplayMessage(gp_Pnt(0,0,0),'Sorry can not create 3D model',color = 'None') else: dictbeamdata = self.fetchBeamPara() - + ##### BEAM PARAMETERS ##### beam_D = int(dictbeamdata[QString("D")]) beam_B = int(dictbeamdata[QString("B")]) beam_tw = float(dictbeamdata[QString("tw")]) @@ -680,10 +683,12 @@ class MainController(QtGui.QMainWindow): beam_alpha = float(dictbeamdata[QString("FlangeSlope")]) beam_R1 = float(dictbeamdata[QString("R1")]) beam_R2 = float(dictbeamdata[QString("R2")]) + beam_length = 500.0 # This parameter as per view of 3D cad model #beam = ISection(B = 140, T = 16,D = 400,t = 8.9, R1 = 14, R2 = 7, alpha = 98,length = 500) beam = ISection(B = beam_B, T = beam_T,D = beam_D,t = beam_tw, - R1 = beam_R1, R2 = beam_R2, alpha = beam_alpha,length = 500) + R1 = beam_R1, R2 = beam_R2, alpha = beam_alpha, + length = beam_length) ##### COLUMN PARAMETERS ###### dictcoldata = self.fetchColumnPara() @@ -700,33 +705,44 @@ class MainController(QtGui.QMainWindow): column = ISection(B = column_B, T = column_T, D = column_D, t = column_tw, R1 = column_R1, R2 = column_R2, alpha = column_alpha, length = 1000) # Outputs from finPlateCalc1 + #### WELD,PLATE,BOLT AND NUT PARAMETERS ##### fillet_length = resultObj['Plate']['height'] fillet_thickness = resultObj['Weld']['thickness'] plate_width = resultObj['Plate']['width'] plate_thick = uiObj['Plate']['thickness(mm)'] + bolt_dia = uiObj["Bolt"]["diameter(mm)"] + bolt_r = bolt_dia/2 + bolt_R = bolt_r + 7 + nut_R = bolt_R + bolt_T = 10.0 # minimum bolt thickness As per Indian Standard + bolt_Ht = 38.0 # minimum bolt length as per Indian Standard + nut_T = 12.0 # minimum nut thickness As per Indian Standard + nut_Ht = 12.2 # + #Fweld1 = FilletWeld(L= 300,b = 6, h = 6) Fweld1 = FilletWeld(L= fillet_length,b = fillet_thickness, h = fillet_thickness) - #Fweld1 = Weld(L= 300,W = beam.t, T = 8) #plate = Plate(L= 300,W =100, T = 10) plate = Plate(L= fillet_length,W =plate_width, T = plate_thick) - bolt_T = 6.0 - bolt = Bolt(R = self.boltRadius,T = bolt_T, H = 30.0, r = 4.0 ) - boltPlaceObj = finConn(self.getuser_inputs()) - nut =Nut(R = self.nutRadius, T = 10.0, H = 11, innerR1 = 4.0, outerR2 = 8.3) - # bolt assembly - - self.nutBoltArray = NutBoltArray(self.boltPlaceObj,self.nut,self.bolt) + #bolt = Bolt(R = bolt_R,T = bolt_T, H = 38.0, r = 4.0 ) + bolt = Bolt(R = bolt_R,T = bolt_T, H = bolt_Ht, r = bolt_r ) + + #nut =Nut(R = bolt_R, T = 10.0, H = 11, innerR1 = 4.0, outerR2 = 8.3) + nut = Nut(R = bolt_R, T = nut_T, H = nut_Ht, innerR1 = bolt_r) - self.nutBoltArray.createModel() - nutBoltAssembly = self.nutBoltArray.getnutboltModel() + gap = beam_tw + plate_thick + bolt_T + nutBoltArray = NutBoltArray(resultObj,nut,bolt,gap) + #self.nutBoltArray.createModel() + #nutBoltAssembly = self.nutBoltArray.getnutboltModel() - colwebconn = ColWebBeamWeb(column,beam,Fweld1,plate,nutBoltAssembly) + + colwebconn = ColWebBeamWeb(column,beam,Fweld1,plate,nutBoltArray) + #colwebconn = ColWebBeamWeb(column,beam,Fweld1,plate,boltRadius,nutRadius) colwebconn.create_3dmodel() return colwebconn @@ -766,6 +782,7 @@ class MainController(QtGui.QMainWindow): self.display.DisplayShape(my_sphere,update=True) + def call_3DBeam(self): ''' diff --git a/Connections/Shear/Finplate/nut.py b/Connections/Shear/Finplate/nut.py index 70ac7d0..a0d9397 100644 --- a/Connections/Shear/Finplate/nut.py +++ b/Connections/Shear/Finplate/nut.py @@ -27,12 +27,12 @@ import OCC.BRep as BRep class Nut(object): - def __init__(self,R,T,H,innerR1,outerR2): + def __init__(self,R,T,H,innerR1): self.R = R self.H = H self.T = T self.r1 = innerR1 - self.r2 = outerR2 + #self.r2 = outerR2 self.secOrigin = numpy.array([0, 0, 0]) self.uDir = numpy.array([1.0, 0, 0]) self.wDir = numpy.array([0.0, 0, 1.0]) @@ -86,66 +86,66 @@ class Nut(object): result_shape = BRepAlgoAPI_Cut(prism, innerCyl).Shape() - self.secOrigin = gp_Pnt(0 , 0 , 0) - neckNormal = gp_DZ() - # Threading : Create Surfaces +# self.secOrigin = gp_Pnt(0 , 0 , 0) +# neckNormal = gp_DZ() +# # Threading : Create Surfaces +# +# nutAx2_bis = gp_Ax3(self.secOrigin , neckNormal) +# aCyl1 = Geom_CylindricalSurface(nutAx2_bis , self.T * 0.99) +# aCyl2 = Geom_CylindricalSurface(nutAx2_bis , self.T * 1.05) +# #aCyl3 = Geom_CylindricalSurface(nutAx2_bis , self.T * 1.11) +# aCyl1_handle = aCyl1.GetHandle() +# aCyl2_handle = aCyl2.GetHandle() +# #aCyl3_handle = aCyl3.GetHandle() +# +# # Threading : Define 2D Curves +# aPnt = gp_Pnt2d(2. * math.pi , self.H / 2.) +# aDir = gp_Dir2d(2. * math.pi , self.H / 4.) +# aAx2d = gp_Ax2d(aPnt , aDir) +# aMajor = 2. * math.pi +# aMinor = self.H / 7. +# anEllipse1 = Geom2d_Ellipse(aAx2d , aMajor , aMinor) +# anEllipse2 = Geom2d_Ellipse(aAx2d , aMajor , aMinor / 4.) +# anEllipse1_handle = anEllipse1.GetHandle() +# anEllipse2_handle = anEllipse2.GetHandle() +# aArc1 = Geom2d_TrimmedCurve(anEllipse1_handle, 0 , math.pi) +# aArc2 = Geom2d_TrimmedCurve(anEllipse2_handle, 0 , math.pi) +# aArc1_handle = aArc1.GetHandle() +# aArc2_handle = aArc2.GetHandle() +# anEllipsePnt1 = anEllipse1.Value(0) +# anEllipsePnt2 = anEllipse1.Value(math.pi) +# aSegment = GCE2d_MakeSegment(anEllipsePnt1 , anEllipsePnt2) +# +# # Threading : Build Edges and Wires +# +# aEdge1OnSurf1 = BRepBuilderAPI_MakeEdge( aArc1_handle , aCyl1_handle) +# aEdge2OnSurf1 = BRepBuilderAPI_MakeEdge( aSegment.Value() , aCyl1_handle) +# aEdge1OnSurf2 = BRepBuilderAPI_MakeEdge( aArc2_handle , aCyl2_handle) +# aEdge2OnSurf2 = BRepBuilderAPI_MakeEdge( aSegment.Value() , aCyl2_handle) +# threadingWire1 = BRepBuilderAPI_MakeWire(aEdge1OnSurf1.Edge() , aEdge2OnSurf1.Edge())#aEdge3OnSurf1.Edge()) +# self.threading1 = threadingWire1 +# threadingWire2 = BRepBuilderAPI_MakeWire(aEdge1OnSurf2.Edge() , aEdge2OnSurf2.Edge())#aEdge3OnSurf2.Edge()) +# BRepLib.breplib.BuildCurves3d(threadingWire1.Shape()) +# BRepLib.breplib.BuildCurves3d(threadingWire2.Shape()) +# +# # Create Threading +# +# aTool = BRepOffsetAPI_ThruSections(True) +# aTool.AddWire(threadingWire1.Wire()) +# aTool.AddWire(threadingWire2.Wire()) +# aTool.CheckCompatibility(False) +# myThreading = aTool.Shape() +# +# #Building the resulting compound +# +# aRes = TopoDS_Compound() +# aBuilder = BRep.BRep_Builder() +# aBuilder.MakeCompound(aRes) +# aBuilder.Add(aRes, result_shape) +# aBuilder.Add(aRes, myThreading) +# final_shape = BRepAlgoAPI_Cut(result_shape, myThreading).Shape() - nutAx2_bis = gp_Ax3(self.secOrigin , neckNormal) - aCyl1 = Geom_CylindricalSurface(nutAx2_bis , self.T * 0.99) - aCyl2 = Geom_CylindricalSurface(nutAx2_bis , self.T * 1.05) - #aCyl3 = Geom_CylindricalSurface(nutAx2_bis , self.T * 1.11) - aCyl1_handle = aCyl1.GetHandle() - aCyl2_handle = aCyl2.GetHandle() - #aCyl3_handle = aCyl3.GetHandle() - # Threading : Define 2D Curves - aPnt = gp_Pnt2d(2. * math.pi , self.H / 2.) - aDir = gp_Dir2d(2. * math.pi , self.H / 4.) - aAx2d = gp_Ax2d(aPnt , aDir) - aMajor = 2. * math.pi - aMinor = self.H / 7. - anEllipse1 = Geom2d_Ellipse(aAx2d , aMajor , aMinor) - anEllipse2 = Geom2d_Ellipse(aAx2d , aMajor , aMinor / 4.) - anEllipse1_handle = anEllipse1.GetHandle() - anEllipse2_handle = anEllipse2.GetHandle() - aArc1 = Geom2d_TrimmedCurve(anEllipse1_handle, 0 , math.pi) - aArc2 = Geom2d_TrimmedCurve(anEllipse2_handle, 0 , math.pi) - aArc1_handle = aArc1.GetHandle() - aArc2_handle = aArc2.GetHandle() - anEllipsePnt1 = anEllipse1.Value(0) - anEllipsePnt2 = anEllipse1.Value(math.pi) - aSegment = GCE2d_MakeSegment(anEllipsePnt1 , anEllipsePnt2) - - # Threading : Build Edges and Wires - - aEdge1OnSurf1 = BRepBuilderAPI_MakeEdge( aArc1_handle , aCyl1_handle) - aEdge2OnSurf1 = BRepBuilderAPI_MakeEdge( aSegment.Value() , aCyl1_handle) - aEdge1OnSurf2 = BRepBuilderAPI_MakeEdge( aArc2_handle , aCyl2_handle) - aEdge2OnSurf2 = BRepBuilderAPI_MakeEdge( aSegment.Value() , aCyl2_handle) - threadingWire1 = BRepBuilderAPI_MakeWire(aEdge1OnSurf1.Edge() , aEdge2OnSurf1.Edge())#aEdge3OnSurf1.Edge()) - self.threading1 = threadingWire1 - threadingWire2 = BRepBuilderAPI_MakeWire(aEdge1OnSurf2.Edge() , aEdge2OnSurf2.Edge())#aEdge3OnSurf2.Edge()) - BRepLib.breplib.BuildCurves3d(threadingWire1.Shape()) - BRepLib.breplib.BuildCurves3d(threadingWire2.Shape()) - - # Create Threading - - aTool = BRepOffsetAPI_ThruSections(True) - aTool.AddWire(threadingWire1.Wire()) - aTool.AddWire(threadingWire2.Wire()) - aTool.CheckCompatibility(False) - myThreading = aTool.Shape() - - #Building the resulting compound - - aRes = TopoDS_Compound() - aBuilder = BRep.BRep_Builder() - aBuilder.MakeCompound(aRes) - aBuilder.Add(aRes, result_shape) - aBuilder.Add(aRes, myThreading) - final_shape = BRepAlgoAPI_Cut(result_shape, myThreading).Shape() - - - return final_shape + return result_shape
\ No newline at end of file diff --git a/Connections/Shear/Finplate/nutBoltPlacement.py b/Connections/Shear/Finplate/nutBoltPlacement.py index ea4b79b..c7e5832 100644 --- a/Connections/Shear/Finplate/nutBoltPlacement.py +++ b/Connections/Shear/Finplate/nutBoltPlacement.py @@ -4,38 +4,74 @@ Created on 07-Jun-2015 @author: deepa ''' import numpy +from bolt import Bolt +from nut import Nut class NutBoltArray(): - def __init__(self,boltPlaceObj,nut,bolt): + def __init__(self,boltPlaceObj,nut,bolt,gap): + self.origin = numpy.array([0.0, 0.0, 0]) + self.gaugeDir = numpy.array([1.0, 0.0, 0]) + self.pitchDir = numpy.array([0.0, 1.0, 0]) + self.boltDir = numpy.array([0.0, 0.0, -1.0]) + + self.initBoltPlaceParams(boltPlaceObj) + + self.bolt = bolt + self.nut = nut + self.gap = gap + + self.bolts = [] + self.nuts = [] + self.initialiseNutBolts() + + self.positions = [] + self.calculatePositions() + + self.models = [] + + def initialiseNutBolts(self): + b = self.bolt + n = self.nut + for i in range(self.row * self.col): + self.bolts.append(Bolt(b.R,b.T, b.H, b.r)) + self.nuts.append(Nut(n.R, n.T,n.H, n.r1)) + def initBoltPlaceParams(self,boltPlaceObj): self.pitch = boltPlaceObj['Bolt']['pitch'] self.gauge = boltPlaceObj['Bolt']['gauge'] self.edge = boltPlaceObj['Bolt']['edge'] self.end = boltPlaceObj['Bolt']['enddist'] self.row = boltPlaceObj['Bolt']['numofrow'] self.col = boltPlaceObj['Bolt']['numofcol'] - self.gap = boltPlaceObj['beam_tw'] + boltPlaceObj['plate_thick'] - self.nut = nut - self.bolt = bolt - self.origin = numpy.array([0.0, 0.0, 0]) - self.uDir = numpy.array([1.0, 0.0, 0]) - self.vDir = numpy.array([0.0, 1.0, 0]) + + + def calculatePositions(self): self.positions = [] - for rw in range(1,(len(self.row)+1)): + for rw in range(1,(self.row +1)): for col in range(self.col): - pos = self.pitch +(self.edge + (col * self.gauge))* self.uDir + (rw * self.pitch) * self.vDir + pos = self.origin +(self.edge + (col * self.gauge))* self.gaugeDir + rw * self.pitch * self.pitchDir self.positions.append(pos) - - def place(self, secOrigin, uDir, vDir): - for pos in self.position: - self.bolt.place(pos,uDir,vDir) - self.nut.place(pos + self.gap,uDir,vDir) + def place(self, origin, gaugeDir, pitchDir, boltDir): + self.origin = origin + self.gaugeDir = gaugeDir + self.pitchDir = pitchDir + self.boltDir = boltDir + + self.calculatePositions() + + for index,pos in enumerate (self.positions): + self.bolts[index].place(pos,gaugeDir,boltDir) + self.nuts[index].place((pos + self.gap* boltDir),gaugeDir,pitchDir) + def createModel(self): + for bolt in self.bolts: + self.models.append(bolt.createModel()) + for nut in self.nuts: + self.models.append(nut.createModel()) - pass - def getnutboltModel(self): - pass + def getnutboltModels(self): + return self.models
\ No newline at end of file diff --git a/Connections/Shear/Finplate/plate.py b/Connections/Shear/Finplate/plate.py index e4b9e53..93093f6 100644 --- a/Connections/Shear/Finplate/plate.py +++ b/Connections/Shear/Finplate/plate.py @@ -15,6 +15,7 @@ class Plate(object): 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): |