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


Python ComponentInstance.set_footprint_pos方法代码示例

本文整理汇总了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)
开发者ID:aasimmerchant05,项目名称:schematic-file-converter,代码行数:45,代码来源:openjson.py


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