Skip to content

feat(dwg2text): Add MTEXT formatting strip and dimension text extraction - #30

Merged
marevol merged 1 commit into
masterfrom
feature/mtext-formatting-and-dimension-text
Jan 22, 2026
Merged

marevol merged 1 commit into
masterfrom
feature/mtext-formatting-and-dimension-text

Conversation

@marevol

@marevol marevol commented Jan 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add MTEXT text extraction with formatting code removal for cleaner plain text output
  • Add dimension entity text extraction support for various dimension types
  • Fix development build paths in dwg2txt script

Changes Made

MTEXT Formatting Support (dwg2text/dx_iface.cpp)

  • Implement stripMTextFormatting() function that removes MTEXT formatting codes:
    • Paragraph breaks (\P) converted to newlines
    • Escape sequences (\\, \{, \}) converted to literal characters
    • Font specifications (\fFont|...;) stripped
    • Formatting toggles (\L, \O, \K for underline/overline/strikethrough) removed
    • Stacked fractions (\Snum^denom;) converted to num/denom format
    • Height, width, color, and other format codes stripped
    • Grouping braces { } removed
  • Support Japanese yen symbol (¥, U+00A5) as escape character (common in Japanese CAD files)
  • Add MTEXT entity case handling in printText() function

Dimension Text Extraction (dwg2text/dx_iface.cpp)

  • Add support for dimension entity types:
    • DIMLINEAR - Linear dimensions
    • DIMALIGNED - Aligned dimensions
    • DIMANGULAR - Angular dimensions (2 lines)
    • DIMANGULAR3P - Angular dimensions (3 points)
    • DIMRADIAL - Radial dimensions
    • DIMDIAMETRIC - Diametric dimensions
    • DIMORDINATE - Ordinate dimensions

Build Script Fixes (bin/dwg2txt)

  • Update dwg2text path to use .libs directory for autotools development builds
  • Add LD_LIBRARY_PATH export for shared library loading

Miscellaneous

  • Add .serena to .gitignore

Testing

  • Manual testing with DWG files containing MTEXT and dimension entities

🤖 Generated with Claude Code

- Add stripMTextFormatting() function to remove MTEXT formatting codes
  and extract plain text content (handles \P, \S, font specs, etc.)
- Support Japanese yen symbol (U+00A5) as escape character in MTEXT
- Add MTEXT entity handling to printText() function
- Add dimension entity text extraction (linear, aligned, angular, etc.)
- Fix dwg2txt script path to use .libs directory for development builds
- Set LD_LIBRARY_PATH for shared library loading
- Add .serena to .gitignore

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@marevol
marevol merged commit b3c5929 into master Jan 22, 2026
4 checks passed
Comment thread bin/dwg2txt

# Check if dwg2text exists
DWG2TEXT="${SCRIPT_DIR}/dwg2text"
DWG2TEXT="${SCRIPT_DIR}/../dwg2text/.libs/dwg2text"

@rurban rurban Jan 22, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong. The libtool wrapper is there and provides a proper LD search path fix up already. Just portable. This is not

@marevol
marevol deleted the feature/mtext-formatting-and-dimension-text branch February 5, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants