Repository navigation
0.5.0: text codes and stacked tolerances
Text as it reads: TEXT and MTEXT codes decoded, stacked tolerances kept as data (#32).
New
DXF.TextContentbeside each text, read withDrawing.textContent(ofEntityAt:)(andBlock.textContents): the string as written (raw), its syntax (TEXT or MTEXT), its parts, the plain text and its stacks.DXF.StackedText: a stacked tolerance or fraction, withupper,lowerandkind(tolerance^, fraction/, diagonal fraction#), andupperValue/lowerValue, which read a point or a comma as the decimal mark.36{\H2.4;\S+0,011^ -0,005;}reads36 +0,011/-0,005, upper+0,011, lower-0,005.- Special characters:
%%cis⌀(U+2300),%%d°,%%p±,%%%%,%%nnnthe Unicode character up to 255;%%u,%%oand%%kare dropped. Caret notation^,^I,^J. - MTEXT formatting codes (
\A,\C,\F,\H,\Q,\T,\W,\pand the switches and braces) are removed;\P,\Nand\Xare line breaks,\~a no-break space. A code that is not understood is kept as written, so nothing is lost silently. DimensionTextuses the same scanner: its words hold no formatting codes, a stack is a new.stackpart whose numbers are not typed numbers, and it gainsstacksandplain.dxfdump --texts, andtools/text_oracle.pyfor the same output from ezdxf. Over 23,429 strings in 3,109 real drawings the two agree on all but 25, each a Jw_cad superscript mark ezdxf reads differently, as the README notes.
Changed (see "Upgrading from 0.4" in the README)
- The
stringof.textis the text as it reads. It used to keep each MTEXT code's body (36{H2.400000;S+0,011^ -0,005;}) and leave%%c,%%dand%%pas written. The.textcase keeps its shape, so no consumer stops compiling. - A backslash in a TEXT stays a character (TEXT and MTEXT follow different rules, as AutoCAD and ezdxf do).
\U+XXXXis still decoded. DimensionText.Parthas a new case,.stack, so an exhaustiveswitchover the parts needs it.Dimension.textOverrideis unchanged.
Not yet: decoding through the drawing's code page (\M+nXXXX, %%nnn through $DWGCODEPAGE) is #36.