LoginSignup
8
4

More than 3 years have passed since last update.

PythonでCAD(.dxf、Excel)ファイルを読むメモ

Last updated at Posted at 2019-07-04

DXFとは

Drawing eXchange Format の略。
異なるCAD間での図面データをやりとりするための中間・共通フォーマット。

直線と円と円弧の2Dデータが多い。

Autodesk社が開発したファイル形式の1つ。

Autodesk社は、CADと言われる図面を作成するソフトウェアを開発している会社。
Autodesk社が開発した製品と言えば、AutoCADという代表的なソフトウェアがある。

AutoCADは設計事務所を中心に日本でも幅広く普及しており、聞いたことがあるという方も少なくない。
拡張子の1つであるDXFは、CADソフトであるAutoCADで図面が作成されたときに、保存する形式として選択することができる

既存のPythonでDXFファイルを読み書きできる主なモジュール

dxfgrabber

・DXFから情報を取得。全DXFバージョンに対応。読み込みのみ対応。
https://dxfgrabber.readthedocs.io/en/latest/

dxfwrite

A Python library to create DXF R12 drawings.書き込み専用
https://pypi.org/project/dxfwrite/

インストール

Anaconda環境にpipでインストールなど

動作方法:Anaconda をダウンロードする (MacもしくはWindows)
Anacondaのダウンロードページを開いて、「64-BIT INSTALLER」をクリックし、
https://www.anaconda.com/

「Anaconda3-4.4.0-Windows-x86_64.exe」をダウンロード.Macの場合は該当の箇所をクリック。

スクリーンショット (54).png

pip install dxfgrabber

使い方の例

ファイル読み込み
>>> import dxfgrabber
>>> dxf=dxfgrabber.readfile("hogehoge.dxf")

無料CADソフト

RootPro CAD

Jw_cad

参照URL

・Myfuturesightforpast
 PythonのCAD(.dxf)ファイル読み書きモジュールまとめ
 https://myfuturesightforpast.blogspot.com/2014/07/pythoncaddxf.html

・DXFと亀
 https://qiita.com/ackermanrf128/items/d9275a7d077c1dff3ec7

・AutoCAD
 https://knowledge.autodesk.com/ja/support/autocad

8
4
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
4