File: transplant_acis_data.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-- 560 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import ezdxf

DONOR = "torus_r2010.dxf"
RECIPIENT = "torus_r2000.dxf"

donor_doc = ezdxf.readfile(DONOR)
donor = donor_doc.modelspace()[0]

recipient_doc = ezdxf.readfile(RECIPIENT)
recipient = recipient_doc.modelspace()[0]


# Implant donor ACIS entity into recipient entity
recipient.sat = donor.sat
patient_name = f"patient_{recipient_doc.acad_release}.dxf"
recipient_doc.saveas(patient_name)


# reload
patient = ezdxf.readfile(patient_name)
entity = patient.modelspace()[0]

with open("implant.sat", "wt") as fp:
    fp.write("\n".join(entity.acis_data))