Esempio n. 1
0
    def get_handle(self, entity: Tags) -> Optional[str]:
        if not len(entity):
            return None

        try:
            return entity.get_handle()
        except ValueError:
            # fast retrieval of dummy handle which isn't stored in tags:
            return self._dummy_handle_index.get(id(entity[0]))
Esempio n. 2
0
 def show_entity_found_message(self, entity: Tags, index: int):
     dxftype = entity.dxftype()
     if dxftype == "SECTION":
         tail = " @ {0} Section".format(
             entity.get_first_value(2))  # type: ignore
     else:
         try:
             handle = entity.get_handle()
             tail = f" @ {dxftype}(#{handle})"
         except ValueError:
             tail = ""
     line = self.doc.get_line_number(entity, index)
     self.show_message(f"Found in Line: {line}{tail}")
Esempio n. 3
0
 def entity2html(
     self, tags: Tags, create_ref_links=False, show_ref_status=False
 ):
     """DXF entity as <div> container."""
     tags = Tags(tags)
     name = tags.dxftype()
     if create_ref_links:  # use entity name as link to the DXF reference
         name = build_ref_link_button(name)
     refs = ""
     if show_ref_status:
         try:
             handle = tags.get_handle()
         except DXFValueError:
             pass
         else:
             if handle not in self.pointers:
                 refs = '<div class="ref-no">[unreferenced]</div>'
             else:
                 refs = self.pointers2html(self.pointers[handle])
     return ENTITY_TPL.format(
         name=name, tags=self.tags2html(tags), references=refs
     )
Esempio n. 4
0
 def get_handle(tags: Tags):
     try:
         return tags.get_handle()
     except ValueError:
         return "0"