Пример #1
0
    def setTranslation(self, x, y, z, execute=True):
        self.__transX = x
        self.__transY = y
        self.__transZ = z

        # create new module if necessary
        if self.__translation == None:
            self.__translation = TransformModule()
            if self.__rotation == None:
                connect(self.iGroupModule.geoConnectionPoint(),
                        self.__translation.geoInConnectionPoint())
            else:
                connect(self.__rotation.geoOutConnectionPoint(),
                        self.__translation.geoInConnectionPoint())
                connect(self.__rotation.data0OutConnectionPoint(),
                        self.__translation.data0InConnectionPoint())
                connect(self.__rotation.data1OutConnectionPoint(),
                        self.__translation.data1InConnectionPoint())
                connect(self.__rotation.data2OutConnectionPoint(),
                        self.__translation.data2InConnectionPoint())
                connect(self.__rotation.data3OutConnectionPoint(),
                        self.__translation.data3InConnectionPoint())

        self.__translation.setTranslation(self.__transX, self.__transY,
                                          self.__transZ)
        if execute:
            r.execute()
            return True
        return False
Пример #2
0
    def setRotation(self, angle, x, y, z, execute=True):
        self.__rotX = x
        self.__rotY = y
        self.__rotZ = z
        self.__rotAngle = angle

        # create new module if necessary
        if self.__rotation == None:
            self.__rotation = TransformModule()
            connect(self.iGroupModule.geoConnectionPoint(),
                    self.__rotation.geoInConnectionPoint())
            if self.__translation == None:
                pass
            else:
                disconnect(self.iGroupModule.geoConnectionPoint(),
                           self.__translation.geoInConnectionPoint())
                connect(self.__rotation.geoOutConnectionPoint(),
                        self.__translation.geoInConnectionPoint())
                connect(self.__rotation.data0OutConnectionPoint(),
                        self.__translation.data0InConnectionPoint())
                connect(self.__rotation.data1OutConnectionPoint(),
                        self.__translation.data1InConnectionPoint())
                connect(self.__rotation.data2OutConnectionPoint(),
                        self.__translation.data2InConnectionPoint())
                connect(self.__rotation.data3OutConnectionPoint(),
                        self.__translation.data3InConnectionPoint())

        self.__rotation.setRotation(self.__rotAngle, self.__rotX, self.__rotY,
                                    self.__rotZ)
        if execute:
            self.__rotation.execute()
            return True
        return False
Пример #3
0
    def __initGeo(self):
        # init rotation
        if self.__rotAngle == 0 and self.__rotations == []:
            pass
        else:
            if self.__rotAngle != 0 and self.__rotations == []:
                self.__rotations.append(TransformModule())
                self.__rotations[0].setRotation(self.__rotAngle, self.__rotX,
                                                self.__rotY, self.__rotZ)
                self.__needExecuteGeo = True

                self.__geoInConnectionPoint = self.__rotations[
                    0].geoInConnectionPoint()
                if self.__translation == None:
                    self.__geoConnectionPoint = self.__rotations[
                        0].geoOutConnectionPoint()
                else:
                    theNet().disconnectAllFromModulePort(
                        self.__translation.geoInConnectionPoint().module,
                        self.__translation.geoInConnectionPoint().port)
                    connect(self.__rotations[0].geoOutConnectionPoint(),
                            self.__translation.geoInConnectionPoint())

        # init translation
        if (self.__transX, self.__transY,
                self.__transZ) == (0, 0, 0) and self.__translation == None:
            pass
        else:
            if (self.__transX, self.__transY,
                    self.__transZ) != (0, 0, 0) and self.__translation == None:
                self.__translation = TransformModule()
                self.__translation.setTranslation(self.__transX, self.__transY,
                                                  self.__transZ)
                self.__needExecuteGeo = True

                if self.__rotations == []:
                    self.__geoInConnectionPoint = self.__translation.geoInConnectionPoint(
                    )
                else:
                    theNet().disconnectAllFromModulePort(
                        self.__rotations[0].geoOutConnectionPoint().module,
                        self.__rotations[0].geoOutConnectionPoint().port)
                    connect(self.__rotations[0].geoOutConnectionPoint(),
                            self.__translation.geoInConnectionPoint())
                self.__geoConnectionPoint = self.__translation.geoOutConnectionPoint(
                )
Пример #4
0
    def __initData(self, varName):
        if not varName in self.__needExecuteData.keys():
            self.__needExecuteData[varName] = False

        if self.__rotAngle == 0 and self.__rotations == []:
            pass
        else:
            if (self._dataVariableType[varName] != SCALARVARIABLE) and (
                    not varName in self.__dataInConnectionPoints.keys()) and (
                        self.__rotAngle != 0):

                portNum = self.__numConnectedVectorVariables % 4
                if len(self.__rotations) < self.__numNeededRotationModules:
                    self.__rotations.append(TransformModule())
                    self.__rotations[self.__numNeededRotationModules -
                                     1].setRotation(self.__rotAngle,
                                                    self.__rotX, self.__rotY,
                                                    self.__rotZ)
                    self.__needExecuteData[varName] = True
                    # verbinde notwendige geometrie
                    connect(
                        ParentClass.geoConnectionPoint(self),
                        self.__rotations[self.__numNeededRotationModules -
                                         1].geoInConnectionPoint())

                if portNum == 0:
                    self.__dataConnectionPoints[varName] = self.__rotations[
                        self.__numNeededRotationModules -
                        1].data0OutConnectionPoint()
                    self.__dataInConnectionPoints[varName] = self.__rotations[
                        self.__numNeededRotationModules -
                        1].data0InConnectionPoint()
                elif portNum == 1:
                    self.__dataConnectionPoints[varName] = self.__rotations[
                        self.__numNeededRotationModules -
                        1].data1OutConnectionPoint()
                    self.__dataInConnectionPoints[varName] = self.__rotations[
                        self.__numNeededRotationModules -
                        1].data1InConnectionPoint()
                elif portNum == 2:
                    self.__dataConnectionPoints[varName] = self.__rotations[
                        self.__numNeededRotationModules -
                        1].data2OutConnectionPoint()
                    self.__dataInConnectionPoints[varName] = self.__rotations[
                        self.__numNeededRotationModules -
                        1].data2InConnectionPoint()
                elif portNum == 3:
                    self.__dataConnectionPoints[varName] = self.__rotations[
                        self.__numNeededRotationModules -
                        1].data3OutConnectionPoint()
                    self.__dataInConnectionPoints[varName] = self.__rotations[
                        self.__numNeededRotationModules -
                        1].data3InConnectionPoint()

                self.__numConnectedVectorVariables = self.__numConnectedVectorVariables + 1
                if self.__numConnectedVectorVariables % 4 == 0:
                    self.__numNeededRotationModules = self.__numNeededRotationModules + 1

                if self.__translation == None:
                    pass
                else:
                    theNet().disconnectAllFromModulePort(
                        self.__translation.geoInConnectionPoint().module,
                        self.__translation.geoInConnectionPoint().port)
                    connect(self.__rotations[0].geoOutConnectionPoint(),
                            self.__translation.geoInConnectionPoint())