コード例 #1
0
    def _BuildSurfacePoints(self, ChordFactor, ScaleFactor):
        LEPoints = self._GenerateLeadingEdge()

        SurfacePntsUp = []
        SurfacePntsDown = []
        Sections = []
        #         SurfacePntstoAdd=[]

        Eps = np.linspace(0, 1, self.NPaero_span + 1)
        Sections = [
            self.AirfoilFunct(Eps[i], LEPoints[i], self.ChordFunct,
                              ChordFactor, self.DihedralFunct,
                              self.TwistFunct).Curve
            for i in xrange(self.NPaero_span + 1)
        ]
        numb = 0

        for num in xrange(self.NPaero_span + 1):
            section = Sections[num]
            sectionPnt = act.Uniform_Points_on_Curve(section,
                                                     self.NPaero_chord)
            numb = numb + 1
            for numm in xrange(1, self.NPaero_chord + 1):
                print(sectionPnt[numm - 1].Y())
                print(sectionPnt[numm - 1].X())
                edgePnts = act.make_vertex(sectionPnt[numm - 1])
                if self.ScaleFactor != 1:
                    Origin = gp_Pnt(0., 0., 0.)
                    Pnts = act.scale_uniformal(edgePnts, Origin,
                                               self.ScaleFactor)
                    if numm <= (self.NPaero_chord - 1) / 2 + 1:
                        SurfacePntsUp.append(Pnts)
                        if numm == (self.NPaero_chord - 1) / 2 + 1:
                            SurfacePntsDown.append(Pnts)
                    elif numm > (self.NPaero_chord - 1) / 2 + 1:
                        #                      SurfacePntsDown.append(SurfacePntstoAdd)
                        SurfacePntsDown.append(Pnts)
#                      SurfacePntsDown=SurfacePntsD+SurfacePntstoAdd
#            numbb=numbb+1
#         if self.ScaleFactor!= 1:
#             Origin = gp_Pnt(0., 0., 0.)
#             SurfacePnts=act.scale_uniformal(SurfacePnts, Origin, self.ScaleFactor)

        print(np.shape(SurfacePntsUp))
        print(np.shape(SurfacePntsDown))
        return SurfacePntsUp, SurfacePntsDown
コード例 #2
0
    def _BuildLS(self, ChordFactor, ScaleFactor):
        """Generates a tentative lifting surface, given the general,
        nondimensional parameters of the object (variations of chord length,
        dihedral, etc.) and the two scaling factors.

        Parameters
        ----------
        ChordFactor - float
            Factor againt which the standard shape is scaled in the chordwise
            direction
        ScaleFactor - float
            Factor againt which the standard shape is scaled in the world
            coordinates

        Returns
        -------
        LS : TopoDS_Shape
            The generated Lifting surface

        ActualSemiSpan : scalar
            TODO: currently not calculated, None is returned

        LSP_area : scalar
            TODO: currently not calculated, None is returned

        AR : scalar
            TODO: currently not calculated, None is returned

        WingTip : TopoDS face or shape
            TODO: currently not calculated, None is returned
        """
        LEPoints = self._GenerateLeadingEdge()

        Sections = []
        # TODO: These lists are used for when the curve has been smoothed or
        # the loft has failed, neither of which have been implemented yet
        #        ProjectedSections = []
        #        TEPoints_u = []
        #        TEPoints_l = []

        Eps = np.linspace(0, 1, self.SegmentNo + 1)
        Sections = [
            self.AirfoilFunct(Eps[i], LEPoints[i], self.ChordFunct,
                              ChordFactor, self.DihedralFunct,
                              self.TwistFunct).Curve
            for i in xrange(self.SegmentNo + 1)
        ]

        self._Sections = Sections  # I used from debugging - remove it?

        # TODO: Implement chord projection and Curve start/end points
        # to rescale smoothed curves and for secondary loft methods

        LS = act.AddSurfaceLoft(Sections,
                                max_degree=self._max_degree,
                                continuity=self._Cont)

        if LS is None:
            pass

        WingTip = None

        if self.TipRequired:
            pass

        # Scaling
        if self.ScaleFactor != 1:
            Origin = gp_Pnt(0., 0., 0.)
            LS = act.scale_uniformal(LS, Origin, self.ScaleFactor)
            # TODO: Wing tip scaling (TipRequired is not implemented yet)
            if self.TipRequired and WingTip:
                pass

        self.RootChord = (self.ChordFunct(0) * ChordFactor) * ScaleFactor

        # Temporarily set other variables as None until above TODO's are done
        ActualSemiSpan = None
        LSP_area = None
        AR = None

        return LS, ActualSemiSpan, LSP_area, AR, WingTip