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 /Connections/Shear/Finplate/nut.py | |
parent | a57cb415d3873120a89e3bd71aac75afba4c4a74 (diff) | |
download | OsdagLive-4d9df2cc747de8af9234bf105cc052d3fd5681d7.tar.gz OsdagLive-4d9df2cc747de8af9234bf105cc052d3fd5681d7.tar.bz2 OsdagLive-4d9df2cc747de8af9234bf105cc052d3fd5681d7.zip |
arranging nutbolt assembly
Diffstat (limited to 'Connections/Shear/Finplate/nut.py')
-rw-r--r-- | Connections/Shear/Finplate/nut.py | 122 |
1 files changed, 61 insertions, 61 deletions
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 |