本文整理汇总了Python中upconvert.core.components.Component.add_footprint方法的典型用法代码示例。如果您正苦于以下问题:Python Component.add_footprint方法的具体用法?Python Component.add_footprint怎么用?Python Component.add_footprint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类upconvert.core.components.Component
的用法示例。
在下文中一共展示了Component.add_footprint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_components
# 需要导入模块: from upconvert.core.components import Component [as 别名]
# 或者: from upconvert.core.components.Component import add_footprint [as 别名]
def parse_components(self, components):
""" Extract a component library. """
for library_id, component in components.items():
name = component.get('name')
comp = Component(name)
# Get attributes
for key, value in component.get('attributes', []).items():
comp.add_attribute(key, value)
for symbol_json in component.get('symbols', []):
symbol = self.parse_symbol(symbol_json)
comp.add_symbol(symbol)
for footprint_json in component.get('footprints', []):
footprint = self.parse_footprint(footprint_json)
comp.add_footprint(footprint)
self.design.add_component(library_id, comp)
示例2: _convert_library
# 需要导入模块: from upconvert.core.components import Component [as 别名]
# 或者: from upconvert.core.components.Component import add_footprint [as 别名]
def _convert_library(self, struct):
""" Convert library """
for image in struct.library.image:
component = Component(image.image_id)
self.design.add_component(image.image_id, component)
fpt = Footprint()
body = FBody()
component.add_footprint(fpt)
fpt.add_body(body)
for pad in image.pin:
body.add_pad(Pad(pad.pad_id, self.to_pixels(pad.vertex), self.to_pixels(pad.vertex)))
for padstack in struct.library.padstack:
if padstack.padstack_id == pad.padstack_id:
shapes = [shape.shape for shape in padstack.shape]
for shape in self._convert_shapes(shapes, self.to_pixels(pad.vertex)):
body.add_shape(shape)
break
for outline in image.outline:
for shape in self._convert_shapes([outline.shape]):
body.add_shape(shape)