當前位置: 首頁>>代碼示例>>Python>>正文


Python ComponentInstance.add_gen_obj_attribute方法代碼示例

本文整理匯總了Python中upconvert.core.component_instance.ComponentInstance.add_gen_obj_attribute方法的典型用法代碼示例。如果您正苦於以下問題:Python ComponentInstance.add_gen_obj_attribute方法的具體用法?Python ComponentInstance.add_gen_obj_attribute怎麽用?Python ComponentInstance.add_gen_obj_attribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在upconvert.core.component_instance.ComponentInstance的用法示例。


在下文中一共展示了ComponentInstance.add_gen_obj_attribute方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: parse_component_instances

# 需要導入模塊: from upconvert.core.component_instance import ComponentInstance [as 別名]
# 或者: from upconvert.core.component_instance.ComponentInstance import add_gen_obj_attribute [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.add_gen_obj_attribute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。