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


Python Shape.getLocation方法代码示例

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


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

示例1: _placeShapes

# 需要导入模块: from shape import Shape [as 别名]
# 或者: from shape.Shape import getLocation [as 别名]
    def _placeShapes(self):
        """
        """

        mirror = False

        try:
            shapes_dict = self._module_dict['shapes']
        except:
            return


        for sheet in ['copper','soldermask','solderpaste','silkscreen']:
            try:
                shapes = shapes_dict[sheet]
            except KeyError:
                continue

            there_are_pours = {}
            shape_groups = {}
            for pcb_layer in utils.getSurfaceLayers():
                there_are_pours[pcb_layer] = utils.checkForPoursInLayer(pcb_layer)
                shape_groups[pcb_layer] = et.SubElement(self._layers[pcb_layer][sheet]['layer'], 'g')
                shape_groups[pcb_layer].set('{'+config.cfg['ns']['pcbmode']+'}type', 'module-shapes')


            for shape_dict in shapes:

                pcb_layers = shape_dict.get('layers') or ['top']

                for pcb_layer in pcb_layers:

                    # Shapes placed on the bottom layer are not mirrored
                    # unless they are text, in which case, it's the
                    # expected behaviour and so it is mirrored by default
                    # unless otherwise instructed.
                    try:
                        shape_mirror = shape_dict.get['mirror']
                    except:
                        if shape_dict['type'] == 'text':
                            shape_mirror = True
                        else:
                            shape_mirror = False
                        
                    if (pcb_layer == 'bottom') and (shape_mirror != False):
                        mirror = True
                    else:
                        mirror = False

                    shape = Shape(shape_dict)
                    style = Style(shape_dict, sheet)
                    shape.setStyle(style)
                    place.placeShape(shape, shape_groups[pcb_layer], mirror)
     
                    # Place mask for pour if copper shape
                    if (sheet == 'copper') and (there_are_pours[pcb_layer] == True):
                        location = shape.getLocation()
                        transform = "translate(%s,%s)" % (location.x, location.y)
                        mask_group = et.SubElement(self._masks[pcb_layer], 'g')
                                                   #id="routing_masks") 
                                                   #transform=transform)
                        self._placeMask(svg_layer=mask_group, 
                                        shape=shape,
                                        kind='pad',
                                        original=False,
                                        mirror=False)
开发者ID:hobzcalvin,项目名称:pcbmode,代码行数:68,代码来源:module.py


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