Exemple #1
0
    def __init__(self,
                 x,
                 lx,
                 corners,
                 extrusion_direction='x',
                 magnetisation=[0, 0, 0]):
        '''
        Constructor
        
        stores params in object.
        calls radia function and stores identifyin ID
        '''

        self.x = x
        self.lx = lx
        self.corners = corners
        self.extrusion_direction = extrusion_direction
        self.magnetisation = magnetisation

        self.vertices = np.zeros((2 * len(corners), 3))
        self.polygons = [[] for _ in range(2 + len(corners))]

        if self.extrusion_direction == 'x':
            for i in range(len(corners)):
                self.vertices[i, :] = np.array(
                    [self.x - self.lx / 2.0, corners[i][0], corners[i][1]])
                self.vertices[i + len(corners), :] = np.array(
                    [self.x + self.lx / 2.0, corners[i][0], corners[i][1]])

        elif self.extrusion_direction == 'y':
            for i in range(len(corners)):
                self.vertices[i, :] = np.array(
                    [corners[i][1], self.x - self.lx / 2.0, corners[i][0]])
                self.vertices[i + len(corners), :] = np.array(
                    [corners[i][1], self.x + self.lx / 2.0, corners[i][0]])
        elif self.extrusion_direction == 'z':
            for i in range(len(corners)):
                self.vertices[i, :] = np.array(
                    [corners[i][0], corners[i][1], self.x - self.lx / 2.0])
                self.vertices[i + len(corners), :] = np.array(
                    [corners[i][0], corners[i][1], self.x + self.lx / 2.0])

        self.polygons[0] = np.arange(len(corners))
        self.polygons[1] = np.arange(len(corners), 2 * len(corners))

        n = len(corners)
        for i in range(n):
            self.polygons[i + 2] = np.array(
                [i, n + i, n + ((i + 1) % n), (i + 1) % n])

        self.radobj = rd.ObjThckPgn(self.x, self.lx, self.corners,
                                    self.extrusion_direction,
                                    self.magnetisation)
    def build_model(self):
        """Build a Radia or Opera model with the current result set."""
        length = self.length_spinbox.value()
        if self.build_button.text() == 'Radia':
            rad.UtiDelAll()
            item = self.listview.selectedItems()[0]
            # build magnet geometry
            magnet = rad.ObjCnt([rad.ObjThckPgn(0, length, pg[2:].reshape((4, 2)).tolist(), "z", list(pg[:2]) + [0, ])
                                 for pg in self.state['results'][tuple(item.text().split(', '))]])
            rad.MatApl(magnet, rad.MatStd('NdFeB', next(c for c in self.controls if c.switch == 'Br').control.value()))

            # plot geometry in 3d
            ax = self.plot3d.axes
            ax.cla()
            ax.set_axis_off()
            polygons = rad.ObjDrwVTK(magnet)['polygons']
            vertices = np.array(polygons['vertices']).reshape((-1, 3))  # [x, y, z, x, y, z] -> [[x, y, z], [x, y, z]]
            [set_lim(vertices.min(), vertices.max()) for set_lim in (ax.set_xlim3d, ax.set_ylim3d, ax.set_zlim3d)]
            vertices = np.split(vertices, np.cumsum(polygons['lengths'])[:-1])  # split to find each face
            ax.add_collection3d(Poly3DCollection(vertices, linewidths=0.1, edgecolors='black',
                                                 facecolors=self.get_colour(), alpha=0.2))

            # add arrows
            magnetisation = np.array(rad.ObjM(magnet)).reshape((-1, 6)).T  # reshape to [x, y, z, mx, my, mz]
            for end in (-1, 1):  # one at each end of the block, not in the middle
                magnetisation[2] = end * length / 2
                ax.quiver(*magnetisation, color='black', lw=1, pivot='middle')

            self.tab_control.setCurrentIndex(2)  # switch to '3d' tab

            # solve the model
            try:
                rad.Solve(magnet, 0.00001, 10000)  # precision and number of iterations
            except RuntimeError:
                self.statusBar().showMessage('Radia solve error')

            # get results
            dx = 0.1
            multipoles = [mpole_names.index(c.label) for c in self.controls if c.label.endswith('pole') and c.get_arg()]
            i = multipoles[-1]
            xs = np.linspace(-dx, dx, 4)
            fit_field = np.polyfit(xs / 1000, [rad.Fld(magnet, 'by', [x, 0, 0]) for x in xs], i)
            fit_int = np.polyfit(xs / 1000,
                                 [rad.FldInt(magnet, 'inf', 'iby', [x, 0, -1], [x, 0, 1]) * 0.001 for x in xs], i)
            text = ''
            for j, (l, c, ic, u, iu) in enumerate(
                    zip(mpole_names, fit_field[::-1], fit_int[::-1], units[1:], units[:-1])):
                if j in multipoles:
                    f = factorial(j)  # 1 for dip, quad; 2 for sext; 6 for oct
                    text += f'{l} field = {c * f:.3g} {u}, integral = {ic * f:.3g} {iu}, length = {ic / c:.3g} m\n'
            ax.text2D(1, 1, text, transform=ax.transAxes, va='top', ha='right', fontdict={'size': 8})
            self.plot3d.canvas.draw()
Exemple #3
0
    def create_radia_object(self):
        """Create radia object."""
        if self._radia_object is not None:
            _rad.UtiDel(self._radia_object)

        if self._length == 0:
            return

        mat = _rad.MatLin([self._ksipar, self._ksiper],
                          _np.linalg.norm(self._magnetization))

        if self._rectangular_shape:
            center = []
            width = []
            height = []
            for shp in self._shape:
                shp = _np.array(shp)
                min0 = _np.min(shp[:, 0])
                max0 = _np.max(shp[:, 0])
                min1 = _np.min(shp[:, 1])
                max1 = _np.max(shp[:, 1])
                center.append([(max0 + min0) / 2, (max1 + min1) / 2])
                width.append(max0 - min0)
                height.append(max1 - min1)

            subblock_list = []
            for ctr, wdt, hgt, div in zip(center, width, height,
                                          self._subdivision):
                subblock = _rad.ObjRecMag(
                    [ctr[0], ctr[1], self._longitudinal_position],
                    [wdt, hgt, self._length], self._magnetization)
                subblock = _rad.MatApl(subblock, mat)
                subblock = _rad.ObjDivMag(subblock, div, 'Frame->Lab')
                subblock_list.append(subblock)
            self._radia_object = _rad.ObjCnt(subblock_list)

        else:
            subblock_list = []
            for shp, div in zip(self._shape, self._subdivision):
                subblock = _rad.ObjThckPgn(self._longitudinal_position,
                                           self._length, shp, 'z',
                                           self._magnetization)
                subblock = _rad.MatApl(subblock, mat)
                subblock = _rad.ObjDivMag(subblock, div, 'Frame->Lab')
                subblock_list.append(subblock)
            self._radia_object = _rad.ObjCnt(subblock_list)
def HybridUndCenPart(_gap,
                     _gap_ofst,
                     _nper,
                     _air,
                     _lp,
                     _ch_p,
                     _np,
                     _np_tip,
                     _mp,
                     _cp,
                     _lm,
                     _ch_m_xz,
                     _ch_m_yz,
                     _ch_m_yz_r,
                     _nm,
                     _mm,
                     _cm,
                     _use_ex_sym=False):
    zer = [0, 0, 0]
    grp = rad.ObjCnt([])

    y = _lp[1] / 4
    initM = [0, -1, 0]

    pole = rad.ObjFullMag([_lp[0] / 4, y, -_lp[2] / 2 - _gap / 2 - _ch_p],
                          [_lp[0] / 2, _lp[1] / 2, _lp[2]], zer,
                          [_np[0], int(_np[1] / 2 + 0.5), _np[2]], grp, _mp,
                          _cp)

    if (_ch_p > 0.):  # Pole Tip
        poleTip = rad.ObjThckPgn(
            _lp[0] / 4, _lp[0] / 2,
            [[y - _lp[1] / 4, -_gap / 2 - _ch_p], [y - _lp[1] / 4, -_gap / 2],
             [y + _lp[1] / 4 - _ch_p, -_gap / 2],
             [y + _lp[1] / 4, -_gap / 2 - _ch_p]], zer)
        rad.ObjDivMag(
            poleTip,
            [_np_tip[0], int(_np_tip[1] / 2 + 0.5), _np_tip[2]])
        rad.MatApl(poleTip, _mp)
        rad.ObjDrwAtr(poleTip, _cp)
        rad.ObjAddToCnt(grp, [poleTip])

    y += _lp[1] / 4 + _air + _lm[1] / 2

    for i in range(_nper):
        magnet = rad.ObjThckPgn(
            _lm[0] / 4, _lm[0] / 2,
            [[y + _lm[1] / 2 - _ch_m_yz_r * _ch_m_yz, -_gap / 2 - _gap_ofst],
             [y + _lm[1] / 2, -_gap / 2 - _gap_ofst - _ch_m_yz],
             [y + _lm[1] / 2, -_gap / 2 - _gap_ofst - _lm[2] + _ch_m_yz],
             [
                 y + _lm[1] / 2 - _ch_m_yz_r * _ch_m_yz,
                 -_gap / 2 - _gap_ofst - _lm[2]
             ],
             [
                 y - _lm[1] / 2 + _ch_m_yz_r * _ch_m_yz,
                 -_gap / 2 - _gap_ofst - _lm[2]
             ], [y - _lm[1] / 2, -_gap / 2 - _gap_ofst - _lm[2] + _ch_m_yz],
             [y - _lm[1] / 2, -_gap / 2 - _gap_ofst - _ch_m_yz],
             [y - _lm[1] / 2 + _ch_m_yz_r * _ch_m_yz, -_gap / 2 - _gap_ofst]],
            initM)
        # Cuting Magnet Corners
        magnet = rad.ObjCutMag(
            magnet, [_lm[0] / 2 - _ch_m_xz, 0, -_gap / 2 - _gap_ofst],
            [1, 0, 1])[0]
        magnet = rad.ObjCutMag(
            magnet, [_lm[0] / 2 - _ch_m_xz, 0, -_gap / 2 - _gap_ofst - _lm[2]],
            [1, 0, -1])[0]

        rad.ObjDivMag(magnet, _nm)
        rad.MatApl(magnet, _mm)
        rad.ObjDrwAtr(magnet, _cm)
        rad.ObjAddToCnt(grp, [magnet])

        initM[1] *= -1
        y += _lm[1] / 2 + _lp[1] / 2 + _air

        if (i < _nper - 1):
            pole = rad.ObjFullMag(
                [_lp[0] / 4, y, -_lp[2] / 2 - _gap / 2 - _ch_p],
                [_lp[0] / 2, _lp[1], _lp[2]], zer, _np, grp, _mp, _cp)

            if (_ch_p > 0.):  # Pole Tip
                poleTip = rad.ObjThckPgn(_lp[0] / 4, _lp[0] / 2,
                                         [[y - _lp[1] / 2, -_gap / 2 - _ch_p],
                                          [y - _lp[1] / 2 + _ch_p, -_gap / 2],
                                          [y + _lp[1] / 2 - _ch_p, -_gap / 2],
                                          [y + _lp[1] / 2, -_gap / 2 - _ch_p]],
                                         zer)
                rad.ObjDivMag(poleTip, _np_tip)
                rad.MatApl(poleTip, _mp)
                rad.ObjDrwAtr(poleTip, _cp)
                rad.ObjAddToCnt(grp, [poleTip])

            y += _lm[1] / 2 + _lp[1] / 2 + _air

    y -= _lp[1] / 4
    pole = rad.ObjFullMag([_lp[0] / 4, y, -_lp[2] / 2 - _gap / 2 - _ch_p],
                          [_lp[0] / 2, _lp[1] / 2, _lp[2]], zer,
                          [_np[0], int(_np[1] / 2 + 0.5), _np[2]], grp, _mp,
                          _cp)
    if (_ch_p > 0.):  # Pole Tip
        poleTip = rad.ObjThckPgn(
            _lp[0] / 4, _lp[0] / 2,
            [[y - _lp[1] / 4, -_gap / 2 - _ch_p],
             [y - _lp[1] / 4 + _ch_p, -_gap / 2], [y + _lp[1] / 4, -_gap / 2],
             [y + _lp[1] / 4, -_gap / 2 - _ch_p]], zer)
        rad.ObjDivMag(
            poleTip,
            [_np_tip[0], int(_np_tip[1] / 2 + 0.5), _np_tip[2]])
        rad.MatApl(poleTip, _mp)
        rad.ObjDrwAtr(poleTip, _cp)
        rad.ObjAddToCnt(grp, [poleTip])

    # Symmetries
    if (
            _use_ex_sym
    ):  # Some "non-physical" mirroring (applicable for calculation of central field only)
        y += _lp[1] / 4
        rad.TrfZerPerp(grp, [0, y, 0], [0, 1, 0])  # Mirror left-right
        rad.TrfZerPerp(grp, [0, 2 * y, 0], [0, 1, 0])

    #     #"Physical" symmetries (applicable also for calculation of total structure with terminations)
    #     rad.TrfZerPerp(grp, zer, [0,1,0]) #Mirror left-right
    #     #Mirror front-back
    #     rad.TrfZerPerp(grp, zer, [1,0,0])
    #     #Mirror top-bottom
    #     rad.TrfZerPara(grp, zer, [0,0,1])

    return grp
Exemple #5
0
mag00 = rad.ObjRecMag([5,0,0], [5,8,10], [-0.5,1,0.7])

#rad.ObjDrwOpenGL(mag00)

#data = rad.ObjDrwVTK(mag00, 'Axes->False')
##print(data)

#print(data['polygons']['vertices'])

#print(6*4*3)

#print('Number of Polygon Vertex Coords:', len(data['polygons']['vertices']))



mag01 = rad.ObjThckPgn(20, 10., [[-10,-10], [-12,5], [5,0], [7,-15]], 'x', [0,0,1])

vertices = [[-10,0,0], [0,0,0], [0,10,0], [0,0,10]]
faces = [[1,2,3], [1,4,2], [2,4,3], [1,3,4]]
mag02 = rad.ObjPolyhdr(vertices, faces, [0,0,1])

mag03 = rad.ObjArcPgnMag([0,5], 'z', [[2,0],[2,10],[10,10],[10,5]], [0,0.5], 5, 'nosym', [0,0,1])

mag04 = rad.ObjMltExtPgn([[[[-10,-10],[-15,-5],[-5,5],[5,5],[10,-15]], -15], [[[-5,-5],[-7.5,-2.5],[-2.5,2.5],[2.5,2.5],[5,-7.5]], -7]], [0,0,1])

mag05 = rad.ObjMltExtRtg([[[0,0,12],[5,10]], [[5,10,20],[15,5]]], [0,0,1])

mag06 = rad.ObjMltExtTri(25, 8, [[0,-15],[-15,0],[0,15],[15,0]], [[5,1],[5,2],[5,3],[5,1]], 'z', [0,0,1], 'ki->Numb,TriAngMin->20,TriAreaMax->10')

mag07 = rad.ObjCylMag([0,20,0], 5, 10, 21, 'z', [0,0,1])
Exemple #6
0
    def build(self):
        """Create a quadrupole with the given geometry."""
        if self.solve_state < SolveState.SHAPES:
            self.define_shapes()

        rad.UtiDelAll()
        origin = [0, 0, 0]
        nx = [1, 0, 0]
        ny = [0, 1, 0]
        nz = [0, 0, 1]

        tip_mesh = round(self.min_mesh)
        pole_mesh = round(self.min_mesh * self.pole_mult)
        yoke_mesh = round(self.min_mesh * self.yoke_mult)

        length = self.length

        # Subdivide the pole tip cylindrically. The axis is where the edge of the tapered pole meets the Y-axis.
        points = rotate45(self.tip_points)
        x2, y2 = points[-2]  # top right of pole
        x3, y3 = points[-3]  # bottom right of pole
        m = (y2 - y3) / (x2 - x3)
        c = y2 - m * x2
        pole_tip = rad.ObjThckPgn(length / 2, length, points, "z")
        # Slice off the chamfer (note the indexing at the end here - selects the pole not the cut-off piece)
        pole_tip = rad.ObjCutMag(pole_tip, [length - self.chamfer, 0, self.r], [1, 0, -1])[0]
        n_div = max(1, round(math.sqrt((x2 - x3) ** 2 + (y2 - y3) ** 2) / pole_mesh))
        # We have to specify the q values here (second element of each sublist in the subdivision argument)
        # otherwise weird things happen
        mesh = [[n_div, 4], [tip_mesh / 3, 1], [tip_mesh, 1]]
        div_opts = 'Frame->Lab;kxkykz->Size'
        # rad.ObjDivMag(pole_tip, [[tip_mesh, 1], [tip_mesh, 1], [tip_mesh, 3]], div_opts)
        rad.ObjDivMag(pole_tip, mesh, "cyl", [[[0, c, 0], nz], nx, 1], div_opts)
        rad.TrfOrnt(pole_tip, rad.TrfRot(origin, nz, -math.pi / 4))

        pole = rad.ObjThckPgn(length / 2, length, rotate45(self.pole_points), "z")
        rad.ObjDivMag(pole, [pole_mesh, ] * 3, div_opts)
        rad.TrfOrnt(pole, rad.TrfRot(origin, nz, -math.pi / 4))

        # Need to split yoke since Radia can't build concave blocks
        points = rotate45(self.yoke_points[:2] + self.yoke_points[-2:])
        # yoke1 is the part that joins the pole to the yoke
        # Subdivide this cylindrically since the flux goes around a corner here
        # The axis is the second point (x1, y1)
        x1, y1 = points[1]
        yoke1 = rad.ObjThckPgn(length / 2, length, points, "z")
        cyl_div = [[[x1, y1, 0], nz], [self.width, self.width, 0], 1]
        # The first (kr) argument, corresponding to radial subdivision,
        # in rad.ObjDivMag cuts by number not size even though kxkykz->Size is specified.
        # So we have to fudge this. It seems to require a larger number to give the right number of subdivisions.
        n_div = max(1, round(2 * self.width / yoke_mesh))
        rad.ObjDivMag(yoke1, [n_div, yoke_mesh, yoke_mesh], "cyl", cyl_div, div_opts)
        rad.TrfOrnt(yoke1, rad.TrfRot(origin, nz, -math.pi / 4))

        # For the second part of the yoke, we use cylindrical subdivision again. But the axis is not on the corner;
        # instead we calculate the point where the two lines converge (xc, yc).
        points = self.yoke_points[1:3] + self.yoke_points[-3:-1]
        x0, y0 = points[0]
        x1, y1 = points[1]
        x2, y2 = points[2]
        x3, y3 = points[3]
        m1 = (y3 - y0) / (x3 - x0)
        m2 = (y2 - y1) / (x2 - x1)
        c1 = y0 - m1 * x0
        c2 = y1 - m2 * x1
        xc = (c2 - c1) / (m1 - m2)
        yc = m1 * xc + c1
        yoke2 = rad.ObjThckPgn(length / 2, length, points, 'z')
        cyl_div = [[[xc, yc, 0], nz], [x3 - xc, y3 - yc, 0], 1]
        n_div = max(1, round(0.7 * n_div))  # this is a bit of a fudge
        rad.ObjDivMag(yoke2, [n_div, yoke_mesh, yoke_mesh], "cyl", cyl_div, div_opts)

        yoke3 = rad.ObjThckPgn(length / 2, length, self.yoke_points[2:6], "z")
        rad.ObjDivMag(yoke3, [yoke_mesh, ] * 3, div_opts)

        steel = rad.ObjCnt([pole_tip, pole, yoke1, yoke2, yoke3])
        rad.ObjDrwAtr(steel, [0, 0, 1], 0.001)  # blue steel
        rad.TrfOrnt(steel, rad.TrfRot(origin, ny, -math.pi / 2))
        rad.ObjDrwOpenGL(steel)
        rad.TrfOrnt(steel, rad.TrfRot(origin, ny, math.pi / 2))
        # rad.TrfMlt(steel, rad.TrfPlSym([0, 0, 0], [1, -1, 0]), 2)  # reflect along X=Y line to create a quadrant
        rad.TrfZerPerp(steel, origin, [1, -1, 0])
        rad.TrfZerPerp(steel, origin, nz)
        steel_material = rad.MatSatIsoFrm([2000, 2], [0.1, 2], [0.1, 2])
        steel_material = rad.MatStd('Steel42')
        steel_material = rad.MatSatIsoFrm([959.703184, 1.41019852], [33.9916543, 0.5389669], [1.39161186, 0.64144324])
        rad.MatApl(steel, steel_material)

        coil = rad.ObjRaceTrk(origin, [5, 5 + self.coil_width],
                              [self.coil_x * 2 - self.r, length * 2], self.coil_height, 4, self.current_density)
        rad.TrfOrnt(coil, rad.TrfRot(origin, nx, -math.pi / 2))
        rad.TrfOrnt(coil, rad.TrfTrsl([0, self.r + self.taper_height + self.coil_height / 2, 0]))
        rad.TrfOrnt(coil, rad.TrfRot(origin, nz, -math.pi / 4))
        rad.ObjDrwAtr(coil, [1, 0, 0], 0.001)  # red coil
        quad = rad.ObjCnt([steel, coil])

        rad.TrfZerPara(quad, origin, nx)
        rad.TrfZerPara(quad, origin, ny)

        # rad.ObjDrwOpenGL(quad)
        self.radia_object = quad
        self.solve_state = SolveState.BUILT
def Geom():

    #Pole faces
    rap = 0.5
    ct = [0, 0, 0]
    z0 = gap / 2
    y0 = width / 2
    amax = hyp * asinh(y0 / z0)
    dz = z0 * (cosh(amax) - 1)
    aStep = amax / np
    na = int(amax * (1 + 2 / np) / aStep) + 1
    qq = [[(z0 * sinh(ia * aStep / hyp)), (z0 * cosh(ia * aStep))]
          for ia in range(na)]
    hh = qq[np][1] + height * rap - dz
    qq[np + 1] = [qq[np][0], hh]
    qq[np + 2] = [0, hh]
    g1 = rad.ObjThckPgn(thick / 4, thick / 2, qq)
    rad.ObjDivMag(g1, n1)

    #Vertical segment on top of pole faces
    g2 = rad.ObjRecMag(
        [thick / 4, width / 4, gap / 2 + height * (1 / 2 + rap / 2)],
        [thick / 2, width / 2, height * (1 - rap)])
    rad.ObjDivMag(g2, n2)

    #Corner
    gg = rad.ObjCnt([g1, g2])
    gp = rad.ObjCutMag(gg, [thick / 2 - chamfer - gap / 2, 0, 0],
                       [1, 0, -1])[0]
    g3 = rad.ObjRecMag([thick / 4, width / 4, gap / 2 + height + depth / 2],
                       [thick / 2, width / 2, depth])
    cy = [[[0, width / 2, gap / 2 + height], [1, 0, 0]],
          [0, 0, gap / 2 + height], 2 * depth / width]
    rad.ObjDivMag(g3, [nr3, np3, nx], 'cyl', cy)

    #Horizontal segment between the corners
    tan_n = tan(2 * pi / 2 / Nn)
    length = tan_n * (height + gap / 2) - width / 2
    g4 = rad.ObjRecMag(
        [thick / 4, width / 2 + length / 2, gap / 2 + height + depth / 2],
        [thick / 2, length, depth])
    rad.ObjDivMag(g4, n4)

    #The other corner
    posy = width / 2 + length
    posz = posy / tan_n
    g5 = rad.ObjThckPgn(thick / 4, thick / 2,
                        [[posy, posz], [posy, posz + depth],
                         [posy + depth * tan_n, posz + depth]])
    cy = [[[0, posy, posz], [1, 0, 0]], [0, posy, posz + depth], 1]
    rad.ObjDivMag(g5, [nr5, np5, nx], 'cyl', cy)

    #Generation of the coil
    Rmax = Rmin - width / 2 + gap / 2 + offset - 2
    coil1 = rad.ObjRaceTrk([0, 0, gap / 2 + height / 2 + offset / 2],
                           [Rmin, Rmax], [thick, width - 2 * Rmin],
                           height - offset, 3, CurDens)
    rad.ObjDrwAtr(coil1, coilcolor)
    hh = (height - offset) / 2
    coil2 = rad.ObjRaceTrk([0, 0, gap / 2 + height - hh / 2],
                           [Rmax, Rmax + hh * 0.8], [thick, width - 2 * Rmin],
                           hh, 3, CurDens)
    rad.ObjDrwAtr(coil2, coilcolor)

    #Make container, set the colors and define symmetries
    g = rad.ObjCnt([gp, g3, g4, g5])
    rad.ObjDrwAtr(g, ironcolor)
    gd = rad.ObjCnt([g])

    rad.TrfZerPerp(gd, ct, [1, 0, 0])
    rad.TrfZerPerp(gd, ct, [0, 1, 0])

    t = rad.ObjCnt([gd, coil1, coil2])
    rad.TrfZerPara(t, ct, [0, cos(pi / Nn), sin(pi / Nn)])

    rad.TrfMlt(t, rad.TrfRot(ct, [1, 0, 0], 4 * pi / Nn), int(round(Nn / 2)))
    rad.MatApl(g, ironmat)
    rad.TrfOrnt(t, rad.TrfRot([0, 0, 0], [1, 0, 0], pi / Nn))

    return t