本文整理匯總了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)