blockdiag はプログラムでブロック図を生成するツール。
画面遷移図のようなものをプログラムで簡単に書く事ができ、Spyinxとの連携ができる。
ブロック図生成ツール blockdiag
環境
OS:Mac OS X 10.9.5
Python:Ver.2.7.7
インストール手順
/usr/local/Library/Formula/freetype2.rb を作成する。
require 'formula'
class Freetype2 <Formula
url 'http://sourceforge.net/projects/freetype/files/freetype2/2.4.4/freetype-2.4.4.tar.gz/download'
homepage 'http://freetype.sourceforge.net/index2.html'
md5 '9273efacffb683483e58a9e113efae9f'
version '2.4.4'
# depends_on 'cmake'
def install
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
# system "cmake . #{std_cmake_parameters}"
system "make install"
end
end
freetypeをインストールする。
$ brew install freetype2
PILをインストールする。
$ sudo easy_install pil
成功すると以下のような文言が表示される。
・・・
Installed /Library/Python/2.7/site-packages/PIL-1.1.7-py2.7-macosx-10.9-intel.egg
Processing dependencies for pil
Finished processing dependencies for pil
blockdiagをインストールする。
$ sudo easy_install blockdiag
ビルド方法
text.diagを作成する。
blockdiag {
画面1 -> 画面2 -> 画面3;
画面2 -> 画面4 -> 画面1;
}
test.diagをビルドする
pngで出力する
$ blockdiag test.diag
SVGで出力する
$ blockdiag -Tsvg test.diag
test.svgが出力される
PDFで出力する
$ blockdiag -Tpdf test.diag
エラーが出た場合
エラーが出た場合 1
PILのインストールで以下のエラーが出た場合。
・・・
_imagingft.c:73:10: fatal error: 'freetype/fterrors.h' file not found
#include <freetype/fterrors.h>
^
1 error generated.
error: command 'cc' failed with exit status 1
以下のコマンドを実行しシンボリックリンクをはる。
$ sudo ln -s /usr/local/Cellar/freetype2/2.4.4/include/freetype2/freetype /usr/local/include/freetype
エラーが出た場合 2
blockdiagコマンドで「The _imagingft C module is not installed」が出た場合
$ blockdiag test.diag
ERROR: The _imagingft C module is not installed
(案1)PILを一旦アンインストール
$ sudo easy_install -m PIL
$ sudo rm -rf /Library/Python/2.7/site-packages/PIL-1.1.7-py2.7-macosx-10.9-intel.egg
PILを再インストール
$ sudo easy_install pil
(案2)他にPillowがインストールされていないか確認
$ pip freeze
・・・
Pillow==2.5.3
・・・
Pillowをアンインストール
% sudo pip uninstall pillow
この状態でblockdiagを実行するとPillowが無いと怒られる
% blockdiag test.diag
Traceback (most recent call last):
File "/usr/local/bin/blockdiag", line 5, in <module>
from pkg_resources import load_entry_point
File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 2867, in <module>
File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 432, in _build_master
corresponding to the path entry, and they are added. `entry` is
File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 728, in require
requirements specified when this environment was created, or False
File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 622, in resolve
shadow_set = self.__class__([])
pkg_resources.DistributionNotFound: Pillow
Pillowをインストール
% sudo easy_install Pillow
エラーが出なくなった
$ blockdiag test.diag
$