def Move(self, displacement): if (self.refpoint): self.refpoint = self.refpoint + np.array(displacement) for _, comp in self.components.items(): comp.MoveBy(displacement) for hidbod in self.hidden_bodies: MiroAPI.MoveBodyBy(hidbod, displacement)
def MoveToMatch(self, pointname, other_component, other_pointname, dist=0): '''Moves the component to match the provided linkpoint position with the position of a linkpoint on the other component. Distance is calculated in the direction of the linkpoint on the other, non-moving component.''' marg = other_component.GetLinkDir(other_pointname) marg = marg * dist move = other_component.GetLinkPoint( other_pointname) - self.GetLinkPoint(pointname) + marg MiroAPI.MoveBodyBy(self.body, move)
def MoveToPosition(self, pos): MiroAPI.MoveBodyBy(self.body, pos - self.GetPosition())
def MoveBy(self, delta_pos): MiroAPI.MoveBodyBy(self.body, delta_pos)