def set_document( self, document: Drawing, auditor: Auditor, *, layout: str = "Model", overall_scaling_factor: float = 1.0, ): error_count = len(auditor.errors) if error_count > 0: ret = qw.QMessageBox.question( self, "Found DXF Errors", f'Found {error_count} errors in file "{document.filename}"\n' f"Load file anyway? ", ) if ret == qw.QMessageBox.No: auditor.print_error_report(auditor.errors) return self.doc = document self._render_context = RenderContext(document) self._reset_backend(scale=overall_scaling_factor) self._visible_layers = None self._current_layout = None self._populate_layouts() self._populate_layer_list() self.draw_layout(layout) self.setWindowTitle("CAD Viewer - " + str(document.filename))
def run(start): if start > 0: start -= 1 names = list(chain(glob.glob(DIR1), glob.glob(DIR2))) names = names[start:] count = 0 for filename in names: count += 1 print("processing: {}/{} file: {}".format(count+start, len(names)+start, filename)) doc = ezdxf.readfile(filename, legacy_mode=LEGACY_MODE) auditor = Auditor(doc) if len(auditor): auditor.print_error_report(auditor.errors)
def set_document(self, document: Drawing, auditor: Auditor): error_count = len(auditor.errors) if error_count > 0: ret = qw.QMessageBox.question( self, 'Found DXF Errors', f'Found {error_count} errors in file "{document.filename}"\nLoad file anyway? ' ) if ret == qw.QMessageBox.No: auditor.print_error_report(auditor.errors) return self.doc = document self._render_context = RenderContext(document) self._reset_backend() # clear caches self._visible_layers = None self._current_layout = None self._populate_layouts() self._populate_layer_list() self.draw_layout('Model') self.setWindowTitle('CAD Viewer - ' + str(document.filename))