vibesketch.document.cdx¶
Binary CDX, ChemDraw’s native format, read by translating it to CDXML (#95).
A CDX file is a tree of tagged objects with tagged properties; CDXML is the
same tree written as XML, object for object and property for property. So
this module rewrites a CDX file as CDXML and hands it to
vibesketch.document.cdxml.read_cdxml(), which reads the drawing as it
reads any CDXML file: the structures through RDKit, arrows, plus signs,
text, shapes and the reaction scheme from the elements.
Only the objects and properties that reader uses are translated; any other property is left out, and an unknown object becomes an element the reader reports as left out. Integers are read at the size they are stored with, since ChemDraw 8.0 wrote some 2-byte properties as 1 byte.
Sources: CambridgeSoft, “CDX Format Specification”: the header, objects and
properties (Introduction), the data types CDXCoordinate, CDXPoint2D,
CDXPoint3D, CDXRectangle, CDXObjectID and CDXString with its style runs, and
the tables of objects and properties with their CDXML names, mirrored at
https://chemapps.stolaf.edu/iupac/cdx/sdk/; and the enumerations in
CDXConstants.h of Revvity’s ChemDraw file library (BSD-3-Clause), which
RDKit bundles: https://github.com/Glysade/chemdraw.
Module Attributes
|
"VjCD0100", the reserved 04 03 02 01, then reserved zero bytes before the document. |
|
Object tags and their CDXML element names. |
Functions
|
A binary CDX file as the equivalent CDXML; raises |
Exceptions
The data is not a CDX file this reader can use. |
- exception vibesketch.document.cdx.CdxUnreadable[source]¶
Bases:
ValueErrorThe data is not a CDX file this reader can use.
- vibesketch.document.cdx.cdx_to_cdxml(data)[source]¶
A binary CDX file as the equivalent CDXML; raises
CdxUnreadable.