File: debug_proxy_graphic.py

package info (click to toggle)
ezdxf 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 104,528 kB
  • sloc: python: 182,341; makefile: 116; lisp: 20; ansic: 4
file content (28 lines) | stat: -rw-r--r-- 764 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#  Copyright (c) 2022, Manfred Moitzi
#  License: MIT License
import pathlib
import logging
import ezdxf
from ezdxf.proxygraphic import ProxyGraphicDebugger

ezdxf.options.load_proxy_graphics = True

CWD = pathlib.Path("~/Desktop/Outbox").expanduser()
if not CWD.exists():
    CWD = pathlib.Path(".")

logging.basicConfig(filename=CWD / "ezdxf-log.txt", level="DEBUG")
logger = logging.getLogger("ezdxf")

EXAMPLE = ezdxf.options.test_files_path / "mleader" / "mbway-mleader.dxf"

doc = ezdxf.readfile(EXAMPLE)
mleader = doc.entitydb["403"]
with open(CWD / "proxy-debug.txt", mode="wt") as stream:
    proxy = ProxyGraphicDebugger(
        mleader.proxy_graphic, doc, debug_stream=stream
    )
    proxy.log_commands()
    proxy.log_entities()

logging.shutdown()