@@ -63,7 +63,7 @@ def __init__(self, id, r=[0,0,0], heading=0, mooring_headings=[60,180,300],rFair
6363 self .raftResults = {}
6464
6565
66- def setPosition (self , r , heading = None , degrees = False ,project = None ):
66+ def setPosition (self , r , heading = None , degrees = False ,project = None , update_moorings = True ):
6767 '''
6868 Set the position/orientation of the platform as well as the associated
6969 anchor points.
@@ -93,27 +93,28 @@ def setPosition(self, r, heading=None, degrees=False,project=None):
9393
9494 # Update the position of any Moorings
9595 count = 0 # mooring counter (there are some attachments that aren't moorings)
96- for i , att in enumerate (self .attachments ):
97- if isinstance (self .attachments [att ]['obj' ], Mooring ):
98-
99- # Heading of the mooring line
100- heading_i = self .mooring_headings [count ] + self .phi
101- # Reposition the whole Mooring if it is an anchored line
102- if not self .attachments [att ]['obj' ].shared :
103- self .attachments [att ]['obj' ].reposition (r_center = self .r , heading = heading_i ,project = project )
104-
105- count += 1
106-
107- if isinstance (self .attachments [att ]['obj' ], Cable ):
108-
109- cab = self .attachments [att ]['obj' ]
110-
111- # update heading stored in subcomponent for attached end
112- # pf_phis = [cab.attached_to[0].phi, cab.attached_to[1].phi]
113- # headings = [cab.subcomponents[0].headingA + pf_phis[0], cab.subcomponents[-1].headingB + pf_phis[1]]
114-
115- # reposition the cable
116- cab .reposition (project = project )
96+ if update_moorings :
97+ for i , att in enumerate (self .attachments ):
98+ if isinstance (self .attachments [att ]['obj' ], Mooring ):
99+
100+ # Heading of the mooring line
101+ heading_i = self .mooring_headings [count ] + self .phi
102+ # Reposition the whole Mooring if it is an anchored line
103+ if not self .attachments [att ]['obj' ].shared :
104+ self .attachments [att ]['obj' ].reposition (r_center = self .r , heading = heading_i ,project = project )
105+
106+ count += 1
107+
108+ if isinstance (self .attachments [att ]['obj' ], Cable ):
109+
110+ cab = self .attachments [att ]['obj' ]
111+
112+ # update heading stored in subcomponent for attached end
113+ # pf_phis = [cab.attached_to[0].phi, cab.attached_to[1].phi]
114+ # headings = [cab.subcomponents[0].headingA + pf_phis[0], cab.subcomponents[-1].headingB + pf_phis[1]]
115+
116+ # reposition the cable
117+ cab .reposition (project = project )
117118
118119
119120 def mooringSystem (self ,rotateBool = 0 ,mList = None ,bodyInfo = None , project = None ):
0 commit comments