dynamicsoar's log

主に研究関係のメモ

ANSYS Designmodeler: "Heal" when importing external geometry (e.g., IGES, STEP) can be hazardous

I noticed a wingtip of my bird model (STEP file) is hugely distorted when I set the Heal to Yes when importing external geometry in ANSYS DesignModeler (v 19.1). Therefore, from now on, I will use Heal = No as the first choice. On the other hand, Clean = No almost always fails so I'll be using Clean = Normal as the first choice.

ORS Dragonfly 4.1: "Keep same geometry" crops your slices (Z-direction) as well as XY, so be careful

In ORS Dragonfly Image Loader, there's an option Import another dataset… which is useful if you need to load more than 1 dataset with different settings, e.g., different cropping. If you do that, the cropping ROI is reset every time. Sometimes you may want to start from the same ROI, which is possible with Keep same geometry… option. And I though "oh this is convenient." However, this option must be used with caution.

Imagine you at first loaded 100 slices (images), set the cropping ROI, and turned on both Import another dataset… and Keep same geometry… options. Then you tried to load 300 images this time. Adjusted the cropping ROI. Done. What happens is quite surprising (to me at least). The 1st dataset is intact. The 2nd dataset loads only the first 100. This is presumably because the software "tried to keep the same geometry." But somehow I thought that only applies to XY geometry. I never imagined that some slices were not loaded w/o any caution or warning at all. But it seems to me this is the current behaviour. I already reported this to the developer so it might be changed in the next release. Until then, be careful when you use the option...

Rhinoceros with python script: CurveThroughPoints (rs.AddInterpCurve) after sorting the points

Background

I have a few points with witch I want to make a CurveThroughPoints. This is not a problem when doing it manually but when I tried that with python script using rs.AddInterpCurve, it generated strange looping curve. It's quite obvious the order of the points *1 is used for drawing the curve, instead of using the distance to the next point which is likely to be used in the CurveThroughPoints. Therefore, to my understanding, I have to sort the points by myself. So I did that.

Code

Assuming you have a layer "pts_test1" containing the points, and an empty layer "crv_test1" where your resultant curve will be placed.

def make_curve_through_points(layer_name_pts, layer_name_crv, deg, ktstyle):
    ## Obtain the GID of the points
    rs.CurrentLayer(layer_name_crv)
    id_points = rs.ObjectsByLayer(layer_name_pts, True)

    ## Obtain 3D coordinates of each point
    points_3d = []
    for i in range(0, len(id_points)):
        points_3d.append( rs.PointCoordinates(id_points[i]) )

    ## Sort the points
    points_sorted = rs.SortPointList(points_3d)

    ## Generate the curves
    rs.AddInterpCurve(points_sorted, degree=deg, knotstyle=ktstyle, start_tangent=None, end_tangent=None)


## Sample usage
layer_name_pts = "pts_test1"
layer_name_crv = "crv_test1"
deg = 3
ktstyle = 1
make_curve_through_points(layer_name_pts, layer_name_crv, deg, ktstyle)

Instead of using SortPointList, directly specifying the direction with SortPoints might be necessary depending on the situation.

References

*1:Perhaps the order of generations of the points, which is held internally and cannot be seen...

Papers 3 (legacy) から Zotero 5 へ移行中なのでメモ

まえがき

なぜ移行するか

いろいろな理由がある。

  • Papers 3 がかなり不安定になっていた
  • Mac だけで完結といえば聞こえは良いがその mac が死んだら論文が読めなくなる(ほぼ書けなくもなる)、というのが嫌だった。
    • 切実な問題として、macbook pro のバッテリが死にかけており、交換に出したいが、万が一を考えると他の環境でも作業できないと困る、というのもある。タイミング的にちょうどいいということ。
  • ReadCube Papers を trial したが、お金払う割にはまだ微妙な面が多いと感じた。Unlimited storage も、Dropbox にお金払って 2TB もスペースがある自分には魅力的ではない。
  • iPad いまはすごく古い機種しかないし、まぁとりあえずは読めなくても良い。

というわけでかねてから考えていた Zotero への移行をした(しつつある)。

環境

  • MacBook Pro(Papers 3を使っていた)
  • 他の Win マシン(自宅と研究室にある)

の全てに入れて sync することを目指す。また、Overleaf との連携か、少なくとも citekey の簡単なコピペもできないと困るので、そのへんもやる。

手順

最低限の知識

Zotero におけるネット経由の同期では、メタデータ(論文タイトルとか著者名とかそういうやつ)のことを data sync, PDFファイルなどの添付ファイルのことを file sync と呼んで明確に区別している。前者の data sync はどうせ容量も大したことないからだろうけど Zotero アカウント経由で無料で可能。一方、後者の file sync の方は、いくつかの方法があり、デフォルトの Zoteroクラウドストレージでは 300 MB を超えると有料(ストレージを買う必要がある)。今回はこの file sync の方を Dropbox 経由でやることにする。

[Mac] Papers 3 から bibtex ライブラリのエクスポート

気が向いたら書くかも。まぁ簡単なので…。

[Mac] Zotero のインストール

Zotero をインストールしたらまず Preferences > Sync タブ > File Syncing の2つの ticks を外す。たぶんこれをそのままにして他の設定をやってしまうと勝手に PDF を zoteroクラウドストレージ(無料アカウントだと 300 MBしかない)にアップロードし始めるんじゃないかと思う…。

[Mac・Win] Data sync の設定

もしまだ Zotero アカウントを作っていなかったらウェブから作る。

アプリを開き Preferences > Sync タブ > Data Syncing で link する。このとき、すぐ下の File Syncing の2つのアイテムに ticks が自動で入ってしまうので、これらは忘れずに untick する。

[Mac・Win] Dropbox 経由での file sync の設定

Preferences > Advanced タブ > Files and Folders タブ(ちょっと分かりづらい位置にある)で、Base directory を選択する。自分は今回、とりあえず Papers 3 のディレクトリ構造をそのまま使うことにしたので、Dropbox/Library.papers3/Filesmac, win の両方で選んだ。ここがポイントで、両方で設定しておかないとPDFの自動探索に失敗する。

[Mac or Win] bibtex ライブラリのインポート

難しいことはないので省略。別に Win でやってもいいと思うけど mac 側でやった。

[Mac・Win] Overleaf との連携

これができるのは Overleaf の有料プランだけかもしれない。が、公式に説明がない…ひどすぎる。しかしググると非公式の解説があったのでそのとおりにやった。

Overleaf のプロジェクト一覧みたいな一番基本の画面で、右上の Account > Account Settings で少し下の方にスクロールすると Zotero Integration てのがある。

次に、任意のプロジェクト(論文)を開いて、左上の方にあるアイコンで New File を選ぶ。すると From Zotero ってのがあるので、名前をつけて、BibTeX か BibLaTeX かを選んで、Create を押す。けっこう時間がかかる。しかもたぶん、失敗したというエラーメッセージが出る。が、実際にはもう少し待つと .bib ファイルはこっそり生成される。エントリの数はあっていたので、よくわからないがダイアログのほうがおかしいようだ。

というかこれ別に Zotero 側のライブラリの変更を検知とかしてないような気がする。Zotero で変更があっても、Overleaf 上でもう一度 Create しないと反映されないんじゃないか?(未確認)もしそうなら、ローカルの Zotero でエクスポートして、Overleaf にアップロードする、という従来の方法でもいいかもしれない…。

[Mac・Win] Better BibTeX for Zotero (BBT) のインストール・設定

retorque.re

インストールは他の add-on と同様。xpi ファイルをダウンロードしてきて、Zotero メニューの Tools > Add-ons > 右上の歯車アイコン > Install Add-on From File... でその xpi ファイルを選択。Zotero を再起動。

再起動すると、いくつか質問される。主には citekey 形式をどうするか。自分はせっかくなので BBT 形式にすることにした。その後、ライブラリ内のすべての文献について citekey が生成されるのでしばし待つ。終わると、メインペインに Citekey カラムが追加されるのと、右の Info ペインの一番上にも citekey が出るようになる。

しかしこれらをいちいちコピペするのはまだ面倒…そこで自分はこの後、文献のエントリを drag & drop することで \citep{ citekey } みたいのをコピペできるように設定した(参考: http://retorque.re/zotero-better-bibtex/citing/#drag-and-drophotkey-citations )。

  1. Preferences > Export タブ > Default Format: を Better BibTeX Citation Key Quick Copy に変更する。
  2. Preferences > Better BibTeX タブ(新しくできている)で自分の好みに設定する。
    • たとえば citep しか使わないのなら、Quick copy format を LaTeX にして、LaTeX command には citep と入れておく。
    • 一方で「cite を使ったり citep を使ったりするのでそこは自分で書きたい、純粋に citekey だけをコピペして欲しい」ということなら、QuickCopy format で Cite Keys を選べばよい。

ちょっとわからないのが、これ win と mac 両方に入れる場合、citekey 命名ルールとかを完全に同じにしとかないと data sync するときにコンフリクトしそうなんだが…さすがにそこはなにかしら考えられているはずか。

他の add-ons

ZotFile と Zutilo は入れてみたけどまだ使い方がぜんぜんわかってない。これから。

追記 (2020-01-17):Zotero Connector で data & file (PDF) を import するときの設定

Zotero Connector (Chrome) で保存すると、PDF が dropbox 内にはいかないことに気づいた。ググってるとかなりよいウェブページを発見:

en.dlyang.me

Step 4 の ZotFile Preferences の設定で、両方とも Dropbox 内のディレクトリに変えるとちゃんとそこ(のサブフォルダ)へ保存されるようになった。これまでにダウンロードしていたPDFを Dropboxディレクトリへ送ってそこへのリンクにしたいときは、エントリ(複数でもよい)を選択して右クリック>Manage attachments > Rename attachments すると自動的にそのようになった。

しかしまだよくわかってないな…このページの最後の方にある symbolic link を作れみたいのが必要なのかどうかがわからん…

ParaView 5.6 以降で Plot3D の function file を読むには .q file も読む必要がある、というバグ

discourse.paraview.org

現状、version 5.5.2 以下を使うのが手っ取り早い。あるいはダミーの .q file を用意するか。

実は自分も昔 FIELDVIEW を使っていた頃には中身のほぼ全部がダミーの .q file を作っていた*1。ダミーでないのは時刻や Mach, alpha などの変数のみで、しかも Mach や alpha のところに実際には別の変数を代入するという小技を使っていた。まぁそれはそれとして、これはとても不便。

*1:すべてのセルの値として0を書き込んでいた。