File: missing_block_definitions.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 (24 lines) | stat: -rw-r--r-- 647 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
#  Copyright (c) 2021-2022, Manfred Moitzi
#  License: MIT License
import pathlib
import ezdxf

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

# Create a DXF document with missing BLOCK definitions
# to see how AutoCAD/BricsCAD reacts:
doc = ezdxf.new()
msp = doc.modelspace()

# HEADER variables for arrows:
doc.header["$DIMBLK"] = "DoesNotExist"
doc.header["$DIMBLK1"] = "DoesNotExist"
doc.header["$DIMBLK2"] = "DoesNotExist"
doc.header["$DIMLDRBLK"] = "DoesNotExist"

# INSERT without a BLOCK definition:
msp.add_blockref("TEST", (0, 0))

doc.saveas(CWD / "missing_block_definitions.dxf")