本文整理汇总了Python中upconvert.core.component_instance.ComponentInstance.set_footprint_pos方法的典型用法代码示例。如果您正苦于以下问题:Python ComponentInstance.set_footprint_pos方法的具体用法?Python ComponentInstance.set_footprint_pos怎么用?Python ComponentInstance.set_footprint_pos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类upconvert.core.component_instance.ComponentInstance
的用法示例。
在下文中一共展示了ComponentInstance.set_footprint_pos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_component_instances
# 需要导入模块: from upconvert.core.component_instance import ComponentInstance [as 别名]
# 或者: from upconvert.core.component_instance.ComponentInstance import set_footprint_pos [as 别名]
def parse_component_instances(self, component_instances):
""" Extract the component instances. """
if component_instances is None:
return None
for instance in component_instances:
# Get instance_id, library_id and symbol_index
instance_id = instance.get("instance_id")
library_id = instance.get("library_id")
symbol_index = int(instance.get("symbol_index"))
footprint_index = int(instance.get("footprint_index"))
# Make the ComponentInstance()
inst = ComponentInstance(
instance_id, self.design.components.components[library_id], library_id, symbol_index, footprint_index
)
# Get the SymbolAttributes
for symbol_attribute in instance.get("symbol_attributes", []):
attr = self.parse_symbol_attribute(symbol_attribute)
inst.add_symbol_attribute(attr)
# TODO(shamer) footprint_pos, fleb and genobj positions are relative to the footprint_pos
for footprint_attribute in instance.get("footprint_attributes", []):
attr = self.parse_footprint_attribute(footprint_attribute)
inst.add_footprint_attribute(attr)
for gen_obj_attribute in instance.get("gen_obj_attributes", []):
attr = self.parse_gen_obj_attribute(gen_obj_attribute)
inst.add_gen_obj_attribute(attr)
footprint_json = instance.get("footprint_pos")
if footprint_json:
footprint_pos = self.parse_footprint_pos(footprint_json)
else:
footprint_pos = None
inst.set_footprint_pos(footprint_pos)
# Get the Attributes
for key, value in instance.get("attributes").items():
inst.add_attribute(key, value)
# Add the ComponentInstance
self.design.add_component_instance(inst)