チートシート

手元に置く早見表。

印刷して手元に置くとはかどる。たぶん。


プリミティブ

3D

関数 引数
box w h d box 80 60 10
cylinder r h cylinder 5 10
sphere r sphere 10
cone r1 r2 h cone 10 0 20
torus r1 r2 torus 20 5
wedge dx dy dz ltx wedge 20 10 15 5

位置規約: box/cylinder/sphere/cone/torus は原点中心(centered)。extrude h は z=0..h で底面合わせ。混在する場合は | floor / translate / center:(true,true,false) で揃える。

2D

関数 引数
rect w h rect 50 30
circle r circle 10
ellipse rx ry ellipse 10 5
polygon n r polygon 6 10
polyline points polyline [(0,0), (10,0), (5,10)]
text content size text "ABC" 10
sketch [segments] sketch [(5,0), arc (5,0) (0,-5) (-5,0), (0,7), (5,0)]

sketch セグメント: タプル=直線, arc 開始点 通過点 終点=3点円弧, arc 開始点 終点 center:(cx,cy)=中心アーク, arc 開始点 終点 radius:半径=半径アーク, bezier [制御点]=ベジエ(開始点は前セグメント終端、制御点と末尾の終点のみ指定), spline [通過点]=スプライン(同様)。最初の要素が開始点、自動close。

パス

関数 引数
line start end line (0,0,0) (10,0,10)
arc start through end / start end center:(cx,cy) / start end radius:radius arc (0,0,0) (5,5,0) (10,0,0), arc (0,0) (0,$r) center:(0,0), arc (0,0) (5,3) radius:2
bezier points bezier [(0,0,0), (5,10,0), (10,0,0)]
helix pitch h r helix 5 30 10
spline points spline [(0,0,0), (10,5,5), (20,0,10)]
wire [segments] wire [(0,0), (10,0), arc (10,0) (15,5) radius:5]

wiresketch のopen版(auto-closeなし)。複数セグメントを結合した開wireを作る。2D/3D両対応。sweep pathに最適:

wire [(0,0), (10,0), arc (10,0) (15,5) radius:5] | sweep (circle 5)

sketchと同様に、workplaneと組み合わせて任意の平面上にパスを描ける:

workplane XZ | wire [(0,0),(10,0),(10,10),(0,10),(0,0)] | sweep (circle 2)

パイプ操作

修飾

操作 説明
fillet r 角丸 fillet 2
chamfer r 面取り chamfer 1
shell t 中空化 faces >Z | shell 2
offset d ワイヤ/面外形オフセット(+外側, -内側) offset -10

ブーリアン

操作 説明
diff shape 引く diff cylinder 5 10
union shape 足す union sphere 5
inter shape 交差 inter box 20 20 20

パイプ操作: box 10 10 10 | diff (sphere 7) ソースコマンド: union [box 10 10 10, sphere 7] / diff [...] / inter [...]

配置

操作 説明
place shape 2D形状を配置 place $profile, place (circle 3)

変数に格納した2D形状を面の上に配置してから cutextrude できる:

$s = sketch [(5,0), arc (5,0) (0,-5) (-5,0), (0,7), (5,0)]
box 10 10 10 | faces >Z | place $s | cut

2D → 3D

操作 説明
extrude h 押し出し extrude 10 draft:5
revolve axis [deg] 回転体(axis: X/Y/Z、deg省略で360°) revolve Y, revolve X 180
sweep profile pathに沿って profile を押し出し(pipeline側がpath/spine)。path/profileは開/閉どちらのwireでもよい helix 5 30 10 | sweep (circle 2)
loft [sections] h 複数断面を接続 loft [rect 8 8] 10

加工

操作 説明
cut カット(省略で貫通) `circle 5
hole r 穴あけ(面の中心 or 各ポイント、省略で貫通) `faces top

変形

操作 説明
floor 底面をz=0に揃える box 10 10 10 | floor
translate x y z 平行移動 translate 0 0 5
rotate rx ry rz 回転 rotate 0 0 45
scale s / scale sx sy sz スケール(一様/非一様) scale 2, scale 2 1 0.5
mirror "axis" 鏡像反転 mirror "X"

translate, rotate, scaleorigin: キーワードを受け付けます: "world"(デフォルト), "local"(BBox中心), (x,y,z)

rotate 0 0 45 origin:"local"    # オブジェクト中心で回転
scale 2 origin:(10, 0, 0)       # 任意の点を基準にスケール

選択とワークプレーン

選択

| faces sel        # 面を選択
| edges sel        # エッジを選択
| verts sel        # 頂点を選択(2Dでは形状の頂点を返す。2D/3Dプリミティブを配置可)
| verts | translate x y z   # 頂点位置をオフセット(選択を維持)
| points [...]     # 座標で点を指定
| points (polar n r)     # 円形配置
| points (grid nx ny p)  # 格子配置
| points ... | translate x y z  # ポイント位置をオフセット(選択を維持)

Face選択の後では polar / grid を直接書ける(points を省略可):

| faces top | polar 6 20 | hole 3     # points (polar 6 20) と同じ
| faces top | grid 2 3 20 | hole 3    # points (grid 2 3 20) と同じ

セレクタ記号

記号 意味
> 最大方向 faces >Z — 上面
< 最小方向 faces <Z — 底面
= 平行 edges =Z — Z軸に平行なエッジ
+ 垂直 faces +Z — Z軸に垂直な面

名前エイリアス

エイリアス 等価
top >Z
bottom <Z
right >X
left <X
front <Y
back >Y

複合セレクタ

| edges >Z >X          # AND: Z最大 かつ X最大
| edges [>Z, <Z]       # OR: Z最大 または Z最小

名前付け(as)

| faces <X as $left     # 面に名前を付けて後から参照
| edges =Z as $top_edges

ワークプレーン

| faces top | rect 50 30      # Face選択から直接2D描画(暗黙workplane)
| faces top | workplane XZ    # 軸を明示したい場合のみ workplane を書く

配置 at:

at: は名前付き引数。単純な座標はカッコ省略推奨。式を含む場合はカッコ必須。

cylinder 2.5 10 at:20 10                 # 単一位置(カッコ省略推奨)
cylinder 2.5 10 at:(20, 10)              # カッコ付きも有効
cylinder 2.5 10 at:[(0,0), (20,10)]      # リスト(ブラケット必須)
rect 10 5 angle:45                       # 回転(angle: 名前付き引数)
box 10 10 3 | polar 6 20                 # 円形配列(3Dコンテキスト)
box 10 10 3 | grid 4 3 20               # 格子配列(3Dコンテキスト)

Face選択コンテキストでは polar/gridpoints として解釈される:

box 10 10 10 | faces top | polar 6 20 | circle 3 | cut   # 点を円形配置
box 10 10 10 | faces top | grid 2 3 20 | circle 3 | cut  # 点を格子配置

構文

変数

$w = 80
box $w $w/2 10

関数定義

def name($args) = pipeline

インポート

import "gear"

条件式

if $x > 0 then $x else -$x

リスト内包

[$i * 10 for $i in range(6)]

演算子(優先順位 高→低)

*** / // %+ - → 比較 → andor|


CLIオプション

オプション 説明
-D key=value パラメータを上書き(複数指定可) poly build m.poly -D width=100
--params-file file JSONファイルからパラメータを読み込み poly build m.poly --params-file p.json
-o file 出力ファイルを指定 poly build m.poly -o out.stl

-D の型推論: 100 → int, 1.5 → float, true/false → bool, その他 → string

-D--params-file を併用すると -D が優先。優先順位: -D > --params-file > .poly.params.json > @param デフォルト値

poly build box.poly -D width=100 -D height=50
poly build box.poly --params-file presets/small.json -D width=120

コンテキスト遷移

3D ─→ faces/edges ─→ 2D ─→ extrude/cut ─→ 3D
              │        │
              │        └── hole ──→ 3D(面の中心に穴)
              │
              └── fillet/chamfer ──→ 3D

2D ─→ verts ──→ 2Dプリミティブ ─→ 2D
       │    └─→ 3Dプリミティブ ─→ 3D
       │    └─→ translate ─→ verts(位置をずらして選択維持)
       │
points ──→ hole ──→ 3D(各ポイントに穴)
       └─→ translate ─→ points(位置をずらして選択維持)

覚え方: 作る → 選ぶ → 描く → 戻るworkplane は省略可。面を選べばそのまま描ける)

verts で頂点を取ると、2D/3Dどちらのプリミティブも各頂点に配置できる。 translate で位置をずらしてから配置することもできる:

rect 100 100 | verts | circle 1      # 各頂点に円を配置 → 2D
rect 100 100 | verts | box 1 1 1     # 各頂点にboxを配置 → 3D
rect 80 60 | verts | translate 10 10 10 | cone 2 0 6   # 頂点をオフセットしてから配置