当前位置: 首页>>代码示例>>Python>>正文


Python pcbnew.wxPoint方法代码示例

本文整理汇总了Python中pcbnew.wxPoint方法的典型用法代码示例。如果您正苦于以下问题:Python pcbnew.wxPoint方法的具体用法?Python pcbnew.wxPoint怎么用?Python pcbnew.wxPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pcbnew的用法示例。


在下文中一共展示了pcbnew.wxPoint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: plot_drill

# 需要导入模块: import pcbnew [as 别名]
# 或者: from pcbnew import wxPoint [as 别名]
def plot_drill(self):
        board_name = os.path.splitext(os.path.basename(self.board.GetFileName()))[0]
        logger.info('Plotting drill file')
        drill_writer = pcbnew.EXCELLON_WRITER(self.board)

        mirror = False
        minimalHeader = False
        offset = pcbnew.wxPoint(0, 0)
        merge_npth = True # TODO: do we want this?
        drill_writer.SetOptions(mirror, minimalHeader, offset, merge_npth)

        metric_format = True
        drill_writer.SetFormat(metric_format)

        generate_drill = True
        generate_map = False
        drill_writer.CreateDrillandMapFilesSet(self.plot_directory, generate_drill, generate_map)

        drill_file_name = os.path.join(
            self.plot_directory,
            '%s.drl' % (board_name,)
        )

        return drill_file_name 
开发者ID:productize,项目名称:kicad-automation-scripts,代码行数:26,代码来源:pcb_util.py

示例2: plot_drill_map

# 需要导入模块: import pcbnew [as 别名]
# 或者: from pcbnew import wxPoint [as 别名]
def plot_drill_map(self):
        board_name = os.path.splitext(os.path.basename(self.board.GetFileName()))[0]
        drill_writer = pcbnew.EXCELLON_WRITER(self.board)
        drill_writer.SetMapFileFormat(pcbnew.PLOT_FORMAT_PDF)

        mirror = False
        minimalHeader = False
        offset = pcbnew.wxPoint(0, 0)
        merge_npth = True # TODO: do we want this?
        drill_writer.SetOptions(mirror, minimalHeader, offset, merge_npth)

        metric_format = True
        drill_writer.SetFormat(metric_format)

        generate_drill = False
        generate_map = True
        drill_writer.CreateDrillandMapFilesSet(self.plot_directory, generate_drill, generate_map)

        map_file_name = os.path.join(
            self.plot_directory,
            '%s-drl_map.pdf' % (board_name,)
        )

        return map_file_name 
开发者ID:productize,项目名称:kicad-automation-scripts,代码行数:26,代码来源:pcb_util.py

示例3: __ComputeCurved

# 需要导入模块: import pcbnew [as 别名]
# 或者: from pcbnew import wxPoint [as 别名]
def __ComputeCurved(vpercent, w, vec, via, pts, segs):
    """Compute the curves part points"""

    radius = via[1]/2.0

    # Compute the bezier middle points
    req_angle = asin(vpercent/100.0)
    oppside = tan(req_angle)*(radius-(w/sin(req_angle)))
    length = sqrt(radius*radius + oppside*oppside)
    d = req_angle - acos(radius/length)
    vecBC = [vec[0]*cos(d)+vec[1]*sin(d), -vec[0]*sin(d)+vec[1]*cos(d)]
    pointBC = via[0] + wxPoint(int(vecBC[0] * length), int(vecBC[1] * length))
    d = -d
    vecAE = [vec[0]*cos(d)+vec[1]*sin(d), -vec[0]*sin(d)+vec[1]*cos(d)]
    pointAE = via[0] + wxPoint(int(vecAE[0] * length), int(vecAE[1] * length))

    curve1 = __Bezier(pts[1], pointBC, pts[2], n=segs)
    curve2 = __Bezier(pts[4], pointAE, pts[0], n=segs)

    return curve1 + [pts[3]] + curve2 
开发者ID:NilujePerchut,项目名称:kicad_scripts,代码行数:22,代码来源:td.py

示例4: __init__

# 需要导入模块: import pcbnew [as 别名]
# 或者: from pcbnew import wxPoint [as 别名]
def __init__(self, x=0.0, y=0.0, noscale=False):
        if (noscale):
            scale = 1
        else:
            scale = self.SCALE

        if (isinstance(x, pcbpoint)):
            self.x = x.x
            self.y = x.y
        elif (isinstance(x, pcbnew.wxPoint)):
            # later, when I get a wxpoint, I'll put the origin back
            self.x = x.x - self.origin[0]*self.SCALE
            self.y = self.origin[1]*self.SCALE - x.y
        elif (type(x) == tuple):
            self.x = int(scale*x[0])
            self.y = int(scale*x[1])
        elif (type(x) == list):
            pdb.set_trace()
        else:
            self.x = int(scale*x)
            self.y = int(scale*y) 
开发者ID:mmccoo,项目名称:kicad_mmccoo,代码行数:23,代码来源:pcbpoint.py

示例5: createVias

# 需要导入模块: import pcbnew [as 别名]
# 或者: from pcbnew import wxPoint [as 别名]
def createVias(self, viaPoints, viaDrill, viaSize, netCode):
        newVias = []
        for viaPoint in viaPoints:
            newVia = pcbnew.VIA(self.boardObj)
            if hasattr(newVia, 'SetTimeStamp'):
                ts = 55
                newVia.SetTimeStamp(ts)  # adding a unique number as timestamp to mark this via as generated by this script
            self.boardObj.Add(newVia)

            newVia.SetPosition(pcbnew.wxPoint(viaPoint[0], viaPoint[1]))
            newVia.SetWidth(viaSize)
            newVia.SetDrill(viaDrill)
            if hasattr(pcbnew, 'VIA_THROUGH'):
                newVia.SetViaType(pcbnew.VIA_THROUGH)
            else:
                newVia.SetViaType(pcbnew.VIATYPE_THROUGH)
            newVia.SetNetCode(netCode)
            newVias += [newVia]

        return newVias 
开发者ID:easyw,项目名称:RF-tools-KiCAD,代码行数:22,代码来源:viafence_action.py

示例6: poly_points

# 需要导入模块: import pcbnew [as 别名]
# 或者: from pcbnew import wxPoint [as 别名]
def poly_points(track_start, track_end, track_width, clearance):
    """
    """
    delta = track_width / 2 + clearance
    dx = track_end.x - track_start.x
    dy = track_end.y - track_start.y
    theta = np.arctan2(dy, dx)
    len = np.sqrt(np.power(dx, 2) + np.power(dy, 2))
    dx_norm = dx / len
    dy_norm = dy / len

    delta_x = delta * -dy_norm
    delta_y = delta * dx_norm
    pt_delta = pcbnew.wxPoint(delta_x, delta_y)

    pts = []
    pts.append(track_start + pt_delta)
    for pt in semicircle_points(track_start, delta, theta, True):
        pts.append(pt)
    pts.append(track_start - pt_delta)
    pts.append(track_end - pt_delta)
    for pt in semicircle_points(track_end, delta, theta, False):
        pts.append(pt)
    pts.append(track_end + pt_delta)
    return pcbnew.wxPoint_Vector(pts) 
开发者ID:easyw,项目名称:RF-tools-KiCAD,代码行数:27,代码来源:trace_clearance.py

示例7: semicircle_points

# 需要导入模块: import pcbnew [as 别名]
# 或者: from pcbnew import wxPoint [as 别名]
def semicircle_points(circle_center, radius, angle_norm, is_start=True):
    """
    """
    num_points = 20

    angles = np.linspace(
        angle_norm + np.pi / 2, angle_norm + 3 * np.pi / 2, num_points + 2
    )
    angles = angles[1:-1]
    if not is_start:
        angles = np.add(angles, np.pi)
    pts = []
    for ang in angles:
        pts.append(
            circle_center
            + pcbnew.wxPoint(radius * np.cos(ang), radius * np.sin(ang))
        )
    return pcbnew.wxPoint_Vector(pts) 
开发者ID:easyw,项目名称:RF-tools-KiCAD,代码行数:20,代码来源:trace_clearance.py

示例8: __Bezier

# 需要导入模块: import pcbnew [as 别名]
# 或者: from pcbnew import wxPoint [as 别名]
def __Bezier(p1, p2, p3, n=20.0):
    n = float(n)
    pts = []
    for i in range(int(n)+1):
        t = i/n
        a = (1.0 - t) ** 2
        b = 2.0*t*(1.0-t)
        c = t**2

        x = int(a * p1[0] + b * p2[0] + c * p3[0])
        y = int(a * p1[1] + b * p2[1] + c * p3[1])
        pts.append(wxPoint(x, y))
    return pts 
开发者ID:NilujePerchut,项目名称:kicad_scripts,代码行数:15,代码来源:td.py

示例9: make_line

# 需要导入模块: import pcbnew [as 别名]
# 或者: from pcbnew import wxPoint [as 别名]
def make_line(board, start, end, layer):

    start = pcbnew.wxPoint(pcbnew.Millimeter2iu(start[0]), pcbnew.Millimeter2iu(start[1]))
    end   = pcbnew.wxPoint(pcbnew.Millimeter2iu(end[0]),   pcbnew.Millimeter2iu(end[1]))
    if (start == end):
        return
    seg = pcbnew.DRAWSEGMENT(board)
    seg.SetLayer(layer)
    seg.SetShape(pcbnew.S_SEGMENT)
    seg.SetStart(start)
    seg.SetEnd(end)
    board.Add(seg) 
开发者ID:mmccoo,项目名称:kicad_mmccoo,代码行数:14,代码来源:svg2border.py

示例10: draw_seg

# 需要导入模块: import pcbnew [as 别名]
# 或者: from pcbnew import wxPoint [as 别名]
def draw_seg(board, p1, p2, layer):
    seg = pcbnew.DRAWSEGMENT(board)
    seg.SetShape(pcbnew.S_SEGMENT)
    seg.SetLayer(layer)

    seg.SetStart(pcbnew.wxPoint(*p1))
    seg.SetEnd(pcbnew.wxPoint(*p2))
    board.Add(seg) 
开发者ID:mmccoo,项目名称:kicad_mmccoo,代码行数:10,代码来源:delaunay.py

示例11: create_via

# 需要导入模块: import pcbnew [as 别名]
# 或者: from pcbnew import wxPoint [as 别名]
def create_via(board, net, pt):
    newvia = pcbnew.VIA(board)
    # need to add before SetNet will work, so just doing it first
    board.Add(newvia)
    toplayer = layertable['F.Cu']
    bottomlayer = layertable['B.Cu']

    newvia.SetNet(net)
    nc = net.GetNetClass()
    newvia.SetWidth(nc.GetViaDiameter())
    newvia.SetPosition(pcbnew.wxPoint(*pt))
    newvia.SetLayerPair(toplayer, bottomlayer)
    newvia.SetViaType(pcbnew.VIA_THROUGH)

# I don't want to update the geometries everytime I add something. 
开发者ID:mmccoo,项目名称:kicad_mmccoo,代码行数:17,代码来源:via_fill.py

示例12: wxpoint

# 需要导入模块: import pcbnew [as 别名]
# 或者: from pcbnew import wxPoint [as 别名]
def wxpoint(self):
        # y is minus because y increases going down the canvase
        return pcbnew.wxPoint(self.origin[0]*self.SCALE+self.x,
                              self.origin[1]*self.SCALE-self.y) 
开发者ID:mmccoo,项目名称:kicad_mmccoo,代码行数:6,代码来源:pcbpoint.py

示例13: smdCustomArcPad

# 需要导入模块: import pcbnew [as 别名]
# 或者: from pcbnew import wxPoint [as 别名]
def smdCustomArcPad(self, module, size, pos, rad, name, angle_D, layer, ln, solder_clearance):
        pad = D_PAD(module)
        ## NB pads must be the same size and have the same center
        pad.SetSize(size)
        #pad.SetSize(pcbnew.wxSize(size[0]/5,size[1]/5))
        pad.SetShape(PAD_SHAPE_CUSTOM) #PAD_RECT)
        pad.SetAttribute(PAD_ATTRIB_SMD) #PAD_SMD)
        #pad.SetDrillSize (0.)
        #Set only the copper layer without mask
        #since nothing is mounted on these pads
        pad.SetPos0(pos)
        pad.SetPosition(pos)
        pad.SetPadName(name)
        #pad.Rotate(pos, angle)
        pad.SetAnchorPadShape(PAD_SHAPE_CIRCLE) #PAD_SHAPE_RECT)
        if solder_clearance > 0:
            pad.SetLocalSolderMaskMargin(solder_clearance)
            pad.SetLayerSet(pad.ConnSMDMask())
        else:
            pad.SetLayerSet( LSET(layer) )
        
        if not ln:
            pad.AddPrimitive(pcbnew.wxPoint(0,rad), pcbnew.wxPoint(0,0), int(angle_D*10), (size[0]))
        else:
            pad.AddPrimitive(pcbnew.wxPoint(0,0), pcbnew.wxPoint(rad,0), (size[0]))
        return pad 
开发者ID:easyw,项目名称:RF-tools-KiCAD,代码行数:28,代码来源:uwArcPrimitive_wizard.py

示例14: smdCustomPolyPad

# 需要导入模块: import pcbnew [as 别名]
# 或者: from pcbnew import wxPoint [as 别名]
def smdCustomPolyPad(self, module, size, pos, name, vpoints, layer, solder_clearance):
        pad = D_PAD(module)
        ## NB pads must be the same size and have the same center
        pad.SetSize(size)
        #pad.SetSize(pcbnew.wxSize(size[0]/5,size[1]/5))
        pad.SetShape(PAD_SHAPE_CUSTOM) #PAD_RECT)
        pad.SetAttribute(PAD_ATTRIB_SMD) #PAD_SMD)
        #pad.SetDrillSize (0.)
        #Set only the copper layer without mask
        #since nothing is mounted on these pads
        #pad.SetPos0(wxPoint(0,0)) #pos)
        #pad.SetPosition(wxPoint(0,0)) #pos)
        pad.SetPos0(pos)
        pad.SetPosition(pos)
        #pad.SetOffset(pos)
        pad.SetPadName(name)
        #pad.Rotate(pos, angle)
        pad.SetAnchorPadShape(PAD_SHAPE_RECT) #PAD_SHAPE_CIRCLE) #PAD_SHAPE_RECT)
        if solder_clearance > 0:
            pad.SetLocalSolderMaskMargin(solder_clearance)
            pad.SetLayerSet(pad.ConnSMDMask())
        else:
            pad.SetLayerSet( LSET(layer) )
        
        pad.AddPrimitive(vpoints,0) # (size[0]))
        return pad 
开发者ID:easyw,项目名称:RF-tools-KiCAD,代码行数:28,代码来源:uwTaper_wizard.py

示例15: create_round_segments

# 需要导入模块: import pcbnew [as 别名]
# 或者: from pcbnew import wxPoint [as 别名]
def create_round_segments(pcb,sp,a1,ep,a2,cntr,rad,layer,width,Nn,N_SEGMENTS):
    start_point = sp
    end_point = ep
    pos = sp
    next_pos = ep
    a1 = getAngleRadians(cntr,sp)
    a2 = getAngleRadians(cntr,ep)
    wxLogDebug('a1:'+str(math.degrees(a1))+' a2:'+str(math.degrees(a2))+' a2-a1:'+str(math.degrees(a2-a1)),debug)
    if (a2-a1) > 0 and abs(a2-a1) > math.radians(180):
        deltaA = -(math.radians(360)-(a2-a1))/N_SEGMENTS
        wxLogDebug('deltaA reviewed:'+str(math.degrees(deltaA)),debug)
    elif (a2-a1) < 0 and abs(a2-a1) > math.radians(180):
        deltaA = (math.radians(360)-abs(a2-a1))/N_SEGMENTS
        wxLogDebug('deltaA reviewed2:'+str(math.degrees(deltaA)),debug)
    else:
        deltaA = (a2-a1)/N_SEGMENTS
    delta=deltaA
    wxLogDebug('delta:'+str(math.degrees(deltaA))+' radius:'+str(ToMM(rad)),debug)
    points = []
    #import round_trk; import importlib; importlib.reload(round_trk)
    for ii in range (N_SEGMENTS+1): #+1):
        points.append(pos)
        #t = create_Track(pos,pos)
        prv_pos = pos
        #pos = pos + fraction_delta
        #posPolar = cmath.polar(pos)
        #(rad) * cmath.exp(math.radians(deltaA)*1j) #cmath.rect(r, phi) : Return the complex number x with polar coordinates r and phi.
        #pos = wxPoint(posPolar.real+sp.x,posPolar.imag+sp.y)
        pos = rotatePoint(rad,a1,delta,cntr)
        delta=delta+deltaA
        wxLogDebug("pos:"+str(ToUnits(prv_pos.x))+":"+str(ToUnits(prv_pos.y))+";"+str(ToUnits(pos.x))+":"+str(ToUnits(pos.y)),debug)
    for i, p in enumerate(points):
        #if i < len (points)-1:
        if i < len (points)-2:
            t = create_Track(pcb,p,points[i+1],layer,width,Nn,True) #adding ts code to segments
    t = create_Track(pcb,points[-2],ep,layer,width,Nn,True) #avoiding rounding on last segment
    return points[-1]
# 
开发者ID:easyw,项目名称:RF-tools-KiCAD,代码行数:40,代码来源:round_trk.py


注:本文中的pcbnew.wxPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。