installし、単に dwggrep を実行しただけです。
文字情報の抽出精度?は、確認していません
参考url
- https://www.gnu.org/software/libredwg/
- https://github.com/LibreDWG/libredwg
- https://medium.com/@gaganjyot/libredwg-installation-on-linux-f31cf9a2fdff
install
$ cat /etc/redhat-release Red Hat Enterprise Linux release 8.7 (Ootpa) ## for python binding $ sudo yum install swig $ wget https://ftp.gnu.org/gnu/libredwg/libredwg-0.12.5.tar.gz $ ./configure $ make $ make check $ sudo make installation $ sudo ldconfig $ ls -l /usr/local/bin/dwg* -rwxr-xr-x 1 root root 213912 Feb 16 15:33 /usr/local/bin/dwg2dxf -rwxr-xr-x 1 root root 282488 Feb 16 15:33 /usr/local/bin/dwg2SVG -rwxr-xr-x 1 root root 304912 Feb 16 15:33 /usr/local/bin/dwgadd -rwxr-xr-x 1 root root 204736 Feb 16 15:33 /usr/local/bin/dwgbmp -rwxr-xr-x 1 root root 1787 Feb 16 15:33 /usr/local/bin/dwgfilter -rwxr-xr-x 1 root root 404768 Feb 16 15:33 /usr/local/bin/dwggrep -rwxr-xr-x 1 root root 202248 Feb 16 15:33 /usr/local/bin/dwglayers -rwxr-xr-x 1 root root 204112 Feb 16 15:33 /usr/local/bin/dwgread -rwxr-xr-x 1 root root 208160 Feb 16 15:33 /usr/local/bin/dwgrewrite -rwxr-xr-x 1 root root 217280 Feb 16 15:33 /usr/local/bin/dwgwrite $ ls -l /usr/local/bin/dxf* -rwxr-xr-x 1 root root 208144 Feb 16 15:33 /usr/local/bin/dxf2dwg -rwxr-xr-x 1 root root 219336 Feb 16 15:33 /usr/local/bin/dxfwrite
dwggrepコマンドによるテキスト抽出
$ /usr/local/bin/dwggrep --version dwggrep 0.12.5 $ /usr/local/bin/dwggrep --help Usage: dwggrep [OPTIONS]... pattern files Search regex pattern in a list of DWGs. -i Case-insensitive pattern -x Extended regex pattern -c, --count Print only the count of matched elements. -h, --no-filename Print no filename. -y, --type NAME Search only NAME entities or objects. -d, --dxf NUM Search only DXF group NUM fields. -t, --text Search only in TEXT-like entities. -b, --blocks Search also in all block definitions. --tables Search only in table names. --help Display this help and exit --version Output version information and exit GNU LibreDWG online manual: <https://www.gnu.org/software/libredwg/>
$ /usr/local/bin/dwggrep . cad-data.dwg cad-data.dwg DICTIONARY 3: ACAD_2007HEADERVARS_RT <略> cad-data.dwg DICTIONARY 3: Normal <略> cad-data.dwg DICTIONARY 3: A3横 <略> cad-data.dwg STYLE 2: 2.5mmMS ゴシック <略> cad-data.dwg LTYPE 3: Hidden __ __ __ __ __ __ __ __ __ __ __ __ __ _ cad-data.dwg LTYPE 3: Phantom (.5x) ___ _ _ ___ _ _ ___ _ _ ___ _ _ cad-data.dwg LTYPE 3: Center ____ _ ____ _ ____ _ ____ _ ____ _ ____ <略> cad-data.dwg TEXT 1: D矢視図 cad-data.dwg TEXT 1: B矢視図 cad-data.dwg TEXT 1: C矢視図 cad-data.dwg TEXT 1: 断 面 図 cad-data.dwg TEXT 1: 壁 <略> cad-data.dwg ATTRIB 1: W 総組時